Пример #1
0
	def test_decompilePoints_roundTrip(self):
		numPointsInGlyph = 500  # greater than 255, so we also exercise code path for 16-bit encoding
		compile = lambda points: GlyphVariation.compilePoints(points, numPointsInGlyph)
		decompile = lambda data: set(GlyphVariation.decompilePoints_(numPointsInGlyph, data, 0)[0])
		for i in range(50):
			points = set(random.sample(range(numPointsInGlyph), 30))
			self.assertSetEqual(points, decompile(compile(points)),
					    "failed round-trip decompile/compilePoints; points=%s" % points)
		allPoints = set(range(numPointsInGlyph))
		self.assertSetEqual(allPoints, decompile(compile(allPoints)))
Пример #2
0
	def test_decompilePoints_roundTrip(self):
		numPointsInGlyph = 500  # greater than 255, so we also exercise code path for 16-bit encoding
		compile = GlyphVariation.compilePoints
		decompile = lambda data: set(GlyphVariation.decompilePoints_(numPointsInGlyph, data, 0)[0])
		for i in range(50):
			points = set(random.sample(range(numPointsInGlyph), 30))
			if hasattr(self, "assertSetEqual"):
				# Python 2.7 and later
				self.assertSetEqual(points, decompile(compile(points)),
						    "failed round-trip decompile/compilePoints; points=%s" % points)
			else:
				self.assertEqual(points, decompile(compile(points)),
						 "failed round-trip decompile/compilePoints; points=%s" % points)
Пример #3
0
 def test_decompilePoints_roundTrip(self):
     numPointsInGlyph = 500  # greater than 255, so we also exercise code path for 16-bit encoding
     compile = lambda points: GlyphVariation.compilePoints(
         points, numPointsInGlyph)
     decompile = lambda data: set(
         GlyphVariation.decompilePoints_(numPointsInGlyph, data, 0)[0])
     for i in range(50):
         points = set(random.sample(range(numPointsInGlyph), 30))
         self.assertSetEqual(
             points, decompile(compile(points)),
             "failed round-trip decompile/compilePoints; points=%s" %
             points)
     allPoints = set(range(numPointsInGlyph))
     self.assertSetEqual(allPoints, decompile(compile(allPoints)))
Пример #4
0
		def decompilePoints(data, offset):
			points, offset = GlyphVariation.decompilePoints_(numPointsInGlyph, deHexStr(data), offset)
			# Conversion to list needed for Python 3.
			return (list(points), offset)
Пример #5
0
 def decompilePoints(data, offset):
     points, offset = GlyphVariation.decompilePoints_(
         numPointsInGlyph, deHexStr(data), offset)
     # Conversion to list needed for Python 3.
     return (list(points), offset)