Add dclick option to test assistant#444
Conversation
| test_assistant = EnableTestAssistant() | ||
| component = Component(bounds=[100, 200]) | ||
| component.normal_left_dclick = mock.Mock() | ||
| test_assistant.mouse_down(component, x=0, y=0, dclick=True) |
There was a problem hiding this comment.
Instead of adding a flag for mouse_down, what do you think about having a separate method altogether?
Part of that is because Mouse Down != Mouse Click. Mouse Click includes both pressing the mouse down and releasing it at the same place. With mouse down and mouse release separated, one can, for example, test pressing the mouse somewhere, hold it, and then release it elsewhere. This would be what happens in a drag-and-drop action.
Double clicking a mouse key is a very different command: It involves system settings e.g. how quick two successive clicks should be considered as one double click event.
There was a problem hiding this comment.
Yea, that makes sense.
Codecov Report
@@ Coverage Diff @@
## master #444 +/- ##
==========================================
+ Coverage 28.92% 28.95% +0.02%
==========================================
Files 206 206
Lines 18246 18252 +6
Branches 2466 2466
==========================================
+ Hits 5278 5284 +6
Misses 12641 12641
Partials 327 327
Continue to review full report at Codecov.
|
kitchoi
left a comment
There was a problem hiding this comment.
LGTM. Thank you for the addition!
(I am not an enable expert so it might be good to have a second pair of eyes on this.)
| 'alt_down': alt_down, | ||
| 'control_down': control_down, | ||
| 'shift_down': shift_down, | ||
| '{0}_down'.format(button): True, |
There was a problem hiding this comment.
It took me a while to understand if this "left_down" or "right_down" was necessary... I think it could potentially be handled by the window to change focus, so it makes sense to keep.
There was a problem hiding this comment.
Whether or not it necessary, what matters is whether the generated event has the same features of the events which are generated by the backends, eg.
enable/enable/qt4/base_window.py
Lines 456 to 458 in 854778d
This doesn't allow generation of chorded double-click events, but that's probably for the best 😄
| component.normal_left_dclick.assert_called_once() | ||
|
|
||
|
|
||
| @skipIf(ETSConfig.toolkit == "null", "Skipping null tookit") |
There was a problem hiding this comment.
Not happy about this change.
corranwebster
left a comment
There was a problem hiding this comment.
Approved.
But can we please have a public base-level testing module which has standard implementations for toolkit skip checks. I am unhappy about the amount of code replication that occurs when we don't have that.
I'd propose handling this separately - it is orthogonal to this PR. |
dclickoption toEnableTestAssistant.mouse_downEnableTestAssistant.mouse_downCloses #438