1 2from PyObjCTools.TestSupport import * 3from AppKit import * 4 5try: 6 unicode 7except NameError: 8 unicode = str 9 10class TestNSToolbarItemHelper (NSObject): 11 def validateToolbarItem_(self, a): return 12 13class TestNSToolbarItem (TestCase): 14 def testConstants(self): 15 self.assertEqual(NSToolbarItemVisibilityPriorityStandard, 0) 16 self.assertEqual(NSToolbarItemVisibilityPriorityLow, -1000) 17 self.assertEqual(NSToolbarItemVisibilityPriorityHigh, 1000) 18 self.assertEqual(NSToolbarItemVisibilityPriorityUser, 2000) 19 20 self.assertIsInstance(NSToolbarSeparatorItemIdentifier, unicode) 21 self.assertIsInstance(NSToolbarSpaceItemIdentifier, unicode) 22 self.assertIsInstance(NSToolbarFlexibleSpaceItemIdentifier, unicode) 23 self.assertIsInstance(NSToolbarShowColorsItemIdentifier, unicode) 24 self.assertIsInstance(NSToolbarShowFontsItemIdentifier, unicode) 25 self.assertIsInstance(NSToolbarCustomizeToolbarItemIdentifier, unicode) 26 self.assertIsInstance(NSToolbarPrintItemIdentifier, unicode) 27 28 def testMethods(self): 29 self.assertResultIsBOOL(NSToolbarItem.isEnabled) 30 self.assertArgIsBOOL(NSToolbarItem.setEnabled_, 0) 31 self.assertResultIsBOOL(NSToolbarItem.autovalidates) 32 self.assertArgIsBOOL(NSToolbarItem.setAutovalidates_, 0) 33 self.assertResultIsBOOL(NSToolbarItem.allowsDuplicatesInToolbar) 34 35 def testProtocols(self): 36 self.assertResultIsBOOL(TestNSToolbarItemHelper.validateToolbarItem_) 37 38 39if __name__ == "__main__": 40 main() 41