def test_compileSharedTuples(self): # Below, the peak coordinate {"wght": 1.0, "wdth": 0.7} appears # three times; {"wght": 1.0, "wdth": 0.8} appears twice. # Because the start and end of variation ranges is not encoded # into the shared pool, they should get ignored. deltas = [None] * 4 variations = [ TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.5, 0.7, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.2, 0.7, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.2, 0.8, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.3, 0.7, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.3, 0.8, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.3, 0.9, 1.0) }, deltas) ] result = compileSharedTuples(["wght", "wdth"], variations) self.assertEqual([hexencode(c) for c in result], ["40 00 2C CD", "40 00 33 33"])
def test_compileSharedTuples(self): # Below, the peak coordinate {"wght": 1.0, "wdth": 0.8} appears # three times (most frequent sorted first); {"wght": 1.0, "wdth": 0.5} # and {"wght": 1.0, "wdth": 0.7} both appears two times (tie) and # are sorted alphanumerically to ensure determinism. # The peak coordinate {"wght": 1.0, "wdth": 0.9} appears only once # and is thus ignored. # Because the start and end of variation ranges is not encoded # into the shared pool, they should get ignored. deltas = [None] * 4 variations = [ TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.5, 0.7, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.2, 0.7, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.2, 0.8, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.3, 0.5, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.3, 0.8, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.3, 0.9, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.4, 0.8, 1.0) }, deltas), TupleVariation({ "wght": (1.0, 1.0, 1.0), "wdth": (0.5, 0.5, 1.0) }, deltas), ] result = compileSharedTuples(["wght", "wdth"], variations) self.assertEqual([hexencode(c) for c in result], ["40 00 33 33", "40 00 20 00", "40 00 2C CD"])