| 1 | # Based on iwidgets2.2.0/tests/messagedialog.test code. |
| 2 | |
| 3 | import Tkinter |
| 4 | import Test |
| 5 | import Pmw |
| 6 | |
| 7 | Test.initialise() |
| 8 | |
| 9 | c = Pmw.MessageDialog |
| 10 | |
| 11 | kw_1 = { |
| 12 | 'message_text' : 'Are you sure you want to do that?', |
| 13 | 'buttons' : ('OK', 'Cancel'), |
| 14 | 'icon_bitmap' : 'questhead', |
| 15 | 'iconmargin': '60', |
| 16 | 'iconpos' : 'w', |
| 17 | 'buttonbox_padx': 30, |
| 18 | } |
| 19 | tests_1 = ( |
| 20 | (Test.num_options, (), 13), |
| 21 | ('message_anchor', 'center'), |
| 22 | ('message_justify', 'center'), |
| 23 | ('message_wraplength', 0), |
| 24 | ('hull_background', '#d9d9d9'), |
| 25 | ('icon_bitmap', 'warning'), |
| 26 | ('hull_cursor', 'gumby'), |
| 27 | ('icon_image', Test.flagup), |
| 28 | ('message_font', Test.font['variable']), |
| 29 | ('message_foreground', 'red'), |
| 30 | ('message_padx', 15), |
| 31 | ('message_pady', 15), |
| 32 | ('icon_image', ''), |
| 33 | (c.title, 'MessageDialog 1: new title', ''), |
| 34 | (c.interior, (), Tkinter.Frame), |
| 35 | ('defaultbutton', 'OK'), |
| 36 | ) |
| 37 | |
| 38 | kw_2 = { |
| 39 | 'message_text' : 'On the left', |
| 40 | 'buttons' : ('OK', 'Cancel'), |
| 41 | 'buttonboxpos': 'e', |
| 42 | 'borderx': 55, |
| 43 | 'bordery': 55, |
| 44 | 'separatorwidth': 5, |
| 45 | } |
| 46 | tests_2 = ( |
| 47 | (c.title, 'MessageDialog 2', ''), |
| 48 | ) |
| 49 | |
| 50 | alltests = ( |
| 51 | (tests_1, kw_1), |
| 52 | (tests_2, kw_2), |
| 53 | ) |
| 54 | |
| 55 | testData = ((c, alltests),) |
| 56 | |
| 57 | if __name__ == '__main__': |
| 58 | Test.runTests(testData) |