def testCompileActions_shouldShareSubsequences(self): state = otTables.AATState() t = state.Transitions = { i: otTables.LigatureMorphAction() for i in range(3) } ligs = [otTables.LigAction() for _ in range(3)] for i, lig in enumerate(ligs): lig.GlyphIndexDelta = i t[0].Actions = ligs[1:2] t[1].Actions = ligs[0:3] t[2].Actions = ligs[1:3] actions, actionIndex = t[0].compileActions(self.font, [state]) self.assertEqual(actions, deHexStr("00000000 00000001 80000002 80000001")) self.assertEqual( actionIndex, { deHexStr("00000000 00000001 80000002"): 0, deHexStr("00000001 80000002"): 1, deHexStr("80000002"): 2, deHexStr("80000001"): 3, })
def testCompileActions_shouldShareSubsequences(self): state = otTables.AATState() t = state.Transitions = { i: otTables.InsertionMorphAction() for i in range(3) } t[1].CurrentInsertionAction = [] t[0].MarkedInsertionAction = ['A'] t[1].CurrentInsertionAction = ['C', 'D'] t[1].MarkedInsertionAction = ['B'] t[2].CurrentInsertionAction = ['B', 'C', 'D'] t[2].MarkedInsertionAction = ['C', 'D'] actions, actionIndex = t[0].compileActions(self.font, [state]) self.assertEqual(actions, deHexStr('0002 0003 0004 0001')) self.assertEqual( actionIndex, { ('A', ): 3, ('B', ): 0, ('B', 'C'): 0, ('B', 'C', 'D'): 0, ('C', ): 1, ('C', 'D'): 1, ('D', ): 2, })