Kaydet (Commit) faaf16b8 authored tarafından Terry Jan Reedy's avatar Terry Jan Reedy

Issue #25507: move test-specific imports to test function (idlelib.IOBinding).

üst a05c4130
...@@ -5,21 +5,18 @@ ...@@ -5,21 +5,18 @@
# end-of-line conventions, instead of relying on the standard library, # end-of-line conventions, instead of relying on the standard library,
# which will only understand the local convention. # which will only understand the local convention.
import codecs
from codecs import BOM_UTF8
import os import os
import pipes import pipes
import re
import sys import sys
import codecs
import tempfile import tempfile
import tkFileDialog import tkFileDialog
import tkMessageBox import tkMessageBox
import re
from Tkinter import *
from SimpleDialog import SimpleDialog from SimpleDialog import SimpleDialog
from idlelib.configHandler import idleConf
from codecs import BOM_UTF8
# Try setting the locale, so that we can find out # Try setting the locale, so that we can find out
# what encoding to use # what encoding to use
try: try:
...@@ -567,8 +564,12 @@ class IOBinding: ...@@ -567,8 +564,12 @@ class IOBinding:
"Update recent file list on all editor windows" "Update recent file list on all editor windows"
self.editwin.update_recent_files_list(filename) self.editwin.update_recent_files_list(filename)
def _io_binding(parent): # htest # def _io_binding(parent): # htest #
root = Tk() from Tkinter import Toplevel, Text
from idlelib.configHandler import idleConf
root = Toplevel(parent)
root.title("Test IOBinding") root.title("Test IOBinding")
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
root.geometry("+%d+%d"%(x, y + 150)) root.geometry("+%d+%d"%(x, y + 150))
...@@ -585,6 +586,7 @@ def _io_binding(parent): # htest # ...@@ -585,6 +586,7 @@ def _io_binding(parent): # htest #
self.text.event_generate("<<open-window-from-file>>") self.text.event_generate("<<open-window-from-file>>")
def save(self, event): def save(self, event):
self.text.event_generate("<<save-window>>") self.text.event_generate("<<save-window>>")
def update_recent_files_list(s, f): pass
text = Text(root) text = Text(root)
text.pack() text.pack()
......
...@@ -189,9 +189,11 @@ _grep_dialog_spec = { ...@@ -189,9 +189,11 @@ _grep_dialog_spec = {
_io_binding_spec = { _io_binding_spec = {
'file': 'IOBinding', 'file': 'IOBinding',
'kwds': {}, 'kwds': {},
'msg': "Test the following bindings\n" 'msg': "Test the following bindings.\n"
"<Control-o> to display open window from file dialog.\n" "<Control-o> to open file from dialog.\n"
"<Control-s> to save the file\n" "Edit the file.\n"
"<Control-s> to save the file.\n"
"Check that changes were saved by opening the file elsewhere."
} }
_multi_call_spec = { _multi_call_spec = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment