def test_roundtrip(): if sys.platform != "darwin": pytest.skip("Needs to be run on OS X") font = Babelfont.open("tests/data/Test1.glyphs") Babelfont.save(font, "tests/data/Test1.roundtrip.glyphs") pl1_json = subprocess.run( ["plutil", "-convert", "xml1", "-o", "-", "tests/data/Test1.glyphs"], capture_output=True, ) pl2_json = subprocess.run( [ "plutil", "-convert", "xml1", "-o", "-", "tests/data/Test1.roundtrip.glyphs" ], capture_output=True, ) pl1 = plistlib.load(BytesIO(pl1_json.stdout)) pl2 = plistlib.load(BytesIO(pl2_json.stdout)) assert pl1 == pl2
def test_ufo_roundtrip(): font = Babelfont.open("tests/data/Test1.ufo") Babelfont.save(font, "tests/data/Test1.roundtrip.ufo") dc1 = defcon.Font("tests/data/Test1.ufo") dc2 = defcon.Font("tests/data/Test1.roundtrip.ufo") assert dc1.getDataForSerialization() == dc2.getDataForSerialization()
def _save(self, path=None, **kwargs): if not path: path = self._path if not path: raise ValueError Babelfont.save(self, path)
def test_ufo_to_glyphs(): font = Babelfont.open("tests/data/Test1.ufo") Babelfont.save(font, "tests/data/Test1-from-ufo.glyphs")
def test_glyphs_to_ufo(): font = Babelfont.open("tests/data/Test1.glyphs") Babelfont.save(font, "tests/data/Test1-from-glyphs.ufo")