1from PyObjCTools.TestSupport import *
2from AppKit import *
3
4# Would like some tests for NSRunAlertPanel and friends as well, but those
5# require user interaction :-(
6
7class TestAlertFormat (TestCase):
8    def testSimple(self):
9        alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
10                "message text", "ok", "cancel", "help", "foobar is the sucks")
11        self.assertEquals(alert.messageText(), "message text")
12        self.assertEquals(alert.informativeText(), "foobar is the sucks")
13
14    def testWithFormat(self):
15        alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
16                "message text", "ok", "cancel", "help", "%d * %d = %d", 9, 7, 9*7)
17        self.assertEquals(alert.messageText(), "message text")
18        self.assertEquals(alert.informativeText(), "9 * 7 = 63")
19
20if __name__ == "__main__":
21    main()
22