pyobjc / pyobjc-framework-InputMethodKit / PyObjCTest / test_inputmethodkit.py

'''
Some simple tests to check that the framework is properly wrapped.
'''
import objc
import unittest
import InputMethodKit

try:
    unicode
except NameError:
    unicode = str

try:
    long
except NameError:
    long = int

class TestInputMethodKit (unittest.TestCase):
    def testClasses(self):

        self.assert_( hasattr(InputMethodKit, 'IMKInputController') )
        self.assert_( isinstance(InputMethodKit.IMKInputController, objc.objc_class) )

        # 10.5
        self.assert_( hasattr(InputMethodKit, 'IMKCandidates') )
        self.assert_( isinstance(InputMethodKit.IMKCandidates, objc.objc_class) )
    def testValues(self):
        self.assert_( hasattr(InputMethodKit, 'kIMKScrollingGridCandidatePanel') )
        self.assert_( isinstance(InputMethodKit.kIMKScrollingGridCandidatePanel, (int, long)) )
        self.assertEquals(InputMethodKit.kIMKScrollingGridCandidatePanel, 2)

    def testVariables(self):
        self.assert_( hasattr(InputMethodKit, 'IMKCandidatesOpacityAttributeName') )
        self.assert_( isinstance(InputMethodKit.IMKCandidatesOpacityAttributeName, unicode) )

    def testProtocols(self):
        self.assert_( hasattr(InputMethodKit, 'protocols') )
        self.assert_( hasattr(InputMethodKit.protocols, 'IMKServerInput') )
        self.assert_( isinstance(InputMethodKit.protocols.IMKServerInput, objc.informal_protocol) )

    def testProtocols2(self):
        objc.protocolNamed('IMKMouseHandling')
        objc.protocolNamed('IMKStateSetting')



if __name__ == "__main__":
    unittest.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.