diff --git a/tests/patterns/config.js b/tests/patterns/config.js index 361d0ff757f..d2517d5576c 100644 --- a/tests/patterns/config.js +++ b/tests/patterns/config.js @@ -110,7 +110,9 @@ const testPatternConfig = (design, pattern, expect, models, patterns) => { * Test validity of the pattern's options */ it('Pattern options:', () => true) + console.log(pattern.config.options) for (let name in pattern.config.options) { + console.log(name) let option = pattern.config.options[name] let type = typeof option if (type === 'object' && typeof option.pct !== 'undefined') { @@ -184,10 +186,10 @@ const testPatternConfig = (design, pattern, expect, models, patterns) => { }) } else if (type === 'number') { // Static number - return true + it(` - '${name}' is a static number`, () => true) } else if (type === 'string') { // Static string - return true + it(` - '${name}' is a static string`, () => true) } } } diff --git a/tests/patterns/drafting.js b/tests/patterns/drafting.js index ee71fc87b05..eda1e1db566 100644 --- a/tests/patterns/drafting.js +++ b/tests/patterns/drafting.js @@ -41,7 +41,7 @@ const testPatternDrafting = (design, Pattern, expect, models, patterns) => { * Draft pattern for different models */ if (isGarment(design)) { - it('Draft for different models:', () => true) + it('Draft for human models:', () => true) for (let size in ourModels) { it(` - Drafting for ${size} (${breasts ? 'with' : 'no'} breasts)`, () => { @@ -54,6 +54,39 @@ const testPatternDrafting = (design, Pattern, expect, models, patterns) => { ).to.equal(true) }) } + + // Do the same for fantistical models (dolls, giants) + it('Draft for non-human models:', () => 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) { + it(` - Drafting for ${size} (${breasts ? 'with' : 'no'} breasts)`, () => { + expect( + doesItDraft( + new Pattern({ + measurements: models[size] + }) + ) + ).to.equal(true) + }) + } } diff --git a/tests/patterns/sampling.js b/tests/patterns/sampling.js index e58d5286a39..b1b69540447 100644 --- a/tests/patterns/sampling.js +++ b/tests/patterns/sampling.js @@ -73,7 +73,7 @@ const testPatternSampling = (design, Pattern, expect, models, patterns) => { /* * Sample pattern for different models */ - it('Sample pattern for different models:' , () => { + it('Sample pattern for size range:' , () => { expect(doesItSample(new Pattern({ sample: { type: 'models', @@ -84,6 +84,40 @@ const testPatternSampling = (design, Pattern, expect, models, patterns) => { }) } + if (['rendertest', 'tutorial', 'examples'].indexOf(design) === -1) { + /* + * Sample pattern with fractional sizes (antperson tests) + */ + const fractionModel = fraction => { + const model = {} + for (const [measie, value] of Object.entries(ourModels.size40)) { + model[measie] = value * fraction + } + + return model + } + const models = { + oneTenth: fractionModel(0.1), + oneFifth: fractionModel(0.2), + oneHalf: fractionModel(0.5), + threeQuarters: fractionModel(0.5), + oneFifty: fractionModel(1.5), + twoFifty: fractionModel(2.5), + five: fractionModel(5), + ten: fractionModel(10), + } + + it('Sample pattern for fantastic measurements:' , () => { + expect(doesItSample(new Pattern({ + sample: { + type: 'models', + models, + }, + measurements + }))).to.equal(true) + }) + } + } module.exports = testPatternSampling