def test_decompile(self): axis = Axis() axis.decompile(FVAR_AXIS_DATA) self.assertEqual("opsz", axis.axisTag) self.assertEqual(345, axis.axisNameID) self.assertEqual(-0.5, axis.minValue) self.assertEqual(1.3, axis.defaultValue) self.assertEqual(1.5, axis.maxValue)
def test_decompile(self): axis = Axis() axis.decompile(FVAR_AXIS_DATA) self.assertEqual("opsz", axis.axisTag) self.assertEqual(345, axis.nameID) self.assertEqual(-0.5, axis.minValue) self.assertEqual(1.3, axis.defaultValue) self.assertEqual(1.5, axis.maxValue)
def test_toXML(self): font = MakeFont() axis = Axis() axis.decompile(FVAR_AXIS_DATA) AddName(font, "Optical Size").nameID = 256 axis.nameID = 256 writer = XMLWriter(StringIO()) axis.toXML(writer, font) self.assertEqual([ '', '<!-- Optical Size -->', '<Axis>', '<AxisTag>opsz</AxisTag>', '<MinValue>-0.5</MinValue>', '<DefaultValue>1.3</DefaultValue>', '<MaxValue>1.5</MaxValue>', '<NameID>256</NameID>', '</Axis>' ], xml_lines(writer))
def test_toXML(self): font = MakeFont() axis = Axis() axis.decompile(FVAR_AXIS_DATA) AddName(font, "Optical Size").nameID = 256 axis.nameID = 256 writer = XMLWriter(StringIO()) axis.toXML(writer, font) self.assertEqual( [ "", "<!-- Optical Size -->", "<Axis>", "<AxisTag>opsz</AxisTag>", "<MinValue>-0.5</MinValue>", "<DefaultValue>1.3</DefaultValue>", "<MaxValue>1.5</MaxValue>", "<Flags>10011000 01110110</Flags>", "<NameID>256</NameID>", "</Axis>", ], xml_lines(writer), )