classification
Title: IDLE: configdialog - add tests for ConfigDialog GUI.
Type: enhancement Stage: patch review
Components: IDLE Versions: Python 3.7, Python 3.6
process
Status: open Resolution:
Dependencies: 30779 30870 30981 30993 31001 31002 31003 31287 31414 Superseder:
Assigned To: terry.reedy Nosy List: csabella, louielu, terry.reedy
Priority: normal Keywords: patch

Created on 2017-06-26 22:38 by terry.reedy, last changed 2017-11-29 03:43 by terry.reedy.

Pull Requests
URL Status Linked Edit
PR 2606 merged terry.reedy, 2017-07-06 19:45
PR 2613 merged terry.reedy, 2017-07-07 03:04
PR 2046 csabella, 2017-08-27 06:04
PR 3222 closed csabella, 2017-08-27 21:33
PR 3238 csabella, 2017-09-11 02:40
PR 3592 open csabella, 2017-09-14 23:29
Messages (15)
msg296963 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-26 22:38
A complete test of the GUI  will simulate user interaction with every widget and then query Changes() to see that the proper changes orders have been recorded.

This issue depends on #30779, factor out Changes class.
msg297016 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-27 06:54
Tests should be tested on MacOS before being pushed.  A possible issue is including constants that are different on different systems.  See #28572
msg297247 - (view) Author: Louie Lu (louielu) * Date: 2017-06-29 03:18
I'm trying to add the test on configdialog, currently working on KeysTest.
msg297250 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-29 03:35
Proceed as you want.  Keep in mind that the interface to the changes structure will be changed by #30779.  The testing logic should not be, however.
msg297838 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-07-06 19:46
PR to fix type in moduleTearDown.
msg297852 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-07-07 02:19
New changeset 25a4206c243e3b1fa6f5b1c72a11b409b007694d by terryjreedy in branch 'master':
bpo-30780: Fix error in idlelib.test_idle.test_configdialog (#2606)
https://github.com/python/cpython/commit/25a4206c243e3b1fa6f5b1c72a11b409b007694d
msg297853 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-07-07 02:46
I posted PR 2612 for #30779 and expect to merge it tomorrow after sleep and final review.  It includes passing revisions of existing configdialog tests.  A PR dependent on 2612 could be posted before I do the merge.

Follow the model of using xyzpage names in asserts and tests would survive the refactoring of ConfigChanges discussed as a possibility on #30779.  I want to move forward on this, but not duplicate your work, so please post work done and immediate plans.
msg297855 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-07-07 03:16
New changeset df0f99329843c10701ffaefbd3948ac698c12220 by terryjreedy in branch '3.6':
[3.6] bpo-30780: Fix error in idlelib.test_idle.test_configdialog (GH-2606) (#2613)
https://github.com/python/cpython/commit/df0f99329843c10701ffaefbd3948ac698c12220
msg300906 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-08-26 20:15
This issue is almost done.  There are just a few things missed by the closed dependencies.
msg300922 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-08-27 19:29
#31001 and #31002 have notes on what not tested in HighPage and KeysPage.
msg301037 - (view) Author: Cheryl Sabella (csabella) * Date: 2017-08-30 22:30
I've started working on the missing tests for HighPage and KeysPage and also test for the functions and buttons in ConfigDialog.  That led to PR3238 because the 'help' button wasn't working.

Anyway, I found the following on http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm:

"An easier solution is to prevent Tkinter from propagating the event to other handlers; just return the string “break” from your event handler:

def ignore(event):
    return "break"
text.bind("<Return>", ignore)
or

text.bind("<Return>", lambda e: "break")"

So, it seems that the 'Double-Button-1' and 'B1-Motion' bindings are to prevent those events from propagating outside of the widget.  Although, I didn't notice a difference when I commented them out, so maybe they don't have a higher level binding.
msg301849 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-09-11 02:46
I just pushed the extension conversion patch.  The tests we did already were greatly helpful, and some tests not done or inadequate hindered.  I am now looking to polish configdialog before 3.6.3.  If you have anything worth a new issue and PR, I will be ready to review.
msg302171 - (view) Author: Cheryl Sabella (csabella) * Date: 2017-09-14 13:50
Sorry I don't have any tests yet.  I've added a few, but it's taking me forever to figure out the bindings for testing the `Double-Button-1` and `B1-Motion`.  I actually have a test for `Double-Button-1` now, but still working on `B1-Motion`.
msg302225 - (view) Author: Cheryl Sabella (csabella) * Date: 2017-09-14 23:42
I've submitted a PR for the tests that I added to complete coverage for Keys and Highlights and to add some GUI tests for the buttons.  It's not everything that I wanted to do, but it ended up being more substantial than I realized.

Here's the issue I was having with testing `Double-Button-1` and `B1-Motion`.  After the first ButtonPress and ButtonRelease, the second (or later) event-generate always looked like it was a double click (it probably was really a triple click or higher, depending how many times I tried it).  I tried everything I could think of or find online, but I couldn't find how to reset the counts to start over and make it think it was a just `ButtonPress` and not a `Double-Button`.  

This was OK for the testing on `Double-Button`, but it was causing the `B1-Motion` not to work because it was not seeing each 'movement' as a press/move/release, but rather a double-button/move/release.  It was OK because the Double also invokes the Press callback, however, since the Double event was bound to `break`, it didn't allow the text to be selected. (The difference between `Double` and `B1-Motion` is that Double selects a word and B1-Motion selects where the mouse moves).

I played with it in IDLE and I could reset the Press by doing an event-generate on a different (x, y), but that didn't work in the test.  I tried a delay and it still didn't fix it.

Anyway, I've learned a lot about mouse binding while working on this, but without a solution, I cheated and just did ButtonPress on a different (x, y) for the second test.

Sorry about the rambling, but I'd love to know the trick to resetting the number of button presses in a test.
msg307206 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-11-29 03:43
Review of overview:
PR-2706 and PR-2613 fixed one line in test_configdialog for this issue.
PR-2046, #30617 and PR-3238, #30781 are merged cross-references.
PR-3222 was closed in favor of PR-3220, #31287, merged.

PR-3592 completes highlights and keys coverage and needs my review after getting lost in the flurry of PRs.

Dependency #31414 has merged PRs.  I should review, close, or indicate what is left to do.

Other dependencies are closed and I believe this should be after handling above 2 items.
History
Date User Action Args
2017-11-29 03:43:48terry.reedysetmessages: + msg307206
2017-09-14 23:42:41csabellasetmessages: + msg302225
2017-09-14 23:29:57csabellasetpull_requests: + pull_request3583
2017-09-14 13:50:25csabellasetmessages: + msg302171
2017-09-11 03:18:11terry.reedysetdependencies: + IDLE: Entry tests should delete before insert.
2017-09-11 02:46:26terry.reedysetmessages: + msg301849
2017-09-11 02:40:00csabellasetkeywords: + patch
stage: test needed -> patch review
pull_requests: + pull_request3480
2017-09-02 03:38:08terry.reedyunlinkissue27099 dependencies
2017-08-30 22:30:11csabellasetmessages: + msg301037
2017-08-27 21:33:41csabellasetpull_requests: + pull_request3264
2017-08-27 19:29:08terry.reedysetmessages: + msg300922
2017-08-27 19:26:31terry.reedysetnosy: + csabella
dependencies: + IDLE configdialog tests: don't modify tkinter.messagebox.
2017-08-27 06:04:40csabellasetpull_requests: + pull_request3255
2017-08-26 20:15:49terry.reedysetmessages: + msg300906
2017-08-26 20:14:28terry.reedyunlinkissue30781 dependencies
2017-07-24 08:05:37terry.reedysetdependencies: + IDLE: Add tests for configdialog highlight tab, IDLE: Add tests for configdialog keys tab, IDLE: Add tests for help sources on configdialog general tab
2017-07-22 19:34:38terry.reedysetdependencies: + IDLE: Document, fix, and complete configdialog font tests
2017-07-21 03:17:13terry.reedysetdependencies: + IDLE: Test config dialog font bold button and sample change
2017-07-10 19:15:04terry.reedyunlinkissue30851 dependencies
2017-07-10 18:47:55terry.reedysetdependencies: + IDLE: configdialog/fonts: change font when select by key up/down
2017-07-07 03:16:33terry.reedysetmessages: + msg297855
2017-07-07 03:04:41terry.reedysetpull_requests: + pull_request2678
2017-07-07 02:46:49terry.reedysetmessages: + msg297853
2017-07-07 02:19:15terry.reedysetmessages: + msg297852
2017-07-06 19:46:44terry.reedysetmessages: + msg297838
2017-07-06 19:45:57terry.reedysetpull_requests: + pull_request2673
2017-07-05 01:26:11terry.reedylinkissue30851 dependencies
2017-06-30 22:38:18terry.reedylinkissue27099 dependencies
2017-06-29 03:35:36terry.reedysetmessages: + msg297250
2017-06-29 03:18:05louielusetnosy: + louielu
messages: + msg297247
2017-06-27 06:54:35terry.reedysetmessages: + msg297016
2017-06-27 00:46:41terry.reedylinkissue30728 dependencies
2017-06-26 22:47:38terry.reedylinkissue30781 dependencies
2017-06-26 22:39:41terry.reedysetassignee: terry.reedy
dependencies: + IDLE: configdialog -- factor out Changes class
components: + IDLE
2017-06-26 22:38:31terry.reedycreate