Source

pyobjc / pyobjc-framework-Cocoa / PyObjCTest / test_nsfontmanager.py

from PyObjCTools.TestSupport import *
from AppKit import *

class TestNSFontManagerHelper (NSObject):
    def fontManager_willIncludeFont_(self, m, f): return 1

class TestNSFontManager (TestCase):
    def testConstants(self):
        self.assertEqual(NSItalicFontMask, 0x00000001)
        self.assertEqual(NSBoldFontMask, 0x00000002)
        self.assertEqual(NSUnboldFontMask, 0x00000004)
        self.assertEqual(NSNonStandardCharacterSetFontMask, 0x00000008)
        self.assertEqual(NSNarrowFontMask, 0x00000010)
        self.assertEqual(NSExpandedFontMask, 0x00000020)
        self.assertEqual(NSCondensedFontMask, 0x00000040)
        self.assertEqual(NSSmallCapsFontMask, 0x00000080)
        self.assertEqual(NSPosterFontMask, 0x00000100)
        self.assertEqual(NSCompressedFontMask, 0x00000200)
        self.assertEqual(NSFixedPitchFontMask, 0x00000400)
        self.assertEqual(NSUnitalicFontMask, 0x01000000)
        self.assertEqual(NSFontCollectionApplicationOnlyMask, 1 << 0)
        self.assertEqual(NSNoFontChangeAction, 0)
        self.assertEqual(NSViaPanelFontAction, 1)
        self.assertEqual(NSAddTraitFontAction, 2)
        self.assertEqual(NSSizeUpFontAction, 3)
        self.assertEqual(NSSizeDownFontAction, 4)
        self.assertEqual(NSHeavierFontAction, 5)
        self.assertEqual(NSLighterFontAction, 6)
        self.assertEqual(NSRemoveTraitFontAction, 7)

    def testMethods(self):
        self.assertResultIsBOOL(NSFontManager.isMultiple)
        self.assertArgIsBOOL(NSFontManager.setSelectedFont_isMultiple_, 1)
        self.assertArgIsBOOL(NSFontManager.fontMenu_, 0)
        self.assertArgIsBOOL(NSFontManager.fontPanel_, 0)
        self.assertResultIsBOOL(NSFontManager.isEnabled)
        self.assertArgIsBOOL(NSFontManager.setEnabled_, 0)
        self.assertResultIsBOOL(NSFontManager.sendAction)
        self.assertArgIsBOOL(NSFontManager.setSelectedAttributes_isMultiple_, 1)
        self.assertResultIsBOOL(NSFontManager.addCollection_options_)
        self.assertResultIsBOOL(NSFontManager.removeCollection_)
        self.assertResultIsBOOL(NSFontManager.fontNamed_hasTraits_)

    def testProtocols(self):
        self.assertResultIsBOOL(TestNSFontManagerHelper.fontManager_willIncludeFont_)

if __name__ == "__main__":
    main()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.