Lines Matching refs:doc
53 doc = DesignSpaceDocument()
65 doc.addAxis(a1)
75 doc.addAxis(a2)
90 doc.addSource(s1)
102 doc.addSource(s2)
115 doc.addSource(s3)
130 doc.addInstance(i1)
149 doc.addInstance(i2)
151 doc.filename = "suggestedFileName.designspace"
152 doc.lib['com.coolDesignspaceApp.previewSize'] = 30
162 doc.addRule(r1)
164 doc.write(testDocPath)
173 assert new.lib == doc.lib
174 assert new.instances[0].lib == doc.instances[0].lib
178 for axis in doc.axes:
201 doc = DesignSpaceDocument()
208 doc.addSource(s1)
214 doc.addSource(s2)
222 doc.addInstance(i1)
224 doc.axes = [] # clear the axes
232 doc.addAxis(a1)
234 doc.write(testDocPath)
258 doc = DesignSpaceDocument()
265 doc.addSource(s1)
271 doc.addSource(s2)
291 doc.addInstance(i1)
293 doc.axes = [] # clear the axes
304 doc.addAxis(a1)
313 doc.addAxis(a2)
331 doc.addRule(r1)
333 doc.write(testDocPath)
357 doc = DesignSpaceDocument()
366 doc.addAxis(a)
378 doc.addSource(s1)
390 doc.addSource(s2)
402 doc.addInstance(i1)
404 doc.write(testDocPath)
431 doc = DesignSpaceDocument()
432 doc.addAxis(a1)
440 doc.addSource(s)
441 doc.write(testDocPath1)
448 doc = DesignSpaceDocument()
449 doc.addAxis(a1)
457 doc.addSource(s)
458 doc.write(testDocPath2)
465 doc = DesignSpaceDocument()
466 doc.addAxis(a1)
474 doc.addSource(s)
475 doc.write(testDocPath3)
484 doc = DesignSpaceDocument()
485 doc.addAxis(a1)
493 doc.addSource(s)
494 doc.write(testDocPath4)
500 doc = DesignSpaceDocument()
501 doc.addAxis(a1)
509 doc.addSource(s)
510 doc.write(testDocPath5) # so that the document has a path
511 doc.updateFilenameFromPath()
512 assert doc.sources[0].filename == "masters/masterTest1.ufo"
515 doc = DesignSpaceDocument()
516 doc.addAxis(a1)
524 doc.write(testDocPath5) # so that the document has a path
525 doc.addSource(s)
526 assert doc.sources[0].filename == "../somewhere/over/the/rainbow.ufo"
527 doc.updateFilenameFromPath(force=True)
528 assert doc.sources[0].filename == "masters/masterTest1.ufo"
533 doc = DesignSpaceDocument()
541 doc.addAxis(a1)
542 assert doc.normalizeLocation(dict(axisName_a=0)) == {'axisName_a': 0.0}
543 assert doc.normalizeLocation(dict(axisName_a=1000)) == {'axisName_a': 1.0}
545 assert doc.normalizeLocation(dict(axisName_a=1001)) == {'axisName_a': 1.0}
546 assert doc.normalizeLocation(dict(axisName_a=500)) == {'axisName_a': 0.5}
547 assert doc.normalizeLocation(dict(axisName_a=-1000)) == {'axisName_a': -1.0}
548 assert doc.normalizeLocation(dict(axisName_a=-1001)) == {'axisName_a': -1.0}
550 assert doc.normalizeLocation(dict(axisName_a=(1000, -1000))) == {'axisName_a': 1.0}
551 doc.normalize()
553 for axis in doc.axes:
560 doc = DesignSpaceDocument()
567 doc.addAxis(a2)
568 assert doc.normalizeLocation(dict(axisName_b=0)) == {'axisName_b': 0.0}
569 assert doc.normalizeLocation(dict(axisName_b=1000)) == {'axisName_b': 1.0}
571 assert doc.normalizeLocation(dict(axisName_b=1001)) == {'axisName_b': 1.0}
572 assert doc.normalizeLocation(dict(axisName_b=500)) == {'axisName_b': 0.4444444444444444}
573 assert doc.normalizeLocation(dict(axisName_b=-1000)) == {'axisName_b': 0.0}
574 assert doc.normalizeLocation(dict(axisName_b=-1001)) == {'axisName_b': 0.0}
576 assert doc.normalizeLocation(dict(axisName_b=(1000,-1000))) == {'axisName_b': 1.0}
577 assert doc.normalizeLocation(dict(axisName_b=1001)) == {'axisName_b': 1.0}
578 doc.normalize()
580 for axis in doc.axes:
587 doc = DesignSpaceDocument()
594 doc.addAxis(a3)
595 assert doc.normalizeLocation(dict(ccc=0)) == {'ccc': 0.0}
596 assert doc.normalizeLocation(dict(ccc=1)) == {'ccc': 0.0}
597 assert doc.normalizeLocation(dict(ccc=-1000)) == {'ccc': -1.0}
598 assert doc.normalizeLocation(dict(ccc=-1001)) == {'ccc': -1.0}
599 doc.normalize()
601 for axis in doc.axes:
608 doc = DesignSpaceDocument()
616 doc.addAxis(a4)
617 doc.normalize()
619 for axis in doc.axes:
627 doc = DesignSpaceDocument()
635 doc.addAxis(a4)
636 doc.normalize()
638 for axis in doc.axes:
702 doc = DesignSpaceDocument()
715 doc.addAxis(a1)
716 doc.addAxis(b1)
725 doc.addRule(r1)
726 assert len(doc.rules) == 1
727 assert len(doc.rules[0].conditionSets) == 1
728 assert len(doc.rules[0].conditionSets[0]) == 2
729 …assert _axesAsDict(doc.axes) == {'axisName_a': {'map': [], 'name': 'axisName_a', 'default': 0, 'mi…
730 assert doc.rules[0].conditionSets == [[
733 assert doc.rules[0].subs == [('a', 'a.alt')]
734 doc.normalize()
735 assert doc.rules[0].name == 'named.rule.1'
736 assert doc.rules[0].conditionSets == [[
740 assert len(doc.rules[0].conditionSets) == 1
741 doc.write(testDocPath)
772 doc = DesignSpaceDocument()
779 doc.addAxis(a1)
782 doc.lib = {dummyKey: dummyData}
783 doc.write(testDocPath1)
791 doc = DesignSpaceDocument()
792 doc.path = str(tmpdir / "foo" / "bar" / "MyDesignspace.designspace")
795 doc.addSource(s1)
797 doc.updatePaths()
809 doc.updatePaths()
817 doc.updatePaths()
826 doc.updatePaths()
838 doc = DesignSpaceDocument()
839 doc.read(source)
847 doc = DesignSpaceDocument()
848 doc.write(dest)