cpython: d90905960803 (original) (raw)

Mercurial > cpython

changeset 90892:d90905960803 3.4

Issue #21477: Add htests for GrepDialog, UndoDelegator, and configDialog. Put instructions in a fixed size scrollable Text. Patch by Saimadhav Heblikar. [#21477]

Terry Jan Reedy tjreedy@udel.edu
date Thu, 29 May 2014 01:46:26 -0400
parents 16f399588b2a
children 0eedac3d0b0a baa7b5555656
files Lib/idlelib/GrepDialog.py Lib/idlelib/ObjectBrowser.py Lib/idlelib/UndoDelegator.py Lib/idlelib/configDialog.py Lib/idlelib/idle_test/htest.py
diffstat 5 files changed, 108 insertions(+), 21 deletions(-)[+] [-] Lib/idlelib/GrepDialog.py 23 Lib/idlelib/ObjectBrowser.py 3 Lib/idlelib/UndoDelegator.py 21 Lib/idlelib/configDialog.py 17 Lib/idlelib/idle_test/htest.py 65

line wrap: on

line diff

--- a/Lib/idlelib/GrepDialog.py +++ b/Lib/idlelib/GrepDialog.py @@ -120,8 +120,31 @@ class GrepDialog(SearchDialogBase): self.top.grab_release() self.top.withdraw() +def _grep_dialog(parent):

+

+

+

+ if name == "main": # A human test is a bit tricky since EditorWindow() imports this module. # Hence Idle must be restarted after editing this file for a live test. import unittest unittest.main('idlelib.idle_test.test_grep', verbosity=2, exit=False) +

--- a/Lib/idlelib/ObjectBrowser.py +++ b/Lib/idlelib/ObjectBrowser.py @@ -126,8 +126,9 @@ def _object_browser(parent): import sys from tkinter import Tk root = Tk()

--- a/Lib/idlelib/UndoDelegator.py +++ b/Lib/idlelib/UndoDelegator.py @@ -336,17 +336,30 @@ class CommandSequence(Command): self.depth = self.depth + incr return self.depth -def main(): +def _undo_delegator(parent): from idlelib.Percolator import Percolator root = Tk()

+

+ root.mainloop() if name == "main":

--- a/Lib/idlelib/configDialog.py +++ b/Lib/idlelib/configDialog.py @@ -25,14 +25,19 @@ from idlelib import macosxSupport class ConfigDialog(Toplevel):

self.configure(borderwidth=5) self.title('IDLE Preferences')

@@ -1140,9 +1145,5 @@ class ConfigDialog(Toplevel): pass if name == 'main':

--- 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 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 @@ AboutDialog_spec = { "The default color scheme is in idlelib/config-highlight.def" } +ConfigDialog_spec = {

+ _dyn_option_menu_spec = { 'file': 'dynOptionMenuWidget', 'kwds': {}, @@ -121,6 +137,16 @@ GetKeysDialog_spec = { "entry is used." } +_grep_dialog_spec = {

+ _help_dialog_spec = { 'file': 'EditorWindow', 'kwds': {}, @@ -186,7 +212,7 @@ GetKeysDialog_spec = { 'kwds': {}, 'msg': "Click the 'Replace' button.\n" "Test various replace options in the 'Replace dialog'.\n"

+ _widget_redirector_spec = { 'file': 'WidgetRedirector', 'kwds': {}, @@ -256,6 +291,20 @@ TextViewer_spec = { def run(*tests): root = tk.Tk()

+

+ 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))

def run_test(): widget = callable_object(**test_kwds) @@ -296,8 +347,6 @@ def run(*tests): except AttributeError: pass