Exemplo n.º 1
0
 def testFontFileChecksum(self):
     "Tests TTFontFile and TTF parsing code"
     file = TTFOpenFile("Vera.ttf")[1].read()
     TTFontFile(StringIO(file), validate=1)  # should not fail
     file1 = file[:12345] + "\xFF" + file[12346:]  # change one byte
     self.assertRaises(TTFError, TTFontFile, StringIO(file1), validate=1)
     file1 = file[:8] + "\xFF" + file[9:]  # change one byte
     self.assertRaises(TTFError, TTFontFile, StringIO(file1), validate=1)
Exemplo n.º 2
0
 def testFontFileChecksum(self):
     "Tests TTFontFile and TTF parsing code"
     F = TTFOpenFile("Vera.ttf")[1].read()
     TTFontFile(getBytesIO(F), validate=1)  # should not fail
     F1 = F[:12345] + b"\xFF" + F[12346:]  # change one byte
     self.assertRaises(TTFError, TTFontFile, getBytesIO(F1), validate=1)
     F1 = F[:8] + b"\xFF" + F[9:]  # change one byte
     self.assertRaises(TTFError, TTFontFile, getBytesIO(F1), validate=1)