diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-29 05:46:26 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-29 05:46:26 (GMT) |
commit | 2e8234a5975a79773584220a8f4d61f5fc5cf8e9 (patch) | |
tree | 8437423a36234e530e2eee40d7c8a6e5846a1a40 /Lib/idlelib/idle_test/htest.py | |
parent | a5b257af22976b9fdeb1907f8d0c50ef9b97facb (diff) | |
download | cpython-2e8234a5975a79773584220a8f4d61f5fc5cf8e9.zip cpython-2e8234a5975a79773584220a8f4d61f5fc5cf8e9.tar.gz cpython-2e8234a5975a79773584220a8f4d61f5fc5cf8e9.tar.bz2 |
Issue #21477: Add htests for GrepDialog, UndoDelegator, and configDialog.
Put instructions in a fixed size scrollable Text. Patch by Saimadhav Heblikar.
Diffstat (limited to 'Lib/idlelib/idle_test/htest.py')
-rw-r--r-- | Lib/idlelib/idle_test/htest.py | 65 |
1 files changed, 57 insertions, 8 deletions
diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py index af9cb3d..2406c63 100644 --- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -31,6 +31,7 @@ msg: displayed in a master window. Hints as to how the user might test the widget. Close the window to skip or end the test. ''' from importlib import import_module +from idlelib.macosxSupport import _initializeTkVariantTests import tkinter as tk AboutDialog_spec = { @@ -67,6 +68,21 @@ _color_delegator_spec = { "The default color scheme is in idlelib/config-highlight.def" } +ConfigDialog_spec = { + 'file': 'configDialog', + 'kwds': {'title': 'Settings', + '_htest': True,}, + 'msg': "IDLE preferences dialog.\n" + "In the 'Fonts/Tabs' tab, changing font face, should update the " + "font face of the text in the area below it.\nIn the " + "'Highlighting' tab, try different color schemes. Clicking " + "items in the sample program should update the choices above it." + "\nIn the 'Keys' and 'General' tab, test settings of interest." + "\n[Ok] to close the dialog.[Apply] to apply the settings and " + "and [Cancel] to revert all changes.\nRe-run the test to ensure " + "changes made have persisted." + } + _dyn_option_menu_spec = { 'file': 'dynOptionMenuWidget', 'kwds': {}, @@ -121,6 +137,16 @@ GetKeysDialog_spec = { "entry is used." } +_grep_dialog_spec = { + 'file': 'GrepDialog', + 'kwds': {}, + 'msg': "Click the 'Show GrepDialog' button.\n" + "Test the various 'Find-in-files' functions.\n" + "The results should be displayed in a new '*Output*' window.\n" + "'Right-click'->'Goto file/line' anywhere in the search results " + "should open that file \nin a new EditorWindow." + } + _help_dialog_spec = { 'file': 'EditorWindow', 'kwds': {}, @@ -186,7 +212,7 @@ _replace_dialog_spec = { 'kwds': {}, 'msg': "Click the 'Replace' button.\n" "Test various replace options in the 'Replace dialog'.\n" - "Click [Close] or [X] to close to the 'Replace Dialog'." + "Click [Close] or [X] to close 'Replace Dialog'." } _search_dialog_spec = { @@ -194,7 +220,7 @@ _search_dialog_spec = { 'kwds': {}, 'msg': "Click the 'Search' button.\n" "Test various search options in the 'Search dialog'.\n" - "Click [Close] or [X] to close to the 'Search Dialog'." + "Click [Close] or [X] to close 'Search Dialog'." } _scrolled_list_spec = { @@ -247,6 +273,15 @@ _tree_widget_spec = { "Click on folders upto to the lowest level." } +_undo_delegator_spec = { + 'file': 'UndoDelegator', + 'kwds': {}, + 'msg': "Click [Undo] to undo any action.\n" + "Click [Redo] to redo any action.\n" + "Click [Dump] to dump the current state " + "by printing to the console or the IDLE shell.\n" + } + _widget_redirector_spec = { 'file': 'WidgetRedirector', 'kwds': {}, @@ -256,6 +291,20 @@ _widget_redirector_spec = { def run(*tests): root = tk.Tk() + root.title('IDLE htest') + root.resizable(0, 0) + _initializeTkVariantTests(root) + + # a scrollable Label like constant width text widget. + frameLabel = tk.Frame(root, padx=10) + frameLabel.pack() + text = tk.Text(frameLabel, wrap='word') + text.configure(bg=root.cget('bg'), relief='flat', height=4, width=70) + scrollbar = tk.Scrollbar(frameLabel, command=text.yview) + text.config(yscrollcommand=scrollbar.set) + scrollbar.pack(side='right', fill='y', expand=False) + text.pack(side='left', fill='both', expand=True) + test_list = [] # List of tuples of the form (spec, callable widget) if tests: for test in tests: @@ -272,22 +321,24 @@ def run(*tests): test = getattr(mod, test_name) test_list.append((test_spec, test)) - help_string = tk.StringVar('') test_name = tk.StringVar('') callable_object = None test_kwds = None - def next(): - nonlocal help_string, test_name, callable_object, test_kwds + + nonlocal test_name, callable_object, test_kwds if len(test_list) == 1: next_button.pack_forget() test_spec, callable_object = test_list.pop() test_kwds = test_spec['kwds'] test_kwds['parent'] = root - help_string.set(test_spec['msg']) test_name.set('Test ' + test_spec['name']) + text.configure(state='normal') # enable text editing + text.delete('1.0','end') + text.insert("1.0",test_spec['msg']) + text.configure(state='disabled') # preserve read-only property def run_test(): widget = callable_object(**test_kwds) @@ -296,8 +347,6 @@ def run(*tests): except AttributeError: pass - label = tk.Label(root, textvariable=help_string, justify='left') - label.pack() button = tk.Button(root, textvariable=test_name, command=run_test) button.pack() next_button = tk.Button(root, text="Next", command=next) |