| 1 | # Based on iwidgets2.2.0/tests/promptdialog.test code. |
| 2 | |
| 3 | import Tkinter |
| 4 | import Test |
| 5 | import Pmw |
| 6 | |
| 7 | Test.initialise() |
| 8 | |
| 9 | c = Pmw.PromptDialog |
| 10 | |
| 11 | kw_1 = { |
| 12 | 'entryfield_labelpos': 'n', |
| 13 | 'label_text' : 'Please enter your password', |
| 14 | 'buttons' : ('OK', 'Cancel', 'Help'), |
| 15 | } |
| 16 | tests_1 = ( |
| 17 | (Test.num_options, (), 11), |
| 18 | (c.title, 'PromptDialog 1', ''), |
| 19 | ('hull_background', '#d9d9d9'), |
| 20 | ('hull_cursor', 'gumby'), |
| 21 | ('entry_exportselection', 1), |
| 22 | ('entry_foreground', 'Black'), |
| 23 | ('entry_background', 'GhostWhite'), |
| 24 | ('entry_insertbackground', 'Black'), |
| 25 | ('entry_insertborderwidth', 1), |
| 26 | ('entry_insertborderwidth', 0), |
| 27 | ('entry_insertofftime', 400), |
| 28 | ('entry_insertontime', 700), |
| 29 | ('entry_insertwidth', 3), |
| 30 | ('label_text', 'Label'), |
| 31 | ('entry_justify', 'left'), |
| 32 | ('entry_relief', 'sunken'), |
| 33 | ('entry_state', 'disabled'), |
| 34 | ('entry_state', 'normal'), |
| 35 | ('entry_background', 'GhostWhite'), |
| 36 | ('entryfield_validate', 'numeric'), |
| 37 | ('entryfield_validate', 'alphabetic'), |
| 38 | ('entryfield_validate', 'alphanumeric'), |
| 39 | ('entry_width', 30), |
| 40 | (c.interior, (), Tkinter.Frame), |
| 41 | (c.insertentry, ('end', 'Test String')), |
| 42 | (c.get, (), 'Test String'), |
| 43 | (c.deleteentry, (0, 'end')), |
| 44 | (c.insertentry, ('end', 'Another Test')), |
| 45 | (c.icursor, 'end'), |
| 46 | (c.indexentry, 'end', 12), |
| 47 | (c.selection_from, 0), |
| 48 | (c.selection_to, 'end'), |
| 49 | (c.xview, 3), |
| 50 | (c.clear, ()), |
| 51 | (c.get, (), ''), |
| 52 | ('label_bitmap', 'warning'), |
| 53 | ('label_image', Test.flagup), |
| 54 | ('entry_font', Test.font['variable']), |
| 55 | ('entry_foreground', 'red'), |
| 56 | ('label_image', ''), |
| 57 | ('label_bitmap', ''), |
| 58 | (c.title, 'PromptDialog 1: new title', ''), |
| 59 | ('defaultbutton', 'OK'), |
| 60 | ) |
| 61 | |
| 62 | kw_2 = { |
| 63 | 'buttonboxpos': 'e', |
| 64 | 'entryfield_labelpos': 'w', |
| 65 | 'label_text' : 'Please enter your password', |
| 66 | 'buttonbox_pady': 25, |
| 67 | 'buttons' : ('OK', 'Cancel'), |
| 68 | } |
| 69 | tests_2 = ( |
| 70 | (c.title, 'PromptDialog 2', ''), |
| 71 | ) |
| 72 | |
| 73 | alltests = ( |
| 74 | (tests_1, kw_1), |
| 75 | (tests_2, kw_2), |
| 76 | ) |
| 77 | |
| 78 | testData = ((c, alltests),) |
| 79 | |
| 80 | if __name__ == '__main__': |
| 81 | Test.runTests(testData) |