ufoLib.test.test_glifLib: testRoundTrip() anchors don't come in the same order anymore
This commit is contained in:
parent
c643b67f08
commit
3df210b68f
@ -21,10 +21,11 @@ class GlyphSetTests(unittest.TestCase):
|
|||||||
shutil.rmtree(self.dstDir)
|
shutil.rmtree(self.dstDir)
|
||||||
|
|
||||||
def testRoundTrip(self):
|
def testRoundTrip(self):
|
||||||
|
import difflib
|
||||||
srcDir = GLYPHSETDIR
|
srcDir = GLYPHSETDIR
|
||||||
dstDir = self.dstDir
|
dstDir = self.dstDir
|
||||||
src = GlyphSet(srcDir)
|
src = GlyphSet(srcDir, ufoFormatVersion=2)
|
||||||
dst = GlyphSet(dstDir)
|
dst = GlyphSet(dstDir, ufoFormatVersion=2)
|
||||||
for glyphName in list(src.keys()):
|
for glyphName in list(src.keys()):
|
||||||
g = src[glyphName]
|
g = src[glyphName]
|
||||||
g.drawPoints(None) # load attrs
|
g.drawPoints(None) # load attrs
|
||||||
@ -36,7 +37,17 @@ class GlyphSetTests(unittest.TestCase):
|
|||||||
org = f.read()
|
org = f.read()
|
||||||
with open(os.path.join(dstDir, fileName), READ_MODE) as f:
|
with open(os.path.join(dstDir, fileName), READ_MODE) as f:
|
||||||
new = f.read()
|
new = f.read()
|
||||||
self.assertEqual(org, new, "%s.glif file differs after round tripping" % glyphName)
|
added = []
|
||||||
|
removed = []
|
||||||
|
for line in difflib.unified_diff(
|
||||||
|
org.split("\n"), new.split("\n")):
|
||||||
|
if line.startswith("+ "):
|
||||||
|
added.append(line[1:])
|
||||||
|
elif line.startswith("- "):
|
||||||
|
removed.append(line[1:])
|
||||||
|
self.assertEqual(
|
||||||
|
added, removed,
|
||||||
|
"%s.glif file differs after round tripping" % glyphName)
|
||||||
|
|
||||||
def testRebuildContents(self):
|
def testRebuildContents(self):
|
||||||
gset = GlyphSet(GLYPHSETDIR)
|
gset = GlyphSet(GLYPHSETDIR)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user