Commits

Ronald Oussoren committed 3cf20d6

Add some missing CoreText testcases (with incomplete implementation)

Comments (0)

Files changed (8)

pyobjc-framework-CoreText/PyObjCTest/test_coretext.py

         self.assertEqual(kCTVersionNumber10_5_5, 0x00020003)
         self.assertEqual(kCTVersionNumber10_6, 0x00030000)
 
+    @min_os_level('10.7')
+    def testConstants10_8(self):
+        self.assertEqual(kCTVersionNumber10_7, 0x00040000)
+
+
+    @min_os_level('10.8')
+    def testConstants10_8(self):
+        self.assertEqual(kCTVersionNumber10_8, 0x00050000)
 
     def testFunctions(self):
         v = CTGetCoreTextVersion()

pyobjc-framework-CoreText/PyObjCTest/test_ctfont.py

         self.assertEqual(kCTFontOptionsPreventAutoActivation, 1 << 0)
         self.assertEqual(kCTFontOptionsPreferSystemFont, 1 << 2)
 
+    @min_os_level('10.8')
+    def testConstants10_8(self):
+        self.assertIsInstance(kCTBaselineClassHanging, unicode)
+        self.assertIsInstance(kCTBaselineClassIdeographicCentered, unicode)
+        self.assertIsInstance(kCTBaselineClassIdeographicHigh, unicode)
+        self.assertIsInstance(kCTBaselineClassIdeographicLow, unicode)
+        self.assertIsInstance(kCTBaselineClassMath, unicode)
+        self.assertIsInstance(kCTBaselineClassRoman, unicode)
+        self.assertIsInstance(kCTBaselineOriginalFont, unicode)
+        self.assertIsInstance(kCTBaselineReferenceFont, unicode)
+        self.assertIsInstance(kCTBaselineReferenceFont, unicode)
+
+        self.assertEqual(kCTFontTableAnkr, fourcc(b'ankr'))
+
 
     def testConstants(self):
         self.assertIsInstance(kCTFontCopyrightNameKey, unicode)
         v = CTFontCreateWithFontDescriptorAndOptions(descr, 14.0, None, 0)
         self.assertIsInstance(v, CTFontRef)
 
+    @min_os_level('10.7')
+    def testFunctions10_7(self):
+        self.fail("CTFontDrawGlyphs")
+
+    @min_os_level('10.8')
+    def testFunctions10_8(self):
+        self.fail("CTFontGetOpticalBoundsForGlyps")
 
 if __name__ == "__main__":
     main()

pyobjc-framework-CoreText/PyObjCTest/test_ctfontmanager.py

+from PyObjCTools.TestSupport import *
+from CoreText import *
+
+try:
+    unicode
+
+except NameError:
+    unicode = str
+
+class TestCTFontManager (TestCase):
+    @min_os_level('10.6')
+    def testConstants10_6(self):
+        self.assertEqual(kCTFontManagerScopeNone, 0)
+        self.assertEqual(kCTFontManagerScopeProcess, 1)
+        self.assertEqual(kCTFontManagerScopeUser, 2)
+        self.assertEqual(kCTFontManagerScopeSession, 3)
+
+        self.assertIsInstance(kCTFontManagerBundleIdentifier, unicode)
+
+        self.assertEqual(kCTFontManagerAutoActivationDefault, 0)
+        self.assertEqual(kCTFontManagerAutoActivationDisabled, 1)
+        self.assertEqual(kCTFontManagerAutoActivationEnabled, 2)
+        self.assertEqual(kCTFontManagerAutoActivationPromptUser, 3)
+
+        self.assertIsInstance(kCTFontManagerRegisteredFontsChangedNotification, unicode)
+
+
+    @min_os_level('10.6')
+    def testFunctions10_6(self):
+        self.fail("CTFontManagerCopyAvailablePostScriptNames")
+        self.fail("CTFontManagerCopyAvailableFontFamilyNames")
+        self.fail("CTFontManagerCopyAvailableFontURLs")
+        self.fail("CTFontManagerCompareFontFamilyNames")
+        self.fail("CTFontManagerCreateFontDescriptorsFromURL")
+        self.fail("CTFontManagerRegisterFontsForURL")
+        self.fail("CTFontManagerUnregisterFontsForURL")
+        self.fail("CTFontManagerRegisterFontsForURLs")
+        self.fail("CTFontManagerUnregisterFontsForURLs")
+        self.fail("CTFontManagerEnableFontDescriptors")
+        self.fail("CTFontManagerGetScopeForURL")
+        self.fail("CTFontManagerIsSupportedFont")
+        self.fail("CTFontManagerCreateFontRequestRunLoopSource")
+        self.fail("CTFontManagerSetAutoActivationSetting")
+        self.fail("CTFontManagerGetAutoActivationSetting")
+
+    @min_os_level('10.7')
+    def testFunctions10_7(self):
+        self.fail("CTFontManagerCreateFontDescriptorFromData")
+
+
+
+    @min_os_level('10.8')
+    def testFunctions10_8(self):
+        self.fail("CTFontManagerCreateFontDescriptorFromData")
+        self.fail("CTFontManagerRegisterGraphicsFont")
+        self.fail("CTFontManagerUnregisterGraphicsFont")
+
+if __name__ == "__main__":
+    main()

