fix (designs) add missing measurements to design configs
This commit is contained in:
parent
6a222f254d
commit
64bffa5ff9
7 changed files with 29 additions and 5 deletions
|
@ -5,6 +5,7 @@ import { dimensions } from './shared.mjs'
|
||||||
export const front = {
|
export const front = {
|
||||||
from: base,
|
from: base,
|
||||||
name: 'aaron.front',
|
name: 'aaron.front',
|
||||||
|
measurements: ['hips'],
|
||||||
options: {
|
options: {
|
||||||
brianFitCollar: false,
|
brianFitCollar: false,
|
||||||
brianFitSleeve: false,
|
brianFitSleeve: false,
|
||||||
|
|
|
@ -8,6 +8,7 @@ export const cup = {
|
||||||
inherited: true,
|
inherited: true,
|
||||||
},
|
},
|
||||||
after: neckTie,
|
after: neckTie,
|
||||||
|
measurements: ['bustPointToUnderbust'],
|
||||||
options: {
|
options: {
|
||||||
topDepth: { pct: 54, min: 50, max: 80, menu: 'fit' },
|
topDepth: { pct: 54, min: 50, max: 80, menu: 'fit' },
|
||||||
bottomCupDepth: { pct: 8, min: 0, max: 20, menu: 'fit' },
|
bottomCupDepth: { pct: 8, min: 0, max: 20, menu: 'fit' },
|
||||||
|
|
|
@ -483,7 +483,7 @@ export const front = {
|
||||||
name: 'carlton.front',
|
name: 'carlton.front',
|
||||||
from: bentFront,
|
from: bentFront,
|
||||||
hide: hidePresets.HIDE_TREE,
|
hide: hidePresets.HIDE_TREE,
|
||||||
measurements: ['waist', 'waistToFloor', 'waistToSeat'],
|
measurements: ['waist', 'waistToFloor', 'waistToSeat', 'seat'],
|
||||||
options: {
|
options: {
|
||||||
chestEase: { pct: 10, min: 5, max: 20, menu: 'fit' },
|
chestEase: { pct: 10, min: 5, max: 20, menu: 'fit' },
|
||||||
buttonSpacingHorizontal: { pct: 43.5, min: 15, max: 60, menu: 'style' },
|
buttonSpacingHorizontal: { pct: 43.5, min: 15, max: 60, menu: 'style' },
|
||||||
|
|
|
@ -415,7 +415,7 @@ function simoneFbaFront({
|
||||||
export const fbaFront = {
|
export const fbaFront = {
|
||||||
name: 'simone.fbaFront',
|
name: 'simone.fbaFront',
|
||||||
from: front,
|
from: front,
|
||||||
measurements: ['highBust'],
|
measurements: ['highBust', 'bustSpan', 'hpsToBust'],
|
||||||
hide: {
|
hide: {
|
||||||
self: true,
|
self: true,
|
||||||
from: true,
|
from: true,
|
||||||
|
|
|
@ -176,7 +176,7 @@ Part.prototype.shorthand = function () {
|
||||||
get: function (measurements, name) {
|
get: function (measurements, name) {
|
||||||
if (typeof measurements[name] === 'undefined')
|
if (typeof measurements[name] === 'undefined')
|
||||||
self.context.store.log.warning(
|
self.context.store.log.warning(
|
||||||
`Tried to access \`measurements.${name}\` but it is \`undefined\``
|
`${self.name} tried to access \`measurements.${name}\` but it is \`undefined\``
|
||||||
)
|
)
|
||||||
return Reflect.get(...arguments)
|
return Reflect.get(...arguments)
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import * as all from './dist/index.mjs'
|
import * as all from '../src/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
const { measurements, sizes } = all
|
const { measurements, sizes } = all
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { measurements } from '@freesewing/models'
|
import { measurements, cisFemaleAdult28 } from '@freesewing/models'
|
||||||
import designs from '../../config/software/designs.json' assert { type: 'json' }
|
import designs from '../../config/software/designs.json' assert { type: 'json' }
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
|
@ -89,6 +89,28 @@ export const testPatternConfig = (Pattern) => {
|
||||||
expect(measurements.indexOf(measurement)).to.not.equal(-1)
|
expect(measurements.indexOf(measurement)).to.not.equal(-1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
it('Requests all measurements it uses', () => {
|
||||||
|
const requested = {}
|
||||||
|
const patternMeasies = patternConfig.measurements.concat(patternConfig.optionalMeasurements)
|
||||||
|
for (let measurement of patternMeasies) {
|
||||||
|
requested[measurement] = cisFemaleAdult28[measurement]
|
||||||
|
}
|
||||||
|
|
||||||
|
const draft = new Pattern({
|
||||||
|
measurements: requested,
|
||||||
|
}).draft()
|
||||||
|
|
||||||
|
const missWarnings = draft.setStores[0].logs.warning.filter((w, i, a) => {
|
||||||
|
return w.match(/tried to access \`measurements/) && a.indexOf(w) === i
|
||||||
|
})
|
||||||
|
chai.assert(
|
||||||
|
missWarnings.length === 0,
|
||||||
|
`expected part to request all used measurements. \nThe following measurements were requested in the config: ${patternMeasies.join(
|
||||||
|
', '
|
||||||
|
)} \nbut got the following warnings: \n${missWarnings.join('\n')}
|
||||||
|
`
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test validity of the pattern's options
|
// Test validity of the pattern's options
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue