1
0
Fork 0

chore: Added doll/giant to pattern tests

This commit is contained in:
joostdecock 2021-09-12 13:13:57 +02:00
parent 56e306d13a
commit 31d7632b75
3 changed files with 76 additions and 50 deletions

View file

@ -1,3 +1,5 @@
const nonHuman = require('./non-human-measurements.js')
// Some patterns are different
const isGarment = design => ([
'rendertest',
@ -41,7 +43,7 @@ const testPatternDrafting = (design, Pattern, expect, models, patterns, log=fals
* Draft pattern for different models
*/
if (isGarment(design)) {
it('Draft for human models:', () => true)
it('Draft for humans:', () => true)
for (let size in ourModels) {
it(` - Drafting for ${size} (${breasts ? 'with' : 'no'} breasts)`, () => {
@ -56,32 +58,28 @@ const testPatternDrafting = (design, Pattern, expect, models, patterns, log=fals
}
// Do the same for fantistical models (dolls, giants)
it('Draft for non-human models:', () => true)
it('Draft for dolls:', () => true)
const fractionModel = fraction => {
const model = {}
for (const [measie, value] of Object.entries(ourModels.size40)) {
model[measie] = value * fraction
}
return model
}
const models = {
// These are just names, don't read too much into it
'Gnome (0.1)': fractionModel(0.1),
'Halfling (0.2)': fractionModel(0.2),
'Goblin (0.5)': fractionModel(0.5),
'Dwarf (0.75)': fractionModel(0.75),
'Elf (1.5)': fractionModel(1.5),
'Ogre (2.5)': fractionModel(2.5),
'Firbolg (5)': fractionModel(5),
}
for (let size in models) {
for (let size in nonHuman[breasts ? 'withBreasts' : 'withoutBreasts'].dolls) {
it(` - Drafting for ${size} (${breasts ? 'with' : 'no'} breasts)`, () => {
expect(
doesItDraft(
new Pattern({
measurements: models[size]
measurements: nonHuman[breasts ? 'withBreasts' : 'withoutBreasts'].dolls[size]
}), log
)
).to.equal(true)
})
}
it('Draft for giants:', () => true)
for (let size in nonHuman[breasts ? 'withBreasts' : 'withoutBreasts'].giants) {
it(` - Drafting for ${size} (${breasts ? 'with' : 'no'} breasts)`, () => {
expect(
doesItDraft(
new Pattern({
measurements: nonHuman[breasts ? 'withBreasts' : 'withoutBreasts'].giants[size]
}), log
)
).to.equal(true)