3131 test the widget. Close the window to skip or end the test.
3232'''
3333from importlib import import_module
34+ from idlelib .macosxSupport import _initializeTkVariantTests
3435import tkinter as tk
3536
3637AboutDialog_spec = {
6768 "The default color scheme is in idlelib/config-highlight.def"
6869 }
6970
71+ ConfigDialog_spec = {
72+ 'file' : 'configDialog' ,
73+ 'kwds' : {'title' : 'Settings' ,
74+ '_htest' : True ,},
75+ 'msg' : "IDLE preferences dialog.\n "
76+ "In the 'Fonts/Tabs' tab, changing font face, should update the "
77+ "font face of the text in the area below it.\n In the "
78+ "'Highlighting' tab, try different color schemes. Clicking "
79+ "items in the sample program should update the choices above it."
80+ "\n In the 'Keys' and 'General' tab, test settings of interest."
81+ "\n [Ok] to close the dialog.[Apply] to apply the settings and "
82+ "and [Cancel] to revert all changes.\n Re-run the test to ensure "
83+ "changes made have persisted."
84+ }
85+
7086_dyn_option_menu_spec = {
7187 'file' : 'dynOptionMenuWidget' ,
7288 'kwds' : {},
121137 "entry is used."
122138 }
123139
140+ _grep_dialog_spec = {
141+ 'file' : 'GrepDialog' ,
142+ 'kwds' : {},
143+ 'msg' : "Click the 'Show GrepDialog' button.\n "
144+ "Test the various 'Find-in-files' functions.\n "
145+ "The results should be displayed in a new '*Output*' window.\n "
146+ "'Right-click'->'Goto file/line' anywhere in the search results "
147+ "should open that file \n in a new EditorWindow."
148+ }
149+
124150_help_dialog_spec = {
125151 'file' : 'EditorWindow' ,
126152 'kwds' : {},
186212 'kwds' : {},
187213 'msg' : "Click the 'Replace' button.\n "
188214 "Test various replace options in the 'Replace dialog'.\n "
189- "Click [Close] or [X] to close to the 'Replace Dialog'."
215+ "Click [Close] or [X] to close 'Replace Dialog'."
190216 }
191217
192218_search_dialog_spec = {
193219 'file' : 'SearchDialog' ,
194220 'kwds' : {},
195221 'msg' : "Click the 'Search' button.\n "
196222 "Test various search options in the 'Search dialog'.\n "
197- "Click [Close] or [X] to close to the 'Search Dialog'."
223+ "Click [Close] or [X] to close 'Search Dialog'."
198224 }
199225
200226_scrolled_list_spec = {
247273 "Click on folders upto to the lowest level."
248274 }
249275
276+ _undo_delegator_spec = {
277+ 'file' : 'UndoDelegator' ,
278+ 'kwds' : {},
279+ 'msg' : "Click [Undo] to undo any action.\n "
280+ "Click [Redo] to redo any action.\n "
281+ "Click [Dump] to dump the current state "
282+ "by printing to the console or the IDLE shell.\n "
283+ }
284+
250285_widget_redirector_spec = {
251286 'file' : 'WidgetRedirector' ,
252287 'kwds' : {},
256291
257292def run (* tests ):
258293 root = tk .Tk ()
294+ root .title ('IDLE htest' )
295+ root .resizable (0 , 0 )
296+ _initializeTkVariantTests (root )
297+
298+ # a scrollable Label like constant width text widget.
299+ frameLabel = tk .Frame (root , padx = 10 )
300+ frameLabel .pack ()
301+ text = tk .Text (frameLabel , wrap = 'word' )
302+ text .configure (bg = root .cget ('bg' ), relief = 'flat' , height = 4 , width = 70 )
303+ scrollbar = tk .Scrollbar (frameLabel , command = text .yview )
304+ text .config (yscrollcommand = scrollbar .set )
305+ scrollbar .pack (side = 'right' , fill = 'y' , expand = False )
306+ text .pack (side = 'left' , fill = 'both' , expand = True )
307+
259308 test_list = [] # List of tuples of the form (spec, callable widget)
260309 if tests :
261310 for test in tests :
@@ -272,22 +321,24 @@ def run(*tests):
272321 test = getattr (mod , test_name )
273322 test_list .append ((test_spec , test ))
274323
275- help_string = tk .StringVar ('' )
276324 test_name = tk .StringVar ('' )
277325 callable_object = None
278326 test_kwds = None
279327
280-
281328 def next ():
282- nonlocal help_string , test_name , callable_object , test_kwds
329+
330+ nonlocal test_name , callable_object , test_kwds
283331 if len (test_list ) == 1 :
284332 next_button .pack_forget ()
285333 test_spec , callable_object = test_list .pop ()
286334 test_kwds = test_spec ['kwds' ]
287335 test_kwds ['parent' ] = root
288- help_string .set (test_spec ['msg' ])
289336 test_name .set ('Test ' + test_spec ['name' ])
290337
338+ text .configure (state = 'normal' ) # enable text editing
339+ text .delete ('1.0' ,'end' )
340+ text .insert ("1.0" ,test_spec ['msg' ])
341+ text .configure (state = 'disabled' ) # preserve read-only property
291342
292343 def run_test ():
293344 widget = callable_object (** test_kwds )
@@ -296,8 +347,6 @@ def run_test():
296347 except AttributeError :
297348 pass
298349
299- label = tk .Label (root , textvariable = help_string , justify = 'left' )
300- label .pack ()
301350 button = tk .Button (root , textvariable = test_name , command = run_test )
302351 button .pack ()
303352 next_button = tk .Button (root , text = "Next" , command = next )
0 commit comments