diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-27 07:30:54 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-27 07:30:54 (GMT) |
commit | 0a4d13e87e0272085ed920b284f7245f01137cb3 (patch) | |
tree | ed71eb2dca6a3e61b9cc76f065bbcaea44ca25a6 /Lib/idlelib/ReplaceDialog.py | |
parent | aa7886dd3fd56f02a4f5ef239c869e97cbde4a57 (diff) | |
download | cpython-0a4d13e87e0272085ed920b284f7245f01137cb3.zip cpython-0a4d13e87e0272085ed920b284f7245f01137cb3.tar.gz cpython-0a4d13e87e0272085ed920b284f7245f01137cb3.tar.bz2 |
Issue #21477: Add htests for Search and Replace dialogs.
Patch by Saimadhav Heblikar.
Diffstat (limited to 'Lib/idlelib/ReplaceDialog.py')
-rw-r--r-- | Lib/idlelib/ReplaceDialog.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Lib/idlelib/ReplaceDialog.py b/Lib/idlelib/ReplaceDialog.py index e73f2c5..ffa97a2 100644 --- a/Lib/idlelib/ReplaceDialog.py +++ b/Lib/idlelib/ReplaceDialog.py @@ -188,3 +188,34 @@ class ReplaceDialog(SearchDialogBase): def close(self, event=None): SearchDialogBase.close(self, event) self.text.tag_remove("hit", "1.0", "end") + +def _replace_dialog(parent): + root = Tk() + root.title("Test ReplaceDialog") + width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) + root.geometry("+%d+%d"%(x, y + 150)) + + # mock undo delegator methods + def undo_block_start(): + pass + + def undo_block_stop(): + pass + + text = Text(root) + text.undo_block_start = undo_block_start + text.undo_block_stop = undo_block_stop + text.pack() + text.insert("insert","This is a sample string.\n"*10) + + def show_replace(): + text.tag_add(SEL, "1.0", END) + replace(text) + text.tag_remove(SEL, "1.0", END) + + button = Button(root, text="Replace", command=show_replace) + button.pack() + +if __name__ == '__main__': + from idlelib.idle_test.htest import run + run(_replace_dialog) |