mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
bpo-30780: Add IDLE configdialog tests (#3592)
Expose dialog buttons to test code and complete their test coverage. Complete test coverage for highlights and keys tabs. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
2528a6c3d0
commit
dd023ad161
4 changed files with 149 additions and 31 deletions
|
@ -149,17 +149,19 @@ class ConfigDialog(Toplevel):
|
|||
else:
|
||||
padding_args = {'padding': (6, 3)}
|
||||
outer = Frame(self, padding=2)
|
||||
buttons = Frame(outer, padding=2)
|
||||
buttons_frame = Frame(outer, padding=2)
|
||||
self.buttons = {}
|
||||
for txt, cmd in (
|
||||
('Ok', self.ok),
|
||||
('Apply', self.apply),
|
||||
('Cancel', self.cancel),
|
||||
('Help', self.help)):
|
||||
Button(buttons, text=txt, command=cmd, takefocus=FALSE,
|
||||
**padding_args).pack(side=LEFT, padx=5)
|
||||
self.buttons[txt] = Button(buttons_frame, text=txt, command=cmd,
|
||||
takefocus=FALSE, **padding_args)
|
||||
self.buttons[txt].pack(side=LEFT, padx=5)
|
||||
# Add space above buttons.
|
||||
Frame(outer, height=2, borderwidth=0).pack(side=TOP)
|
||||
buttons.pack(side=BOTTOM)
|
||||
buttons_frame.pack(side=BOTTOM)
|
||||
return outer
|
||||
|
||||
def ok(self):
|
||||
|
@ -205,7 +207,6 @@ class ConfigDialog(Toplevel):
|
|||
|
||||
Attributes accessed:
|
||||
note
|
||||
|
||||
Methods:
|
||||
view_text: Method from textview module.
|
||||
"""
|
||||
|
@ -852,6 +853,7 @@ class HighPage(Frame):
|
|||
text.configure(
|
||||
font=('courier', 12, ''), cursor='hand2', width=1, height=1,
|
||||
takefocus=FALSE, highlightthickness=0, wrap=NONE)
|
||||
# Prevent perhaps invisible selection of word or slice.
|
||||
text.bind('<Double-Button-1>', lambda e: 'break')
|
||||
text.bind('<B1-Motion>', lambda e: 'break')
|
||||
string_tags=(
|
||||
|
@ -1284,8 +1286,7 @@ class HighPage(Frame):
|
|||
theme_name - string, the name of the new theme
|
||||
theme - dictionary containing the new theme
|
||||
"""
|
||||
if not idleConf.userCfg['highlight'].has_section(theme_name):
|
||||
idleConf.userCfg['highlight'].add_section(theme_name)
|
||||
idleConf.userCfg['highlight'].AddSection(theme_name)
|
||||
for element in theme:
|
||||
value = theme[element]
|
||||
idleConf.userCfg['highlight'].SetOption(theme_name, element, value)
|
||||
|
@ -1730,8 +1731,7 @@ class KeysPage(Frame):
|
|||
keyset_name - string, the name of the new key set
|
||||
keyset - dictionary containing the new keybindings
|
||||
"""
|
||||
if not idleConf.userCfg['keys'].has_section(keyset_name):
|
||||
idleConf.userCfg['keys'].add_section(keyset_name)
|
||||
idleConf.userCfg['keys'].AddSection(keyset_name)
|
||||
for event in keyset:
|
||||
value = keyset[event]
|
||||
idleConf.userCfg['keys'].SetOption(keyset_name, event, value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue