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

from AppKit import *
from PyObjCTools.TestSupport import *

class TestNSInputServerHelper (NSObject):
    def doCommandBySelector_client_(self, sel, sender): pass
    def markedTextSelectionChanged_client_(self, sel, sender): pass
    def canBeDisabled(self): return 1
    def wantsToInterpretAllKeystrokes(self): return 1
    def wantsToHandleMouseEvents(self): return 1
    def wantsToDelayTextChangeNotifications(self): return 1
    def activeConversationWillChange_fromOldConversation_(self, s, o): pass
    def activeConversationChanged_toNewConversation_(self, s, n): pass

    def mouseDownOnCharacterIndex_atCoordinate_withModifier_client_(self, i, p, f, s): return 1
    def mouseDraggedOnCharacterIndex_atCoordinate_withModifier_client_(self, i, p, f, s): return 1
    def mouseUpOnCharacterIndex_atCoordinate_withModifier_client_(self, i, p, f, s): pass

class TestNSInputServer (TestCase):
    def testProtocols(self):
        self.assertArgIsSEL(TestNSInputServerHelper.doCommandBySelector_client_, 0, b'v@:@')
        self.assertArgHasType(TestNSInputServerHelper.markedTextSelectionChanged_client_, 0, NSRange.__typestr__)
        self.assertResultIsBOOL(TestNSInputServerHelper.canBeDisabled)
        self.assertResultIsBOOL(TestNSInputServerHelper.wantsToInterpretAllKeystrokes)
        self.assertResultIsBOOL(TestNSInputServerHelper.wantsToHandleMouseEvents)
        self.assertArgHasType(TestNSInputServerHelper.activeConversationWillChange_fromOldConversation_, 1, objc._C_NSInteger)
        self.assertArgHasType(TestNSInputServerHelper.activeConversationChanged_toNewConversation_, 1, objc._C_NSInteger)

        self.assertResultIsBOOL(TestNSInputServerHelper.mouseDownOnCharacterIndex_atCoordinate_withModifier_client_)
        self.assertArgHasType(TestNSInputServerHelper.mouseDownOnCharacterIndex_atCoordinate_withModifier_client_, 0, objc._C_NSUInteger)
        self.assertArgHasType(TestNSInputServerHelper.mouseDownOnCharacterIndex_atCoordinate_withModifier_client_, 1, NSPoint.__typestr__)
        self.assertArgHasType(TestNSInputServerHelper.mouseDownOnCharacterIndex_atCoordinate_withModifier_client_, 2, objc._C_NSUInteger)

        self.assertResultIsBOOL(TestNSInputServerHelper.mouseDraggedOnCharacterIndex_atCoordinate_withModifier_client_)
        self.assertArgHasType(TestNSInputServerHelper.mouseDraggedOnCharacterIndex_atCoordinate_withModifier_client_, 0, objc._C_NSUInteger)
        self.assertArgHasType(TestNSInputServerHelper.mouseDownOnCharacterIndex_atCoordinate_withModifier_client_, 1, NSPoint.__typestr__)
        self.assertArgHasType(TestNSInputServerHelper.mouseDownOnCharacterIndex_atCoordinate_withModifier_client_, 2, objc._C_NSUInteger)

        self.assertResultHasType(TestNSInputServerHelper.mouseUpOnCharacterIndex_atCoordinate_withModifier_client_, b'v')
        self.assertArgHasType(TestNSInputServerHelper.mouseUpOnCharacterIndex_atCoordinate_withModifier_client_, 0, objc._C_NSUInteger)
        self.assertArgHasType(TestNSInputServerHelper.mouseUpOnCharacterIndex_atCoordinate_withModifier_client_, 1, NSPoint.__typestr__)
        self.assertArgHasType(TestNSInputServerHelper.mouseUpOnCharacterIndex_atCoordinate_withModifier_client_, 2, objc._C_NSUInteger)



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.