1*e1fe3e4aSElliott Hughesimport os 2*e1fe3e4aSElliott Hughesimport shutil 3*e1fe3e4aSElliott Hughesimport unittest 4*e1fe3e4aSElliott Hughesimport tempfile 5*e1fe3e4aSElliott Hughesfrom io import open 6*e1fe3e4aSElliott Hughesfrom fontTools.ufoLib import UFOReader, UFOWriter, UFOLibError 7*e1fe3e4aSElliott Hughesfrom fontTools.ufoLib import plistlib 8*e1fe3e4aSElliott Hughesfrom .testSupport import fontInfoVersion2 9*e1fe3e4aSElliott Hughes 10*e1fe3e4aSElliott Hughes 11*e1fe3e4aSElliott Hughesclass TestInfoObject: 12*e1fe3e4aSElliott Hughes pass 13*e1fe3e4aSElliott Hughes 14*e1fe3e4aSElliott Hughes 15*e1fe3e4aSElliott Hughesclass ReadFontInfoVersion2TestCase(unittest.TestCase): 16*e1fe3e4aSElliott Hughes def setUp(self): 17*e1fe3e4aSElliott Hughes self.dstDir = tempfile.mktemp() 18*e1fe3e4aSElliott Hughes os.mkdir(self.dstDir) 19*e1fe3e4aSElliott Hughes metaInfo = {"creator": "test", "formatVersion": 2} 20*e1fe3e4aSElliott Hughes path = os.path.join(self.dstDir, "metainfo.plist") 21*e1fe3e4aSElliott Hughes with open(path, "wb") as f: 22*e1fe3e4aSElliott Hughes plistlib.dump(metaInfo, f) 23*e1fe3e4aSElliott Hughes 24*e1fe3e4aSElliott Hughes def tearDown(self): 25*e1fe3e4aSElliott Hughes shutil.rmtree(self.dstDir) 26*e1fe3e4aSElliott Hughes 27*e1fe3e4aSElliott Hughes def _writeInfoToPlist(self, info): 28*e1fe3e4aSElliott Hughes path = os.path.join(self.dstDir, "fontinfo.plist") 29*e1fe3e4aSElliott Hughes with open(path, "wb") as f: 30*e1fe3e4aSElliott Hughes plistlib.dump(info, f) 31*e1fe3e4aSElliott Hughes 32*e1fe3e4aSElliott Hughes def testRead(self): 33*e1fe3e4aSElliott Hughes originalData = dict(fontInfoVersion2) 34*e1fe3e4aSElliott Hughes self._writeInfoToPlist(originalData) 35*e1fe3e4aSElliott Hughes infoObject = TestInfoObject() 36*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 37*e1fe3e4aSElliott Hughes reader.readInfo(infoObject) 38*e1fe3e4aSElliott Hughes readData = {} 39*e1fe3e4aSElliott Hughes for attr in list(fontInfoVersion2.keys()): 40*e1fe3e4aSElliott Hughes readData[attr] = getattr(infoObject, attr) 41*e1fe3e4aSElliott Hughes self.assertEqual(originalData, readData) 42*e1fe3e4aSElliott Hughes 43*e1fe3e4aSElliott Hughes def testGenericRead(self): 44*e1fe3e4aSElliott Hughes # familyName 45*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 46*e1fe3e4aSElliott Hughes info["familyName"] = 123 47*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 48*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 49*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 50*e1fe3e4aSElliott Hughes # styleName 51*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 52*e1fe3e4aSElliott Hughes info["styleName"] = 123 53*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 54*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 55*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 56*e1fe3e4aSElliott Hughes # styleMapFamilyName 57*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 58*e1fe3e4aSElliott Hughes info["styleMapFamilyName"] = 123 59*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 60*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 61*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 62*e1fe3e4aSElliott Hughes # styleMapStyleName 63*e1fe3e4aSElliott Hughes ## not a string 64*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 65*e1fe3e4aSElliott Hughes info["styleMapStyleName"] = 123 66*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 67*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 68*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 69*e1fe3e4aSElliott Hughes ## out of range 70*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 71*e1fe3e4aSElliott Hughes info["styleMapStyleName"] = "REGULAR" 72*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 73*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 74*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 75*e1fe3e4aSElliott Hughes # versionMajor 76*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 77*e1fe3e4aSElliott Hughes info["versionMajor"] = "1" 78*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 79*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 80*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 81*e1fe3e4aSElliott Hughes # versionMinor 82*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 83*e1fe3e4aSElliott Hughes info["versionMinor"] = "0" 84*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 85*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 86*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 87*e1fe3e4aSElliott Hughes # copyright 88*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 89*e1fe3e4aSElliott Hughes info["copyright"] = 123 90*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 91*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 92*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 93*e1fe3e4aSElliott Hughes # trademark 94*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 95*e1fe3e4aSElliott Hughes info["trademark"] = 123 96*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 97*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 98*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 99*e1fe3e4aSElliott Hughes # unitsPerEm 100*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 101*e1fe3e4aSElliott Hughes info["unitsPerEm"] = "abc" 102*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 103*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 104*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 105*e1fe3e4aSElliott Hughes # descender 106*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 107*e1fe3e4aSElliott Hughes info["descender"] = "abc" 108*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 109*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 110*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 111*e1fe3e4aSElliott Hughes # xHeight 112*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 113*e1fe3e4aSElliott Hughes info["xHeight"] = "abc" 114*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 115*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 116*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 117*e1fe3e4aSElliott Hughes # capHeight 118*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 119*e1fe3e4aSElliott Hughes info["capHeight"] = "abc" 120*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 121*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 122*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 123*e1fe3e4aSElliott Hughes # ascender 124*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 125*e1fe3e4aSElliott Hughes info["ascender"] = "abc" 126*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 127*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 128*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 129*e1fe3e4aSElliott Hughes # italicAngle 130*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 131*e1fe3e4aSElliott Hughes info["italicAngle"] = "abc" 132*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 133*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 134*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 135*e1fe3e4aSElliott Hughes 136*e1fe3e4aSElliott Hughes def testHeadRead(self): 137*e1fe3e4aSElliott Hughes # openTypeHeadCreated 138*e1fe3e4aSElliott Hughes ## not a string 139*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 140*e1fe3e4aSElliott Hughes info["openTypeHeadCreated"] = 123 141*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 142*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 143*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 144*e1fe3e4aSElliott Hughes ## invalid format 145*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 146*e1fe3e4aSElliott Hughes info["openTypeHeadCreated"] = "2000-Jan-01 00:00:00" 147*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 148*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 149*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 150*e1fe3e4aSElliott Hughes # openTypeHeadLowestRecPPEM 151*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 152*e1fe3e4aSElliott Hughes info["openTypeHeadLowestRecPPEM"] = "abc" 153*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 154*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 155*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 156*e1fe3e4aSElliott Hughes # openTypeHeadFlags 157*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 158*e1fe3e4aSElliott Hughes info["openTypeHeadFlags"] = [-1] 159*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 160*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 161*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 162*e1fe3e4aSElliott Hughes 163*e1fe3e4aSElliott Hughes def testHheaRead(self): 164*e1fe3e4aSElliott Hughes # openTypeHheaAscender 165*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 166*e1fe3e4aSElliott Hughes info["openTypeHheaAscender"] = "abc" 167*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 168*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 169*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 170*e1fe3e4aSElliott Hughes # openTypeHheaDescender 171*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 172*e1fe3e4aSElliott Hughes info["openTypeHheaDescender"] = "abc" 173*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 174*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 175*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 176*e1fe3e4aSElliott Hughes # openTypeHheaLineGap 177*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 178*e1fe3e4aSElliott Hughes info["openTypeHheaLineGap"] = "abc" 179*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 180*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 181*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 182*e1fe3e4aSElliott Hughes # openTypeHheaCaretSlopeRise 183*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 184*e1fe3e4aSElliott Hughes info["openTypeHheaCaretSlopeRise"] = "abc" 185*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 186*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 187*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 188*e1fe3e4aSElliott Hughes # openTypeHheaCaretSlopeRun 189*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 190*e1fe3e4aSElliott Hughes info["openTypeHheaCaretSlopeRun"] = "abc" 191*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 192*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 193*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 194*e1fe3e4aSElliott Hughes # openTypeHheaCaretOffset 195*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 196*e1fe3e4aSElliott Hughes info["openTypeHheaCaretOffset"] = "abc" 197*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 198*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 199*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 200*e1fe3e4aSElliott Hughes 201*e1fe3e4aSElliott Hughes def testNameRead(self): 202*e1fe3e4aSElliott Hughes # openTypeNameDesigner 203*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 204*e1fe3e4aSElliott Hughes info["openTypeNameDesigner"] = 123 205*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 206*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 207*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 208*e1fe3e4aSElliott Hughes # openTypeNameDesignerURL 209*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 210*e1fe3e4aSElliott Hughes info["openTypeNameDesignerURL"] = 123 211*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 212*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 213*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 214*e1fe3e4aSElliott Hughes # openTypeNameManufacturer 215*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 216*e1fe3e4aSElliott Hughes info["openTypeNameManufacturer"] = 123 217*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 218*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 219*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 220*e1fe3e4aSElliott Hughes # openTypeNameManufacturerURL 221*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 222*e1fe3e4aSElliott Hughes info["openTypeNameManufacturerURL"] = 123 223*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 224*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 225*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 226*e1fe3e4aSElliott Hughes # openTypeNameLicense 227*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 228*e1fe3e4aSElliott Hughes info["openTypeNameLicense"] = 123 229*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 230*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 231*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 232*e1fe3e4aSElliott Hughes # openTypeNameLicenseURL 233*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 234*e1fe3e4aSElliott Hughes info["openTypeNameLicenseURL"] = 123 235*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 236*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 237*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 238*e1fe3e4aSElliott Hughes # openTypeNameVersion 239*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 240*e1fe3e4aSElliott Hughes info["openTypeNameVersion"] = 123 241*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 242*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 243*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 244*e1fe3e4aSElliott Hughes # openTypeNameUniqueID 245*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 246*e1fe3e4aSElliott Hughes info["openTypeNameUniqueID"] = 123 247*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 248*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 249*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 250*e1fe3e4aSElliott Hughes # openTypeNameDescription 251*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 252*e1fe3e4aSElliott Hughes info["openTypeNameDescription"] = 123 253*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 254*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 255*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 256*e1fe3e4aSElliott Hughes # openTypeNamePreferredFamilyName 257*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 258*e1fe3e4aSElliott Hughes info["openTypeNamePreferredFamilyName"] = 123 259*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 260*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 261*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 262*e1fe3e4aSElliott Hughes # openTypeNamePreferredSubfamilyName 263*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 264*e1fe3e4aSElliott Hughes info["openTypeNamePreferredSubfamilyName"] = 123 265*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 266*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 267*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 268*e1fe3e4aSElliott Hughes # openTypeNameCompatibleFullName 269*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 270*e1fe3e4aSElliott Hughes info["openTypeNameCompatibleFullName"] = 123 271*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 272*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 273*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 274*e1fe3e4aSElliott Hughes # openTypeNameSampleText 275*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 276*e1fe3e4aSElliott Hughes info["openTypeNameSampleText"] = 123 277*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 278*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 279*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 280*e1fe3e4aSElliott Hughes # openTypeNameWWSFamilyName 281*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 282*e1fe3e4aSElliott Hughes info["openTypeNameWWSFamilyName"] = 123 283*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 284*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 285*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 286*e1fe3e4aSElliott Hughes # openTypeNameWWSSubfamilyName 287*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 288*e1fe3e4aSElliott Hughes info["openTypeNameWWSSubfamilyName"] = 123 289*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 290*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 291*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 292*e1fe3e4aSElliott Hughes 293*e1fe3e4aSElliott Hughes def testOS2Read(self): 294*e1fe3e4aSElliott Hughes # openTypeOS2WidthClass 295*e1fe3e4aSElliott Hughes ## not an int 296*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 297*e1fe3e4aSElliott Hughes info["openTypeOS2WidthClass"] = "abc" 298*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 299*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 300*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 301*e1fe3e4aSElliott Hughes ## out or range 302*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 303*e1fe3e4aSElliott Hughes info["openTypeOS2WidthClass"] = 15 304*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 305*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 306*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 307*e1fe3e4aSElliott Hughes # openTypeOS2WeightClass 308*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 309*e1fe3e4aSElliott Hughes ## not an int 310*e1fe3e4aSElliott Hughes info["openTypeOS2WeightClass"] = "abc" 311*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 312*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 313*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 314*e1fe3e4aSElliott Hughes ## out of range 315*e1fe3e4aSElliott Hughes info["openTypeOS2WeightClass"] = -50 316*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 317*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 318*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 319*e1fe3e4aSElliott Hughes # openTypeOS2Selection 320*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 321*e1fe3e4aSElliott Hughes info["openTypeOS2Selection"] = [-1] 322*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 323*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 324*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 325*e1fe3e4aSElliott Hughes # openTypeOS2VendorID 326*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 327*e1fe3e4aSElliott Hughes info["openTypeOS2VendorID"] = 1234 328*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 329*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 330*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 331*e1fe3e4aSElliott Hughes # openTypeOS2Panose 332*e1fe3e4aSElliott Hughes ## not an int 333*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 334*e1fe3e4aSElliott Hughes info["openTypeOS2Panose"] = [0, 1, 2, 3, 4, 5, 6, 7, 8, str(9)] 335*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 336*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 337*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 338*e1fe3e4aSElliott Hughes ## too few values 339*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 340*e1fe3e4aSElliott Hughes info["openTypeOS2Panose"] = [0, 1, 2, 3] 341*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 342*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 343*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 344*e1fe3e4aSElliott Hughes ## too many values 345*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 346*e1fe3e4aSElliott Hughes info["openTypeOS2Panose"] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 347*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 348*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 349*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 350*e1fe3e4aSElliott Hughes # openTypeOS2FamilyClass 351*e1fe3e4aSElliott Hughes ## not an int 352*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 353*e1fe3e4aSElliott Hughes info["openTypeOS2FamilyClass"] = [1, str(1)] 354*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 355*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 356*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 357*e1fe3e4aSElliott Hughes ## too few values 358*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 359*e1fe3e4aSElliott Hughes info["openTypeOS2FamilyClass"] = [1] 360*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 361*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 362*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 363*e1fe3e4aSElliott Hughes ## too many values 364*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 365*e1fe3e4aSElliott Hughes info["openTypeOS2FamilyClass"] = [1, 1, 1] 366*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 367*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 368*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 369*e1fe3e4aSElliott Hughes ## out of range 370*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 371*e1fe3e4aSElliott Hughes info["openTypeOS2FamilyClass"] = [1, 201] 372*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 373*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 374*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 375*e1fe3e4aSElliott Hughes # openTypeOS2UnicodeRanges 376*e1fe3e4aSElliott Hughes ## not an int 377*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 378*e1fe3e4aSElliott Hughes info["openTypeOS2UnicodeRanges"] = ["0"] 379*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 380*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 381*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 382*e1fe3e4aSElliott Hughes ## out of range 383*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 384*e1fe3e4aSElliott Hughes info["openTypeOS2UnicodeRanges"] = [-1] 385*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 386*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 387*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 388*e1fe3e4aSElliott Hughes # openTypeOS2CodePageRanges 389*e1fe3e4aSElliott Hughes ## not an int 390*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 391*e1fe3e4aSElliott Hughes info["openTypeOS2CodePageRanges"] = ["0"] 392*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 393*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 394*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 395*e1fe3e4aSElliott Hughes ## out of range 396*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 397*e1fe3e4aSElliott Hughes info["openTypeOS2CodePageRanges"] = [-1] 398*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 399*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 400*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 401*e1fe3e4aSElliott Hughes # openTypeOS2TypoAscender 402*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 403*e1fe3e4aSElliott Hughes info["openTypeOS2TypoAscender"] = "abc" 404*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 405*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 406*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 407*e1fe3e4aSElliott Hughes # openTypeOS2TypoDescender 408*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 409*e1fe3e4aSElliott Hughes info["openTypeOS2TypoDescender"] = "abc" 410*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 411*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 412*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 413*e1fe3e4aSElliott Hughes # openTypeOS2TypoLineGap 414*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 415*e1fe3e4aSElliott Hughes info["openTypeOS2TypoLineGap"] = "abc" 416*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 417*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 418*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 419*e1fe3e4aSElliott Hughes # openTypeOS2WinAscent 420*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 421*e1fe3e4aSElliott Hughes info["openTypeOS2WinAscent"] = "abc" 422*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 423*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 424*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 425*e1fe3e4aSElliott Hughes # openTypeOS2WinDescent 426*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 427*e1fe3e4aSElliott Hughes info["openTypeOS2WinDescent"] = "abc" 428*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 429*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 430*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 431*e1fe3e4aSElliott Hughes # openTypeOS2Type 432*e1fe3e4aSElliott Hughes ## not an int 433*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 434*e1fe3e4aSElliott Hughes info["openTypeOS2Type"] = ["1"] 435*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 436*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 437*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 438*e1fe3e4aSElliott Hughes ## out of range 439*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 440*e1fe3e4aSElliott Hughes info["openTypeOS2Type"] = [-1] 441*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 442*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 443*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 444*e1fe3e4aSElliott Hughes # openTypeOS2SubscriptXSize 445*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 446*e1fe3e4aSElliott Hughes info["openTypeOS2SubscriptXSize"] = "abc" 447*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 448*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 449*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 450*e1fe3e4aSElliott Hughes # openTypeOS2SubscriptYSize 451*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 452*e1fe3e4aSElliott Hughes info["openTypeOS2SubscriptYSize"] = "abc" 453*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 454*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 455*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 456*e1fe3e4aSElliott Hughes # openTypeOS2SubscriptXOffset 457*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 458*e1fe3e4aSElliott Hughes info["openTypeOS2SubscriptXOffset"] = "abc" 459*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 460*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 461*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 462*e1fe3e4aSElliott Hughes # openTypeOS2SubscriptYOffset 463*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 464*e1fe3e4aSElliott Hughes info["openTypeOS2SubscriptYOffset"] = "abc" 465*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 466*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 467*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 468*e1fe3e4aSElliott Hughes # openTypeOS2SuperscriptXSize 469*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 470*e1fe3e4aSElliott Hughes info["openTypeOS2SuperscriptXSize"] = "abc" 471*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 472*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 473*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 474*e1fe3e4aSElliott Hughes # openTypeOS2SuperscriptYSize 475*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 476*e1fe3e4aSElliott Hughes info["openTypeOS2SuperscriptYSize"] = "abc" 477*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 478*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 479*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 480*e1fe3e4aSElliott Hughes # openTypeOS2SuperscriptXOffset 481*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 482*e1fe3e4aSElliott Hughes info["openTypeOS2SuperscriptXOffset"] = "abc" 483*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 484*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 485*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 486*e1fe3e4aSElliott Hughes # openTypeOS2SuperscriptYOffset 487*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 488*e1fe3e4aSElliott Hughes info["openTypeOS2SuperscriptYOffset"] = "abc" 489*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 490*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 491*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 492*e1fe3e4aSElliott Hughes # openTypeOS2StrikeoutSize 493*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 494*e1fe3e4aSElliott Hughes info["openTypeOS2StrikeoutSize"] = "abc" 495*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 496*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 497*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 498*e1fe3e4aSElliott Hughes # openTypeOS2StrikeoutPosition 499*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 500*e1fe3e4aSElliott Hughes info["openTypeOS2StrikeoutPosition"] = "abc" 501*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 502*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 503*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 504*e1fe3e4aSElliott Hughes 505*e1fe3e4aSElliott Hughes def testVheaRead(self): 506*e1fe3e4aSElliott Hughes # openTypeVheaVertTypoAscender 507*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 508*e1fe3e4aSElliott Hughes info["openTypeVheaVertTypoAscender"] = "abc" 509*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 510*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 511*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 512*e1fe3e4aSElliott Hughes # openTypeVheaVertTypoDescender 513*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 514*e1fe3e4aSElliott Hughes info["openTypeVheaVertTypoDescender"] = "abc" 515*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 516*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 517*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 518*e1fe3e4aSElliott Hughes # openTypeVheaVertTypoLineGap 519*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 520*e1fe3e4aSElliott Hughes info["openTypeVheaVertTypoLineGap"] = "abc" 521*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 522*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 523*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 524*e1fe3e4aSElliott Hughes # openTypeVheaCaretSlopeRise 525*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 526*e1fe3e4aSElliott Hughes info["openTypeVheaCaretSlopeRise"] = "abc" 527*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 528*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 529*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 530*e1fe3e4aSElliott Hughes # openTypeVheaCaretSlopeRun 531*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 532*e1fe3e4aSElliott Hughes info["openTypeVheaCaretSlopeRun"] = "abc" 533*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 534*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 535*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 536*e1fe3e4aSElliott Hughes # openTypeVheaCaretOffset 537*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 538*e1fe3e4aSElliott Hughes info["openTypeVheaCaretOffset"] = "abc" 539*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 540*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 541*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 542*e1fe3e4aSElliott Hughes 543*e1fe3e4aSElliott Hughes def testFONDRead(self): 544*e1fe3e4aSElliott Hughes # macintoshFONDFamilyID 545*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 546*e1fe3e4aSElliott Hughes info["macintoshFONDFamilyID"] = "abc" 547*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 548*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 549*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 550*e1fe3e4aSElliott Hughes # macintoshFONDName 551*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 552*e1fe3e4aSElliott Hughes info["macintoshFONDName"] = 123 553*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 554*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 555*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 556*e1fe3e4aSElliott Hughes 557*e1fe3e4aSElliott Hughes def testPostscriptRead(self): 558*e1fe3e4aSElliott Hughes # postscriptFontName 559*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 560*e1fe3e4aSElliott Hughes info["postscriptFontName"] = 123 561*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 562*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 563*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 564*e1fe3e4aSElliott Hughes # postscriptFullName 565*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 566*e1fe3e4aSElliott Hughes info["postscriptFullName"] = 123 567*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 568*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 569*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 570*e1fe3e4aSElliott Hughes # postscriptSlantAngle 571*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 572*e1fe3e4aSElliott Hughes info["postscriptSlantAngle"] = "abc" 573*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 574*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 575*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject()) 576*e1fe3e4aSElliott Hughes # postscriptUniqueID 577*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 578*e1fe3e4aSElliott Hughes info["postscriptUniqueID"] = "abc" 579*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 580*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 581*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 582*e1fe3e4aSElliott Hughes # postscriptUnderlineThickness 583*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 584*e1fe3e4aSElliott Hughes info["postscriptUnderlineThickness"] = "abc" 585*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 586*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 587*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 588*e1fe3e4aSElliott Hughes # postscriptUnderlinePosition 589*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 590*e1fe3e4aSElliott Hughes info["postscriptUnderlinePosition"] = "abc" 591*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 592*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 593*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 594*e1fe3e4aSElliott Hughes # postscriptIsFixedPitch 595*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 596*e1fe3e4aSElliott Hughes info["postscriptIsFixedPitch"] = 2 597*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 598*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 599*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 600*e1fe3e4aSElliott Hughes # postscriptBlueValues 601*e1fe3e4aSElliott Hughes ## not a list 602*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 603*e1fe3e4aSElliott Hughes info["postscriptBlueValues"] = "abc" 604*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 605*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 606*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 607*e1fe3e4aSElliott Hughes ## uneven value count 608*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 609*e1fe3e4aSElliott Hughes info["postscriptBlueValues"] = [500] 610*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 611*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 612*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 613*e1fe3e4aSElliott Hughes ## too many values 614*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 615*e1fe3e4aSElliott Hughes info["postscriptBlueValues"] = [ 616*e1fe3e4aSElliott Hughes 10, 617*e1fe3e4aSElliott Hughes 20, 618*e1fe3e4aSElliott Hughes 30, 619*e1fe3e4aSElliott Hughes 40, 620*e1fe3e4aSElliott Hughes 50, 621*e1fe3e4aSElliott Hughes 60, 622*e1fe3e4aSElliott Hughes 70, 623*e1fe3e4aSElliott Hughes 80, 624*e1fe3e4aSElliott Hughes 90, 625*e1fe3e4aSElliott Hughes 100, 626*e1fe3e4aSElliott Hughes 110, 627*e1fe3e4aSElliott Hughes 120, 628*e1fe3e4aSElliott Hughes 130, 629*e1fe3e4aSElliott Hughes 140, 630*e1fe3e4aSElliott Hughes 150, 631*e1fe3e4aSElliott Hughes 160, 632*e1fe3e4aSElliott Hughes ] 633*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 634*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 635*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 636*e1fe3e4aSElliott Hughes # postscriptOtherBlues 637*e1fe3e4aSElliott Hughes ## not a list 638*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 639*e1fe3e4aSElliott Hughes info["postscriptOtherBlues"] = "abc" 640*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 641*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 642*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 643*e1fe3e4aSElliott Hughes ## uneven value count 644*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 645*e1fe3e4aSElliott Hughes info["postscriptOtherBlues"] = [500] 646*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 647*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 648*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 649*e1fe3e4aSElliott Hughes ## too many values 650*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 651*e1fe3e4aSElliott Hughes info["postscriptOtherBlues"] = [ 652*e1fe3e4aSElliott Hughes 10, 653*e1fe3e4aSElliott Hughes 20, 654*e1fe3e4aSElliott Hughes 30, 655*e1fe3e4aSElliott Hughes 40, 656*e1fe3e4aSElliott Hughes 50, 657*e1fe3e4aSElliott Hughes 60, 658*e1fe3e4aSElliott Hughes 70, 659*e1fe3e4aSElliott Hughes 80, 660*e1fe3e4aSElliott Hughes 90, 661*e1fe3e4aSElliott Hughes 100, 662*e1fe3e4aSElliott Hughes 110, 663*e1fe3e4aSElliott Hughes 120, 664*e1fe3e4aSElliott Hughes 130, 665*e1fe3e4aSElliott Hughes 140, 666*e1fe3e4aSElliott Hughes 150, 667*e1fe3e4aSElliott Hughes 160, 668*e1fe3e4aSElliott Hughes ] 669*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 670*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 671*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 672*e1fe3e4aSElliott Hughes # postscriptFamilyBlues 673*e1fe3e4aSElliott Hughes ## not a list 674*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 675*e1fe3e4aSElliott Hughes info["postscriptFamilyBlues"] = "abc" 676*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 677*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 678*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 679*e1fe3e4aSElliott Hughes ## uneven value count 680*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 681*e1fe3e4aSElliott Hughes info["postscriptFamilyBlues"] = [500] 682*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 683*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 684*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 685*e1fe3e4aSElliott Hughes ## too many values 686*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 687*e1fe3e4aSElliott Hughes info["postscriptFamilyBlues"] = [ 688*e1fe3e4aSElliott Hughes 10, 689*e1fe3e4aSElliott Hughes 20, 690*e1fe3e4aSElliott Hughes 30, 691*e1fe3e4aSElliott Hughes 40, 692*e1fe3e4aSElliott Hughes 50, 693*e1fe3e4aSElliott Hughes 60, 694*e1fe3e4aSElliott Hughes 70, 695*e1fe3e4aSElliott Hughes 80, 696*e1fe3e4aSElliott Hughes 90, 697*e1fe3e4aSElliott Hughes 100, 698*e1fe3e4aSElliott Hughes 110, 699*e1fe3e4aSElliott Hughes 120, 700*e1fe3e4aSElliott Hughes 130, 701*e1fe3e4aSElliott Hughes 140, 702*e1fe3e4aSElliott Hughes 150, 703*e1fe3e4aSElliott Hughes 160, 704*e1fe3e4aSElliott Hughes ] 705*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 706*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 707*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 708*e1fe3e4aSElliott Hughes # postscriptFamilyOtherBlues 709*e1fe3e4aSElliott Hughes ## not a list 710*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 711*e1fe3e4aSElliott Hughes info["postscriptFamilyOtherBlues"] = "abc" 712*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 713*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 714*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 715*e1fe3e4aSElliott Hughes ## uneven value count 716*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 717*e1fe3e4aSElliott Hughes info["postscriptFamilyOtherBlues"] = [500] 718*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 719*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 720*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 721*e1fe3e4aSElliott Hughes ## too many values 722*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 723*e1fe3e4aSElliott Hughes info["postscriptFamilyOtherBlues"] = [ 724*e1fe3e4aSElliott Hughes 10, 725*e1fe3e4aSElliott Hughes 20, 726*e1fe3e4aSElliott Hughes 30, 727*e1fe3e4aSElliott Hughes 40, 728*e1fe3e4aSElliott Hughes 50, 729*e1fe3e4aSElliott Hughes 60, 730*e1fe3e4aSElliott Hughes 70, 731*e1fe3e4aSElliott Hughes 80, 732*e1fe3e4aSElliott Hughes 90, 733*e1fe3e4aSElliott Hughes 100, 734*e1fe3e4aSElliott Hughes 110, 735*e1fe3e4aSElliott Hughes 120, 736*e1fe3e4aSElliott Hughes 130, 737*e1fe3e4aSElliott Hughes 140, 738*e1fe3e4aSElliott Hughes 150, 739*e1fe3e4aSElliott Hughes 160, 740*e1fe3e4aSElliott Hughes ] 741*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 742*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 743*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 744*e1fe3e4aSElliott Hughes # postscriptStemSnapH 745*e1fe3e4aSElliott Hughes ## not list 746*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 747*e1fe3e4aSElliott Hughes info["postscriptStemSnapH"] = "abc" 748*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 749*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 750*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 751*e1fe3e4aSElliott Hughes ## too many values 752*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 753*e1fe3e4aSElliott Hughes info["postscriptStemSnapH"] = [ 754*e1fe3e4aSElliott Hughes 10, 755*e1fe3e4aSElliott Hughes 20, 756*e1fe3e4aSElliott Hughes 30, 757*e1fe3e4aSElliott Hughes 40, 758*e1fe3e4aSElliott Hughes 50, 759*e1fe3e4aSElliott Hughes 60, 760*e1fe3e4aSElliott Hughes 70, 761*e1fe3e4aSElliott Hughes 80, 762*e1fe3e4aSElliott Hughes 90, 763*e1fe3e4aSElliott Hughes 100, 764*e1fe3e4aSElliott Hughes 110, 765*e1fe3e4aSElliott Hughes 120, 766*e1fe3e4aSElliott Hughes 130, 767*e1fe3e4aSElliott Hughes 140, 768*e1fe3e4aSElliott Hughes 150, 769*e1fe3e4aSElliott Hughes 160, 770*e1fe3e4aSElliott Hughes ] 771*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 772*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 773*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 774*e1fe3e4aSElliott Hughes # postscriptStemSnapV 775*e1fe3e4aSElliott Hughes ## not list 776*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 777*e1fe3e4aSElliott Hughes info["postscriptStemSnapV"] = "abc" 778*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 779*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 780*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 781*e1fe3e4aSElliott Hughes ## too many values 782*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 783*e1fe3e4aSElliott Hughes info["postscriptStemSnapV"] = [ 784*e1fe3e4aSElliott Hughes 10, 785*e1fe3e4aSElliott Hughes 20, 786*e1fe3e4aSElliott Hughes 30, 787*e1fe3e4aSElliott Hughes 40, 788*e1fe3e4aSElliott Hughes 50, 789*e1fe3e4aSElliott Hughes 60, 790*e1fe3e4aSElliott Hughes 70, 791*e1fe3e4aSElliott Hughes 80, 792*e1fe3e4aSElliott Hughes 90, 793*e1fe3e4aSElliott Hughes 100, 794*e1fe3e4aSElliott Hughes 110, 795*e1fe3e4aSElliott Hughes 120, 796*e1fe3e4aSElliott Hughes 130, 797*e1fe3e4aSElliott Hughes 140, 798*e1fe3e4aSElliott Hughes 150, 799*e1fe3e4aSElliott Hughes 160, 800*e1fe3e4aSElliott Hughes ] 801*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 802*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 803*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 804*e1fe3e4aSElliott Hughes # postscriptBlueFuzz 805*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 806*e1fe3e4aSElliott Hughes info["postscriptBlueFuzz"] = "abc" 807*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 808*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 809*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 810*e1fe3e4aSElliott Hughes # postscriptBlueShift 811*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 812*e1fe3e4aSElliott Hughes info["postscriptBlueShift"] = "abc" 813*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 814*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 815*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 816*e1fe3e4aSElliott Hughes # postscriptBlueScale 817*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 818*e1fe3e4aSElliott Hughes info["postscriptBlueScale"] = "abc" 819*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 820*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 821*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 822*e1fe3e4aSElliott Hughes # postscriptForceBold 823*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 824*e1fe3e4aSElliott Hughes info["postscriptForceBold"] = "abc" 825*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 826*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 827*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 828*e1fe3e4aSElliott Hughes # postscriptDefaultWidthX 829*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 830*e1fe3e4aSElliott Hughes info["postscriptDefaultWidthX"] = "abc" 831*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 832*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 833*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 834*e1fe3e4aSElliott Hughes # postscriptNominalWidthX 835*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 836*e1fe3e4aSElliott Hughes info["postscriptNominalWidthX"] = "abc" 837*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 838*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 839*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 840*e1fe3e4aSElliott Hughes # postscriptWeightName 841*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 842*e1fe3e4aSElliott Hughes info["postscriptWeightName"] = 123 843*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 844*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 845*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 846*e1fe3e4aSElliott Hughes # postscriptDefaultCharacter 847*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 848*e1fe3e4aSElliott Hughes info["postscriptDefaultCharacter"] = 123 849*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 850*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 851*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 852*e1fe3e4aSElliott Hughes # postscriptWindowsCharacterSet 853*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 854*e1fe3e4aSElliott Hughes info["postscriptWindowsCharacterSet"] = -1 855*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 856*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 857*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 858*e1fe3e4aSElliott Hughes # macintoshFONDFamilyID 859*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 860*e1fe3e4aSElliott Hughes info["macintoshFONDFamilyID"] = "abc" 861*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 862*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 863*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 864*e1fe3e4aSElliott Hughes # macintoshFONDName 865*e1fe3e4aSElliott Hughes info = dict(fontInfoVersion2) 866*e1fe3e4aSElliott Hughes info["macintoshFONDName"] = 123 867*e1fe3e4aSElliott Hughes self._writeInfoToPlist(info) 868*e1fe3e4aSElliott Hughes reader = UFOReader(self.dstDir, validate=True) 869*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject()) 870*e1fe3e4aSElliott Hughes 871*e1fe3e4aSElliott Hughes 872*e1fe3e4aSElliott Hughesclass WriteFontInfoVersion2TestCase(unittest.TestCase): 873*e1fe3e4aSElliott Hughes def setUp(self): 874*e1fe3e4aSElliott Hughes self.tempDir = tempfile.mktemp() 875*e1fe3e4aSElliott Hughes os.mkdir(self.tempDir) 876*e1fe3e4aSElliott Hughes self.dstDir = os.path.join(self.tempDir, "test.ufo") 877*e1fe3e4aSElliott Hughes 878*e1fe3e4aSElliott Hughes def tearDown(self): 879*e1fe3e4aSElliott Hughes shutil.rmtree(self.tempDir) 880*e1fe3e4aSElliott Hughes 881*e1fe3e4aSElliott Hughes def makeInfoObject(self): 882*e1fe3e4aSElliott Hughes infoObject = TestInfoObject() 883*e1fe3e4aSElliott Hughes for attr, value in list(fontInfoVersion2.items()): 884*e1fe3e4aSElliott Hughes setattr(infoObject, attr, value) 885*e1fe3e4aSElliott Hughes return infoObject 886*e1fe3e4aSElliott Hughes 887*e1fe3e4aSElliott Hughes def readPlist(self): 888*e1fe3e4aSElliott Hughes path = os.path.join(self.dstDir, "fontinfo.plist") 889*e1fe3e4aSElliott Hughes with open(path, "rb") as f: 890*e1fe3e4aSElliott Hughes plist = plistlib.load(f) 891*e1fe3e4aSElliott Hughes return plist 892*e1fe3e4aSElliott Hughes 893*e1fe3e4aSElliott Hughes def testWrite(self): 894*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 895*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 896*e1fe3e4aSElliott Hughes writer.writeInfo(infoObject) 897*e1fe3e4aSElliott Hughes writtenData = self.readPlist() 898*e1fe3e4aSElliott Hughes for attr, originalValue in list(fontInfoVersion2.items()): 899*e1fe3e4aSElliott Hughes newValue = writtenData[attr] 900*e1fe3e4aSElliott Hughes self.assertEqual(newValue, originalValue) 901*e1fe3e4aSElliott Hughes 902*e1fe3e4aSElliott Hughes def testGenericWrite(self): 903*e1fe3e4aSElliott Hughes # familyName 904*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 905*e1fe3e4aSElliott Hughes infoObject.familyName = 123 906*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 907*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 908*e1fe3e4aSElliott Hughes # styleName 909*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 910*e1fe3e4aSElliott Hughes infoObject.styleName = 123 911*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 912*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 913*e1fe3e4aSElliott Hughes # styleMapFamilyName 914*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 915*e1fe3e4aSElliott Hughes infoObject.styleMapFamilyName = 123 916*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 917*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 918*e1fe3e4aSElliott Hughes # styleMapStyleName 919*e1fe3e4aSElliott Hughes ## not a string 920*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 921*e1fe3e4aSElliott Hughes infoObject.styleMapStyleName = 123 922*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 923*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 924*e1fe3e4aSElliott Hughes ## out of range 925*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 926*e1fe3e4aSElliott Hughes infoObject.styleMapStyleName = "REGULAR" 927*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 928*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 929*e1fe3e4aSElliott Hughes # versionMajor 930*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 931*e1fe3e4aSElliott Hughes infoObject.versionMajor = "1" 932*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 933*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 934*e1fe3e4aSElliott Hughes # versionMinor 935*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 936*e1fe3e4aSElliott Hughes infoObject.versionMinor = "0" 937*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 938*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 939*e1fe3e4aSElliott Hughes # copyright 940*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 941*e1fe3e4aSElliott Hughes infoObject.copyright = 123 942*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 943*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 944*e1fe3e4aSElliott Hughes # trademark 945*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 946*e1fe3e4aSElliott Hughes infoObject.trademark = 123 947*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 948*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 949*e1fe3e4aSElliott Hughes # unitsPerEm 950*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 951*e1fe3e4aSElliott Hughes infoObject.unitsPerEm = "abc" 952*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 953*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 954*e1fe3e4aSElliott Hughes # descender 955*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 956*e1fe3e4aSElliott Hughes infoObject.descender = "abc" 957*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 958*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 959*e1fe3e4aSElliott Hughes # xHeight 960*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 961*e1fe3e4aSElliott Hughes infoObject.xHeight = "abc" 962*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 963*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 964*e1fe3e4aSElliott Hughes # capHeight 965*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 966*e1fe3e4aSElliott Hughes infoObject.capHeight = "abc" 967*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 968*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 969*e1fe3e4aSElliott Hughes # ascender 970*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 971*e1fe3e4aSElliott Hughes infoObject.ascender = "abc" 972*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 973*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 974*e1fe3e4aSElliott Hughes # italicAngle 975*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 976*e1fe3e4aSElliott Hughes infoObject.italicAngle = "abc" 977*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 978*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 979*e1fe3e4aSElliott Hughes 980*e1fe3e4aSElliott Hughes def testHeadWrite(self): 981*e1fe3e4aSElliott Hughes # openTypeHeadCreated 982*e1fe3e4aSElliott Hughes ## not a string 983*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 984*e1fe3e4aSElliott Hughes infoObject.openTypeHeadCreated = 123 985*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 986*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 987*e1fe3e4aSElliott Hughes ## invalid format 988*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 989*e1fe3e4aSElliott Hughes infoObject.openTypeHeadCreated = "2000-Jan-01 00:00:00" 990*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 991*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 992*e1fe3e4aSElliott Hughes # openTypeHeadLowestRecPPEM 993*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 994*e1fe3e4aSElliott Hughes infoObject.openTypeHeadLowestRecPPEM = "abc" 995*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 996*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 997*e1fe3e4aSElliott Hughes # openTypeHeadFlags 998*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 999*e1fe3e4aSElliott Hughes infoObject.openTypeHeadFlags = [-1] 1000*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1001*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1002*e1fe3e4aSElliott Hughes 1003*e1fe3e4aSElliott Hughes def testHheaWrite(self): 1004*e1fe3e4aSElliott Hughes # openTypeHheaAscender 1005*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1006*e1fe3e4aSElliott Hughes infoObject.openTypeHheaAscender = "abc" 1007*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1008*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1009*e1fe3e4aSElliott Hughes # openTypeHheaDescender 1010*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1011*e1fe3e4aSElliott Hughes infoObject.openTypeHheaDescender = "abc" 1012*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1013*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1014*e1fe3e4aSElliott Hughes # openTypeHheaLineGap 1015*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1016*e1fe3e4aSElliott Hughes infoObject.openTypeHheaLineGap = "abc" 1017*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1018*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1019*e1fe3e4aSElliott Hughes # openTypeHheaCaretSlopeRise 1020*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1021*e1fe3e4aSElliott Hughes infoObject.openTypeHheaCaretSlopeRise = "abc" 1022*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1023*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1024*e1fe3e4aSElliott Hughes # openTypeHheaCaretSlopeRun 1025*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1026*e1fe3e4aSElliott Hughes infoObject.openTypeHheaCaretSlopeRun = "abc" 1027*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1028*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1029*e1fe3e4aSElliott Hughes # openTypeHheaCaretOffset 1030*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1031*e1fe3e4aSElliott Hughes infoObject.openTypeHheaCaretOffset = "abc" 1032*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1033*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1034*e1fe3e4aSElliott Hughes 1035*e1fe3e4aSElliott Hughes def testNameWrite(self): 1036*e1fe3e4aSElliott Hughes # openTypeNameDesigner 1037*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1038*e1fe3e4aSElliott Hughes infoObject.openTypeNameDesigner = 123 1039*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1040*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1041*e1fe3e4aSElliott Hughes # openTypeNameDesignerURL 1042*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1043*e1fe3e4aSElliott Hughes infoObject.openTypeNameDesignerURL = 123 1044*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1045*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1046*e1fe3e4aSElliott Hughes # openTypeNameManufacturer 1047*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1048*e1fe3e4aSElliott Hughes infoObject.openTypeNameManufacturer = 123 1049*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1050*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1051*e1fe3e4aSElliott Hughes # openTypeNameManufacturerURL 1052*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1053*e1fe3e4aSElliott Hughes infoObject.openTypeNameManufacturerURL = 123 1054*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1055*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1056*e1fe3e4aSElliott Hughes # openTypeNameLicense 1057*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1058*e1fe3e4aSElliott Hughes infoObject.openTypeNameLicense = 123 1059*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1060*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1061*e1fe3e4aSElliott Hughes # openTypeNameLicenseURL 1062*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1063*e1fe3e4aSElliott Hughes infoObject.openTypeNameLicenseURL = 123 1064*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1065*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1066*e1fe3e4aSElliott Hughes # openTypeNameVersion 1067*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1068*e1fe3e4aSElliott Hughes infoObject.openTypeNameVersion = 123 1069*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1070*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1071*e1fe3e4aSElliott Hughes # openTypeNameUniqueID 1072*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1073*e1fe3e4aSElliott Hughes infoObject.openTypeNameUniqueID = 123 1074*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1075*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1076*e1fe3e4aSElliott Hughes # openTypeNameDescription 1077*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1078*e1fe3e4aSElliott Hughes infoObject.openTypeNameDescription = 123 1079*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1080*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1081*e1fe3e4aSElliott Hughes # openTypeNamePreferredFamilyName 1082*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1083*e1fe3e4aSElliott Hughes infoObject.openTypeNamePreferredFamilyName = 123 1084*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1085*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1086*e1fe3e4aSElliott Hughes # openTypeNamePreferredSubfamilyName 1087*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1088*e1fe3e4aSElliott Hughes infoObject.openTypeNamePreferredSubfamilyName = 123 1089*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1090*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1091*e1fe3e4aSElliott Hughes # openTypeNameCompatibleFullName 1092*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1093*e1fe3e4aSElliott Hughes infoObject.openTypeNameCompatibleFullName = 123 1094*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1095*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1096*e1fe3e4aSElliott Hughes # openTypeNameSampleText 1097*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1098*e1fe3e4aSElliott Hughes infoObject.openTypeNameSampleText = 123 1099*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1100*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1101*e1fe3e4aSElliott Hughes # openTypeNameWWSFamilyName 1102*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1103*e1fe3e4aSElliott Hughes infoObject.openTypeNameWWSFamilyName = 123 1104*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1105*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1106*e1fe3e4aSElliott Hughes # openTypeNameWWSSubfamilyName 1107*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1108*e1fe3e4aSElliott Hughes infoObject.openTypeNameWWSSubfamilyName = 123 1109*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1110*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1111*e1fe3e4aSElliott Hughes 1112*e1fe3e4aSElliott Hughes def testOS2Write(self): 1113*e1fe3e4aSElliott Hughes # openTypeOS2WidthClass 1114*e1fe3e4aSElliott Hughes ## not an int 1115*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1116*e1fe3e4aSElliott Hughes infoObject.openTypeOS2WidthClass = "abc" 1117*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1118*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1119*e1fe3e4aSElliott Hughes ## out or range 1120*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1121*e1fe3e4aSElliott Hughes infoObject.openTypeOS2WidthClass = 15 1122*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1123*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1124*e1fe3e4aSElliott Hughes # openTypeOS2WeightClass 1125*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1126*e1fe3e4aSElliott Hughes ## not an int 1127*e1fe3e4aSElliott Hughes infoObject.openTypeOS2WeightClass = "abc" 1128*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1129*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1130*e1fe3e4aSElliott Hughes ## out of range 1131*e1fe3e4aSElliott Hughes infoObject.openTypeOS2WeightClass = -50 1132*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1133*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1134*e1fe3e4aSElliott Hughes # openTypeOS2Selection 1135*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1136*e1fe3e4aSElliott Hughes infoObject.openTypeOS2Selection = [-1] 1137*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1138*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1139*e1fe3e4aSElliott Hughes # openTypeOS2VendorID 1140*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1141*e1fe3e4aSElliott Hughes infoObject.openTypeOS2VendorID = 1234 1142*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1143*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1144*e1fe3e4aSElliott Hughes # openTypeOS2Panose 1145*e1fe3e4aSElliott Hughes ## not an int 1146*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1147*e1fe3e4aSElliott Hughes infoObject.openTypeOS2Panose = [0, 1, 2, 3, 4, 5, 6, 7, 8, str(9)] 1148*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1149*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1150*e1fe3e4aSElliott Hughes ## too few values 1151*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1152*e1fe3e4aSElliott Hughes infoObject.openTypeOS2Panose = [0, 1, 2, 3] 1153*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1154*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1155*e1fe3e4aSElliott Hughes ## too many values 1156*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1157*e1fe3e4aSElliott Hughes infoObject.openTypeOS2Panose = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 1158*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1159*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1160*e1fe3e4aSElliott Hughes # openTypeOS2FamilyClass 1161*e1fe3e4aSElliott Hughes ## not an int 1162*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1163*e1fe3e4aSElliott Hughes infoObject.openTypeOS2FamilyClass = [0, str(1)] 1164*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1165*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1166*e1fe3e4aSElliott Hughes ## too few values 1167*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1168*e1fe3e4aSElliott Hughes infoObject.openTypeOS2FamilyClass = [1] 1169*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1170*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1171*e1fe3e4aSElliott Hughes ## too many values 1172*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1173*e1fe3e4aSElliott Hughes infoObject.openTypeOS2FamilyClass = [1, 1, 1] 1174*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1175*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1176*e1fe3e4aSElliott Hughes ## out of range 1177*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1178*e1fe3e4aSElliott Hughes infoObject.openTypeOS2FamilyClass = [1, 20] 1179*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1180*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1181*e1fe3e4aSElliott Hughes # openTypeOS2UnicodeRanges 1182*e1fe3e4aSElliott Hughes ## not an int 1183*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1184*e1fe3e4aSElliott Hughes infoObject.openTypeOS2UnicodeRanges = ["0"] 1185*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1186*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1187*e1fe3e4aSElliott Hughes ## out of range 1188*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1189*e1fe3e4aSElliott Hughes infoObject.openTypeOS2UnicodeRanges = [-1] 1190*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1191*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1192*e1fe3e4aSElliott Hughes # openTypeOS2CodePageRanges 1193*e1fe3e4aSElliott Hughes ## not an int 1194*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1195*e1fe3e4aSElliott Hughes infoObject.openTypeOS2CodePageRanges = ["0"] 1196*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1197*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1198*e1fe3e4aSElliott Hughes ## out of range 1199*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1200*e1fe3e4aSElliott Hughes infoObject.openTypeOS2CodePageRanges = [-1] 1201*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1202*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1203*e1fe3e4aSElliott Hughes # openTypeOS2TypoAscender 1204*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1205*e1fe3e4aSElliott Hughes infoObject.openTypeOS2TypoAscender = "abc" 1206*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1207*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1208*e1fe3e4aSElliott Hughes # openTypeOS2TypoDescender 1209*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1210*e1fe3e4aSElliott Hughes infoObject.openTypeOS2TypoDescender = "abc" 1211*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1212*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1213*e1fe3e4aSElliott Hughes # openTypeOS2TypoLineGap 1214*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1215*e1fe3e4aSElliott Hughes infoObject.openTypeOS2TypoLineGap = "abc" 1216*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1217*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1218*e1fe3e4aSElliott Hughes # openTypeOS2WinAscent 1219*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1220*e1fe3e4aSElliott Hughes infoObject.openTypeOS2WinAscent = "abc" 1221*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1222*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1223*e1fe3e4aSElliott Hughes # openTypeOS2WinDescent 1224*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1225*e1fe3e4aSElliott Hughes infoObject.openTypeOS2WinDescent = "abc" 1226*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1227*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1228*e1fe3e4aSElliott Hughes # openTypeOS2Type 1229*e1fe3e4aSElliott Hughes ## not an int 1230*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1231*e1fe3e4aSElliott Hughes infoObject.openTypeOS2Type = ["1"] 1232*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1233*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1234*e1fe3e4aSElliott Hughes ## out of range 1235*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1236*e1fe3e4aSElliott Hughes infoObject.openTypeOS2Type = [-1] 1237*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1238*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1239*e1fe3e4aSElliott Hughes # openTypeOS2SubscriptXSize 1240*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1241*e1fe3e4aSElliott Hughes infoObject.openTypeOS2SubscriptXSize = "abc" 1242*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1243*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1244*e1fe3e4aSElliott Hughes # openTypeOS2SubscriptYSize 1245*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1246*e1fe3e4aSElliott Hughes infoObject.openTypeOS2SubscriptYSize = "abc" 1247*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1248*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1249*e1fe3e4aSElliott Hughes # openTypeOS2SubscriptXOffset 1250*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1251*e1fe3e4aSElliott Hughes infoObject.openTypeOS2SubscriptXOffset = "abc" 1252*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1253*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1254*e1fe3e4aSElliott Hughes # openTypeOS2SubscriptYOffset 1255*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1256*e1fe3e4aSElliott Hughes infoObject.openTypeOS2SubscriptYOffset = "abc" 1257*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1258*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1259*e1fe3e4aSElliott Hughes # openTypeOS2SuperscriptXSize 1260*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1261*e1fe3e4aSElliott Hughes infoObject.openTypeOS2SuperscriptXSize = "abc" 1262*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1263*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1264*e1fe3e4aSElliott Hughes # openTypeOS2SuperscriptYSize 1265*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1266*e1fe3e4aSElliott Hughes infoObject.openTypeOS2SuperscriptYSize = "abc" 1267*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1268*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1269*e1fe3e4aSElliott Hughes # openTypeOS2SuperscriptXOffset 1270*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1271*e1fe3e4aSElliott Hughes infoObject.openTypeOS2SuperscriptXOffset = "abc" 1272*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1273*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1274*e1fe3e4aSElliott Hughes # openTypeOS2SuperscriptYOffset 1275*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1276*e1fe3e4aSElliott Hughes infoObject.openTypeOS2SuperscriptYOffset = "abc" 1277*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1278*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1279*e1fe3e4aSElliott Hughes # openTypeOS2StrikeoutSize 1280*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1281*e1fe3e4aSElliott Hughes infoObject.openTypeOS2StrikeoutSize = "abc" 1282*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1283*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1284*e1fe3e4aSElliott Hughes # openTypeOS2StrikeoutPosition 1285*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1286*e1fe3e4aSElliott Hughes infoObject.openTypeOS2StrikeoutPosition = "abc" 1287*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1288*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1289*e1fe3e4aSElliott Hughes 1290*e1fe3e4aSElliott Hughes def testVheaWrite(self): 1291*e1fe3e4aSElliott Hughes # openTypeVheaVertTypoAscender 1292*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1293*e1fe3e4aSElliott Hughes infoObject.openTypeVheaVertTypoAscender = "abc" 1294*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1295*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1296*e1fe3e4aSElliott Hughes # openTypeVheaVertTypoDescender 1297*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1298*e1fe3e4aSElliott Hughes infoObject.openTypeVheaVertTypoDescender = "abc" 1299*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1300*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1301*e1fe3e4aSElliott Hughes # openTypeVheaVertTypoLineGap 1302*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1303*e1fe3e4aSElliott Hughes infoObject.openTypeVheaVertTypoLineGap = "abc" 1304*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1305*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1306*e1fe3e4aSElliott Hughes # openTypeVheaCaretSlopeRise 1307*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1308*e1fe3e4aSElliott Hughes infoObject.openTypeVheaCaretSlopeRise = "abc" 1309*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1310*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1311*e1fe3e4aSElliott Hughes # openTypeVheaCaretSlopeRun 1312*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1313*e1fe3e4aSElliott Hughes infoObject.openTypeVheaCaretSlopeRun = "abc" 1314*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1315*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1316*e1fe3e4aSElliott Hughes # openTypeVheaCaretOffset 1317*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1318*e1fe3e4aSElliott Hughes infoObject.openTypeVheaCaretOffset = "abc" 1319*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1320*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1321*e1fe3e4aSElliott Hughes 1322*e1fe3e4aSElliott Hughes def testFONDWrite(self): 1323*e1fe3e4aSElliott Hughes # macintoshFONDFamilyID 1324*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1325*e1fe3e4aSElliott Hughes infoObject.macintoshFONDFamilyID = "abc" 1326*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1327*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1328*e1fe3e4aSElliott Hughes # macintoshFONDName 1329*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1330*e1fe3e4aSElliott Hughes infoObject.macintoshFONDName = 123 1331*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1332*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1333*e1fe3e4aSElliott Hughes 1334*e1fe3e4aSElliott Hughes def testPostscriptWrite(self): 1335*e1fe3e4aSElliott Hughes # postscriptFontName 1336*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1337*e1fe3e4aSElliott Hughes infoObject.postscriptFontName = 123 1338*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1339*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1340*e1fe3e4aSElliott Hughes # postscriptFullName 1341*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1342*e1fe3e4aSElliott Hughes infoObject.postscriptFullName = 123 1343*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1344*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1345*e1fe3e4aSElliott Hughes # postscriptSlantAngle 1346*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1347*e1fe3e4aSElliott Hughes infoObject.postscriptSlantAngle = "abc" 1348*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1349*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1350*e1fe3e4aSElliott Hughes # postscriptUniqueID 1351*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1352*e1fe3e4aSElliott Hughes infoObject.postscriptUniqueID = "abc" 1353*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1354*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1355*e1fe3e4aSElliott Hughes # postscriptUnderlineThickness 1356*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1357*e1fe3e4aSElliott Hughes infoObject.postscriptUnderlineThickness = "abc" 1358*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1359*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1360*e1fe3e4aSElliott Hughes # postscriptUnderlinePosition 1361*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1362*e1fe3e4aSElliott Hughes infoObject.postscriptUnderlinePosition = "abc" 1363*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1364*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1365*e1fe3e4aSElliott Hughes # postscriptIsFixedPitch 1366*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1367*e1fe3e4aSElliott Hughes infoObject.postscriptIsFixedPitch = 2 1368*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1369*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1370*e1fe3e4aSElliott Hughes # postscriptBlueValues 1371*e1fe3e4aSElliott Hughes ## not a list 1372*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1373*e1fe3e4aSElliott Hughes infoObject.postscriptBlueValues = "abc" 1374*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1375*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1376*e1fe3e4aSElliott Hughes ## uneven value count 1377*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1378*e1fe3e4aSElliott Hughes infoObject.postscriptBlueValues = [500] 1379*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1380*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1381*e1fe3e4aSElliott Hughes ## too many values 1382*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1383*e1fe3e4aSElliott Hughes infoObject.postscriptBlueValues = [ 1384*e1fe3e4aSElliott Hughes 10, 1385*e1fe3e4aSElliott Hughes 20, 1386*e1fe3e4aSElliott Hughes 30, 1387*e1fe3e4aSElliott Hughes 40, 1388*e1fe3e4aSElliott Hughes 50, 1389*e1fe3e4aSElliott Hughes 60, 1390*e1fe3e4aSElliott Hughes 70, 1391*e1fe3e4aSElliott Hughes 80, 1392*e1fe3e4aSElliott Hughes 90, 1393*e1fe3e4aSElliott Hughes 100, 1394*e1fe3e4aSElliott Hughes 110, 1395*e1fe3e4aSElliott Hughes 120, 1396*e1fe3e4aSElliott Hughes 130, 1397*e1fe3e4aSElliott Hughes 140, 1398*e1fe3e4aSElliott Hughes 150, 1399*e1fe3e4aSElliott Hughes 160, 1400*e1fe3e4aSElliott Hughes ] 1401*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1402*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1403*e1fe3e4aSElliott Hughes # postscriptOtherBlues 1404*e1fe3e4aSElliott Hughes ## not a list 1405*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1406*e1fe3e4aSElliott Hughes infoObject.postscriptOtherBlues = "abc" 1407*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1408*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1409*e1fe3e4aSElliott Hughes ## uneven value count 1410*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1411*e1fe3e4aSElliott Hughes infoObject.postscriptOtherBlues = [500] 1412*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1413*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1414*e1fe3e4aSElliott Hughes ## too many values 1415*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1416*e1fe3e4aSElliott Hughes infoObject.postscriptOtherBlues = [ 1417*e1fe3e4aSElliott Hughes 10, 1418*e1fe3e4aSElliott Hughes 20, 1419*e1fe3e4aSElliott Hughes 30, 1420*e1fe3e4aSElliott Hughes 40, 1421*e1fe3e4aSElliott Hughes 50, 1422*e1fe3e4aSElliott Hughes 60, 1423*e1fe3e4aSElliott Hughes 70, 1424*e1fe3e4aSElliott Hughes 80, 1425*e1fe3e4aSElliott Hughes 90, 1426*e1fe3e4aSElliott Hughes 100, 1427*e1fe3e4aSElliott Hughes 110, 1428*e1fe3e4aSElliott Hughes 120, 1429*e1fe3e4aSElliott Hughes 130, 1430*e1fe3e4aSElliott Hughes 140, 1431*e1fe3e4aSElliott Hughes 150, 1432*e1fe3e4aSElliott Hughes 160, 1433*e1fe3e4aSElliott Hughes ] 1434*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1435*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1436*e1fe3e4aSElliott Hughes # postscriptFamilyBlues 1437*e1fe3e4aSElliott Hughes ## not a list 1438*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1439*e1fe3e4aSElliott Hughes infoObject.postscriptFamilyBlues = "abc" 1440*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1441*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1442*e1fe3e4aSElliott Hughes ## uneven value count 1443*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1444*e1fe3e4aSElliott Hughes infoObject.postscriptFamilyBlues = [500] 1445*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1446*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1447*e1fe3e4aSElliott Hughes ## too many values 1448*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1449*e1fe3e4aSElliott Hughes infoObject.postscriptFamilyBlues = [ 1450*e1fe3e4aSElliott Hughes 10, 1451*e1fe3e4aSElliott Hughes 20, 1452*e1fe3e4aSElliott Hughes 30, 1453*e1fe3e4aSElliott Hughes 40, 1454*e1fe3e4aSElliott Hughes 50, 1455*e1fe3e4aSElliott Hughes 60, 1456*e1fe3e4aSElliott Hughes 70, 1457*e1fe3e4aSElliott Hughes 80, 1458*e1fe3e4aSElliott Hughes 90, 1459*e1fe3e4aSElliott Hughes 100, 1460*e1fe3e4aSElliott Hughes 110, 1461*e1fe3e4aSElliott Hughes 120, 1462*e1fe3e4aSElliott Hughes 130, 1463*e1fe3e4aSElliott Hughes 140, 1464*e1fe3e4aSElliott Hughes 150, 1465*e1fe3e4aSElliott Hughes 160, 1466*e1fe3e4aSElliott Hughes ] 1467*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1468*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1469*e1fe3e4aSElliott Hughes # postscriptFamilyOtherBlues 1470*e1fe3e4aSElliott Hughes ## not a list 1471*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1472*e1fe3e4aSElliott Hughes infoObject.postscriptFamilyOtherBlues = "abc" 1473*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1474*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1475*e1fe3e4aSElliott Hughes ## uneven value count 1476*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1477*e1fe3e4aSElliott Hughes infoObject.postscriptFamilyOtherBlues = [500] 1478*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1479*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1480*e1fe3e4aSElliott Hughes ## too many values 1481*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1482*e1fe3e4aSElliott Hughes infoObject.postscriptFamilyOtherBlues = [ 1483*e1fe3e4aSElliott Hughes 10, 1484*e1fe3e4aSElliott Hughes 20, 1485*e1fe3e4aSElliott Hughes 30, 1486*e1fe3e4aSElliott Hughes 40, 1487*e1fe3e4aSElliott Hughes 50, 1488*e1fe3e4aSElliott Hughes 60, 1489*e1fe3e4aSElliott Hughes 70, 1490*e1fe3e4aSElliott Hughes 80, 1491*e1fe3e4aSElliott Hughes 90, 1492*e1fe3e4aSElliott Hughes 100, 1493*e1fe3e4aSElliott Hughes 110, 1494*e1fe3e4aSElliott Hughes 120, 1495*e1fe3e4aSElliott Hughes 130, 1496*e1fe3e4aSElliott Hughes 140, 1497*e1fe3e4aSElliott Hughes 150, 1498*e1fe3e4aSElliott Hughes 160, 1499*e1fe3e4aSElliott Hughes ] 1500*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1501*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1502*e1fe3e4aSElliott Hughes # postscriptStemSnapH 1503*e1fe3e4aSElliott Hughes ## not list 1504*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1505*e1fe3e4aSElliott Hughes infoObject.postscriptStemSnapH = "abc" 1506*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1507*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1508*e1fe3e4aSElliott Hughes ## too many values 1509*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1510*e1fe3e4aSElliott Hughes infoObject.postscriptStemSnapH = [ 1511*e1fe3e4aSElliott Hughes 10, 1512*e1fe3e4aSElliott Hughes 20, 1513*e1fe3e4aSElliott Hughes 30, 1514*e1fe3e4aSElliott Hughes 40, 1515*e1fe3e4aSElliott Hughes 50, 1516*e1fe3e4aSElliott Hughes 60, 1517*e1fe3e4aSElliott Hughes 70, 1518*e1fe3e4aSElliott Hughes 80, 1519*e1fe3e4aSElliott Hughes 90, 1520*e1fe3e4aSElliott Hughes 100, 1521*e1fe3e4aSElliott Hughes 110, 1522*e1fe3e4aSElliott Hughes 120, 1523*e1fe3e4aSElliott Hughes 130, 1524*e1fe3e4aSElliott Hughes 140, 1525*e1fe3e4aSElliott Hughes 150, 1526*e1fe3e4aSElliott Hughes 160, 1527*e1fe3e4aSElliott Hughes ] 1528*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1529*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1530*e1fe3e4aSElliott Hughes # postscriptStemSnapV 1531*e1fe3e4aSElliott Hughes ## not list 1532*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1533*e1fe3e4aSElliott Hughes infoObject.postscriptStemSnapV = "abc" 1534*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1535*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1536*e1fe3e4aSElliott Hughes ## too many values 1537*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1538*e1fe3e4aSElliott Hughes infoObject.postscriptStemSnapV = [ 1539*e1fe3e4aSElliott Hughes 10, 1540*e1fe3e4aSElliott Hughes 20, 1541*e1fe3e4aSElliott Hughes 30, 1542*e1fe3e4aSElliott Hughes 40, 1543*e1fe3e4aSElliott Hughes 50, 1544*e1fe3e4aSElliott Hughes 60, 1545*e1fe3e4aSElliott Hughes 70, 1546*e1fe3e4aSElliott Hughes 80, 1547*e1fe3e4aSElliott Hughes 90, 1548*e1fe3e4aSElliott Hughes 100, 1549*e1fe3e4aSElliott Hughes 110, 1550*e1fe3e4aSElliott Hughes 120, 1551*e1fe3e4aSElliott Hughes 130, 1552*e1fe3e4aSElliott Hughes 140, 1553*e1fe3e4aSElliott Hughes 150, 1554*e1fe3e4aSElliott Hughes 160, 1555*e1fe3e4aSElliott Hughes ] 1556*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1557*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1558*e1fe3e4aSElliott Hughes # postscriptBlueFuzz 1559*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1560*e1fe3e4aSElliott Hughes infoObject.postscriptBlueFuzz = "abc" 1561*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1562*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1563*e1fe3e4aSElliott Hughes # postscriptBlueShift 1564*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1565*e1fe3e4aSElliott Hughes infoObject.postscriptBlueShift = "abc" 1566*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1567*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1568*e1fe3e4aSElliott Hughes # postscriptBlueScale 1569*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1570*e1fe3e4aSElliott Hughes infoObject.postscriptBlueScale = "abc" 1571*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1572*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1573*e1fe3e4aSElliott Hughes # postscriptForceBold 1574*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1575*e1fe3e4aSElliott Hughes infoObject.postscriptForceBold = "abc" 1576*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1577*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1578*e1fe3e4aSElliott Hughes # postscriptDefaultWidthX 1579*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1580*e1fe3e4aSElliott Hughes infoObject.postscriptDefaultWidthX = "abc" 1581*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1582*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1583*e1fe3e4aSElliott Hughes # postscriptNominalWidthX 1584*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1585*e1fe3e4aSElliott Hughes infoObject.postscriptNominalWidthX = "abc" 1586*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1587*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1588*e1fe3e4aSElliott Hughes # postscriptWeightName 1589*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1590*e1fe3e4aSElliott Hughes infoObject.postscriptWeightName = 123 1591*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1592*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1593*e1fe3e4aSElliott Hughes # postscriptDefaultCharacter 1594*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1595*e1fe3e4aSElliott Hughes infoObject.postscriptDefaultCharacter = 123 1596*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1597*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1598*e1fe3e4aSElliott Hughes # postscriptWindowsCharacterSet 1599*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1600*e1fe3e4aSElliott Hughes infoObject.postscriptWindowsCharacterSet = -1 1601*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1602*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1603*e1fe3e4aSElliott Hughes # macintoshFONDFamilyID 1604*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1605*e1fe3e4aSElliott Hughes infoObject.macintoshFONDFamilyID = "abc" 1606*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1607*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1608*e1fe3e4aSElliott Hughes # macintoshFONDName 1609*e1fe3e4aSElliott Hughes infoObject = self.makeInfoObject() 1610*e1fe3e4aSElliott Hughes infoObject.macintoshFONDName = 123 1611*e1fe3e4aSElliott Hughes writer = UFOWriter(self.dstDir, formatVersion=2) 1612*e1fe3e4aSElliott Hughes self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject) 1613