def test_rename_default_layer(self): # https://github.com/unified-font-object/ufoLib/issues/123 path = getTestFontCopyPath() font = Font() font.save(path) font.layers.defaultLayer.name = "somethingElse" font.save() self.assertEqual(Font(path).layers.defaultLayer.name, "somethingElse")
def test_save_as(self): path = getTestFontPath() font = Font(path) saveAsPath = getTestFontCopyPath(path) font.save(saveAsPath) fileNames = glob.glob(os.path.join(saveAsPath, 'glyphs', '*.glif')) fileNames = [os.path.basename(fileName) for fileName in fileNames] self.assertEqual(sorted(fileNames), ["A_.glif", "B_.glif", "C_.glif"]) self.assertEqual(font.path, saveAsPath) tearDownTestFontCopy(saveAsPath)
def test_save_as(self): path = getTestFontPath() font = Font(path) saveAsPath = getTestFontCopyPath(path) font.save(saveAsPath) imagesDirectory = os.path.join(saveAsPath, "images") self.assertTrue(os.path.exists(imagesDirectory)) imagePath = os.path.join(imagesDirectory, "image 1.png") self.assertTrue(os.path.exists(imagePath)) imagePath = os.path.join(imagesDirectory, "image 2.png") self.assertTrue(os.path.exists(imagePath)) tearDownTestFontCopy(saveAsPath)
def test_save_as(self): for ufo in (u"TestFont.ufo", u"TestFont.ufoz"): path = getTestFontPath(ufo) font = Font(path) origFileStructure = font.ufoFileStructure saveAsPath = getTestFontCopyPath(path) self.assertFalse(os.path.exists(saveAsPath)) font.save(saveAsPath) try: fileNames = sorted([ fs.path.basename(m.path) for m in UFOReader(saveAsPath).fs.glob("glyphs/*.glif") ]) self.assertEqual(fileNames, ["A_.glif", "B_.glif", "C_.glif"]) self.assertEqual(font.path, saveAsPath) self.assertEqual(origFileStructure, font.ufoFileStructure) finally: tearDownTestFontCopy(saveAsPath)
def test_save_as(self): path = getTestFontPath() font = Font(path) saveAsPath = getTestFontCopyPath(path) font.save(saveAsPath) dataDirectory = os.path.join(saveAsPath, "data") self.assertTrue(os.path.exists(dataDirectory)) self.assertTrue(os.path.exists(os.path.join( dataDirectory, os.path.join("com.typesupply.defcon.test.directory", "file 1.txt")))) self.assertTrue(os.path.exists(os.path.join( dataDirectory, os.path.join("com.typesupply.defcon.test.directory", "sub directory", "file 2.txt")))) self.assertTrue(os.path.exists(os.path.join( dataDirectory, "com.typesupply.defcon.test.file"))) tearDownTestFontCopy(saveAsPath)
def test_save_as(self): for ufo in (u"TestFont.ufo", u"TestFont.ufoz"): path = getTestFontPath(ufo) font = Font(path) origFileStructure = font.ufoFileStructure saveAsPath = getTestFontCopyPath(path) self.assertFalse(os.path.exists(saveAsPath)) font.save(saveAsPath) try: fileNames = sorted( [ fs.path.basename(m.path) for m in UFOReader(saveAsPath).fs.glob("glyphs/*.glif") ] ) self.assertEqual(fileNames, ["A_.glif", "B_.glif", "C_.glif"]) self.assertEqual(font.path, saveAsPath) self.assertEqual(origFileStructure, font.ufoFileStructure) finally: tearDownTestFontCopy(saveAsPath)
def test_save_as(self): path = getTestFontPath() font = Font(path) saveAsPath = getTestFontCopyPath(path) font.save(saveAsPath) dataDirectory = os.path.join(saveAsPath, "data") self.assertTrue(os.path.exists(dataDirectory)) self.assertTrue( os.path.exists( os.path.join( dataDirectory, os.path.join("com.typesupply.defcon.test.directory", "file 1.txt")))) self.assertTrue( os.path.exists( os.path.join( dataDirectory, os.path.join("com.typesupply.defcon.test.directory", "sub directory", "file 2.txt")))) self.assertTrue( os.path.exists( os.path.join(dataDirectory, "com.typesupply.defcon.test.file"))) tearDownTestFontCopy(saveAsPath)
def tearDown(self): if os.path.exists(getTestFontCopyPath()): tearDownTestFontCopy()
def tearDown(self): path = getTestFontCopyPath() if os.path.exists(path): shutil.rmtree(path)
def tearDown(self): path = getTestFontCopyPath() if os.path.exists(path): tearDownTestFontCopy()