pyobjc-framework-CoreText/PyObjCTest/test_ctfontmanagererrors.py

+from PyObjCTools.TestSupport import *
+from CoreText import *
+
+try:
+    unicode
+except NameError:
+    unicode = str
+
+class TestCTFontManagerErrors (TestCase):
+    @min_os_level("10.6")
+    def testConstants10_6(self):
+        self.assertIsInstancE(kCTFontManagerErrorDomain, unicode)
+        self.assertIsInstancE(kCTFontManagerErrorFontURLsKey, unicode)
+
+        self.assertEqual(kCTFontManagerErrorFileNotFound, 101)
+        self.assertEqual(kCTFontManagerErrorInsufficientPermissions, 102)
+        self.assertEqual(kCTFontManagerErrorUnrecognizedFormat, 103)
+        self.assertEqual(kCTFontManagerErrorInvalidFontData, 104)
+        self.assertEqual(kCTFontManagerErrorAlreadyRegistered, 105)
+
+        self.assertEqual(kCTFontManagerErrorNotRegistered, 201)
+        self.assertEqual(kCTFontManagerErrorInUse, 202)
+        self.assertEqual(kCTFontManagerErrorSystemRequired, 202)
+
+
+if __name__ == "__main__":
+    main()

pyobjc-framework-CoreText/PyObjCTest/test_ctfonttraits.py

         self.assertEqual(kCTFontScriptsClass, cast_uint(10 << kCTFontClassMaskShift))
         self.assertEqual(kCTFontSymbolicClass, cast_uint(12 << kCTFontClassMaskShift))
 
+    @min_os_level("10.7")
+    def testConstants10_7(self):
+        self.assertEqual(kCTFontTraitColorGlyphs, 1<<13)
+        self.assertEqual(kCTFontTraitComposite, 1<<14)
+
+        self.assertEqual(kCTFontColorGlyphsTrait, kCTFontTraitColorGlyphs)
+
+    @min_os_level("10.8")
+    def testConstants10_8(self):
+        self.assertEqual(kCTFontCompositeTrait, kCTFontTraitComposite)
+
+
 if __name__ == "__main__":
     main()

pyobjc-framework-CoreText/PyObjCTest/test_ctline.py

         if os.path.exists("/tmp/pyobjc.test.pdf"):
             os.unlink("/tmp/pyobjc.test.pdf")
 
+    @min_os_level("10.8")
+    def testConstants10_8(self):
+        self.assertEqual(kCTLineBoundsExcludeTypographicLeading, 1 << 0)
+        self.assertEqual(kCTLineBoundsExcludeTypographicShifts, 1 << 1)
+        self.assertEqual(kCTLineBoundsUseHangingPunctuation, 1 << 2)
+        self.assertEqual(kCTLineBoundsUseGlyphPathBounds, 1 << 3)
+        self.assertEqual(kCTLineBoundsUseOpticalBounds, 1 << 4)
+
+    @min_os_level("10.8")
+    def testFunctions10_8(self):
+        astr = CFAttributedStringCreate(None, b"-".decode('latin1'), None)
+        self.assertTrue(astr is not None)
+
+        token = CTLineCreateWithAttributedString(astr)
+        self.assertIsInstance(token, CTLineRef)
+
+        r = CTLineGetBoundsWithOptions(token, kCTLineBoundsExcludeTypographicLeading)
+        self.assertIsInstance(r, CGRect)
+
 if __name__ == "__main__":
     main()

pyobjc-framework-CoreText/PyObjCTest/test_ctparagraphstyle.py

         self.assertEqual(kCTParagraphStyleSpecifierMinimumLineSpacing, 15)
         self.assertEqual(kCTParagraphStyleSpecifierLineSpacingAdjustment, 16)
 
-        self.assertEqual(kCTParagraphStyleSpecifierCount, 17)
+    @min_os_level("10.8")
+    def testConstants10_8(self):
+        self.assertEqual(kCTParagraphStyleSpecifierBoundsOptions, 17)
 
     def testStructs(self):
         v = CTParagraphStyleSetting()

pyobjc-framework-CoreText/PyObjCTest/test_ctstringattributes.py

         self.assertIsInstance(kCTStrokeWidthAttributeName, unicode)
         self.assertIsInstance(kCTStrokeColorAttributeName, unicode)
 
+    @min_os_level('10.8')
+    def testConstants10_8(self):
+        self.assertIsInstance(kCTBaselineClassAttributeName, unicode)
+        self.assertIsInstance(kCTBaselineInfoAttributeName, unicode)
+        self.assertIsInstance(kCTBaselineReferenceInfoAttributeName, unicode)
+        self.assertIsInstance(kCTWritingDirectionAttributeName, unicode)
+
 
 if __name__ == "__main__":
     main()