From baf2fbf87df3c6222d7fdfd4ceeae8cff128ee96 Mon Sep 17 00:00:00 2001 From: justvanrossum Date: Fri, 3 Nov 2017 15:10:06 +0100 Subject: [PATCH] added tests for cmap.getBestCmap() --- Tests/ttLib/tables/_c_m_a_p_test.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Tests/ttLib/tables/_c_m_a_p_test.py b/Tests/ttLib/tables/_c_m_a_p_test.py index 73ac2395c..a03c72e2d 100644 --- a/Tests/ttLib/tables/_c_m_a_p_test.py +++ b/Tests/ttLib/tables/_c_m_a_p_test.py @@ -58,6 +58,16 @@ class CmapSubtableTest(unittest.TestCase): cmap.tables = [c4, c12] self.assertEqual(cmap.buildReversed(), {'A':{0x0041, 0x0391}, 'u10314':{0x10314}}) + def test_getBestCmap(self): + c4 = self.makeSubtable(4, 3, 1, 0) + c4.cmap = {0x0041:'A', 0x0391:'A'} + c12 = self.makeSubtable(12, 3, 10, 0) + c12.cmap = {0x10314: 'u10314'} + cmap = table__c_m_a_p() + cmap.tables = [c4, c12] + self.assertEqual(cmap.getBestCmap(), {0x10314: 'u10314'}) + self.assertEqual(cmap.getBestCmap(cmapPreferences=[(3, 1)]), {0x0041:'A', 0x0391:'A'}) + if __name__ == "__main__": import sys