def test_buildLigatureAttach_noComponents(self): attach = builder.buildLigatureAttach([]) assert getXML(attach.toXML) == [ "<LigatureAttach>", " <!-- ComponentCount=0 -->", "</LigatureAttach>", ]
def test_buildLigatureAttach(self): anchor = builder.buildAnchor attach = builder.buildLigatureAttach([[anchor(500, -10), None], [None, anchor(300, -20), None]]) assert getXML(attach.toXML) == [ "<LigatureAttach>", " <!-- ComponentCount=2 -->", ' <ComponentRecord index="0">', ' <LigatureAnchor index="0" Format="1">', ' <XCoordinate value="500"/>', ' <YCoordinate value="-10"/>', " </LigatureAnchor>", ' <LigatureAnchor index="1" empty="1"/>', " </ComponentRecord>", ' <ComponentRecord index="1">', ' <LigatureAnchor index="0" empty="1"/>', ' <LigatureAnchor index="1" Format="1">', ' <XCoordinate value="300"/>', ' <YCoordinate value="-20"/>', " </LigatureAnchor>", ' <LigatureAnchor index="2" empty="1"/>', " </ComponentRecord>", "</LigatureAttach>", ]
def test_buildLigatureAttach_emptyComponents(self): attach = builder.buildLigatureAttach([[], None]) self.assertEqual(getXML(attach.toXML), '<LigatureAttach>' ' <!-- ComponentCount=2 -->' ' <ComponentRecord index="0" empty="1"/>' ' <ComponentRecord index="1" empty="1"/>' '</LigatureAttach>')
def test_buildLigatureAttach_emptyComponents(self): attach = builder.buildLigatureAttach([[], None]) assert getXML(attach.toXML) == [ "<LigatureAttach>", " <!-- ComponentCount=2 -->", ' <ComponentRecord index="0" empty="1"/>', ' <ComponentRecord index="1" empty="1"/>', "</LigatureAttach>", ]
def test_buildLigatureAttach(self): anchor = builder.buildAnchor attach = builder.buildLigatureAttach([ [anchor(500, -10), None], [None, anchor(300, -20), None]]) self.assertEqual(getXML(attach.toXML), '<LigatureAttach>' ' <!-- ComponentCount=2 -->' ' <ComponentRecord index="0">' ' <LigatureAnchor index="0" Format="1">' ' <XCoordinate value="500"/>' ' <YCoordinate value="-10"/>' ' </LigatureAnchor>' ' <LigatureAnchor index="1" empty="1"/>' ' </ComponentRecord>' ' <ComponentRecord index="1">' ' <LigatureAnchor index="0" empty="1"/>' ' <LigatureAnchor index="1" Format="1">' ' <XCoordinate value="300"/>' ' <YCoordinate value="-20"/>' ' </LigatureAnchor>' ' <LigatureAnchor index="2" empty="1"/>' ' </ComponentRecord>' '</LigatureAttach>')
def test_buildLigatureAttach_noComponents(self): attach = builder.buildLigatureAttach([]) self.assertEqual(getXML(attach.toXML), '<LigatureAttach>' ' <!-- ComponentCount=0 -->' '</LigatureAttach>')