1
2from PyObjCTools.TestSupport import *
3from AppKit import *
4
5class TestNSTokenFieldCellHelper (NSObject):
6    def tokenFieldCell_completionsForSubstring_indexOfToken_indexOfSelectedItem_(self, a, b, c, d): return 1
7    def tokenFieldCell_shouldAddObjects_atIndex_(self, a, b, c): return 1
8    def tokenFieldCell_writeRepresentedObjects_toPasteboard_(self, a, b, c): return 1
9    def tokenFieldCell_hasMenuForRepresentedObject_(self, a, b): return 1
10    def tokenFieldCell_styleForRepresentedObject_(self, a, b): return 1
11
12
13class TestNSTokenFieldCell (TestCase):
14    def testConstants(self):
15        self.assertEqual(NSDefaultTokenStyle, 0)
16        self.assertEqual(NSPlainTextTokenStyle, 1)
17        self.assertEqual(NSRoundedTokenStyle, 2)
18
19    def testProtocols(self):
20        self.assertArgHasType(TestNSTokenFieldCellHelper.tokenFieldCell_completionsForSubstring_indexOfToken_indexOfSelectedItem_, 2, objc._C_NSInteger)
21        self.assertArgHasType(TestNSTokenFieldCellHelper.tokenFieldCell_completionsForSubstring_indexOfToken_indexOfSelectedItem_, 3, b'o^'+ objc._C_NSInteger)
22        self.assertArgHasType(TestNSTokenFieldCellHelper.tokenFieldCell_shouldAddObjects_atIndex_, 2, objc._C_NSUInteger)
23        self.assertResultIsBOOL(TestNSTokenFieldCellHelper.tokenFieldCell_writeRepresentedObjects_toPasteboard_)
24        self.assertResultIsBOOL(TestNSTokenFieldCellHelper.tokenFieldCell_hasMenuForRepresentedObject_)
25        self.assertResultHasType(TestNSTokenFieldCellHelper.tokenFieldCell_styleForRepresentedObject_, objc._C_NSUInteger)
26
27if __name__ == "__main__":
28    main()
29