1from PyObjCTools.TestSupport import * 2 3import Foundation 4 5try: 6 unicode 7except NameError: 8 unicode = str 9 10class UserNotificationHelper (Foundation.NSObject): 11 def userNotificationCenter_shouldPresentNotification_(self, a, b): pass 12 13 14class TestNSUserNotification (TestCase): 15 @min_os_level('10.8') 16 def testConstants10_8(self): 17 self.assertEqual(Foundation.NSUserNotificationActivationTypeNone, 0) 18 self.assertEqual(Foundation.NSUserNotificationActivationTypeContentsClicked, 1) 19 self.assertEqual(Foundation.NSUserNotificationActivationTypeActionButtonClicked, 2) 20 21 self.assertIsInstance(Foundation.NSUserNotificationDefaultSoundName, unicode) 22 23 @min_os_level('10.8') 24 def testMethods10_8(self): 25 obj = Foundation.NSUserNotification.alloc().init() 26 self.assertResultIsBOOL(obj.isPresented) 27 self.assertResultIsBOOL(obj.isRemote) 28 self.assertResultIsBOOL(obj.hasActionButton) 29 self.assertArgIsBOOL(obj.setHasActionButton_, 0) 30 31 @min_os_level('10.8') 32 def testProtocol10_8(self): 33 self.assertResultIsBOOL(UserNotificationHelper.userNotificationCenter_shouldPresentNotification_) 34 35if __name__ == "__main__": 36 main() 37