wx Tests for horizontal and vertical mouse wheel event return values not matching that of Qt
- Dominant language
- C
- Stars
- 97
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
Currently there are a few test failures on the wx test suite, two of them look similar:
```
======================================================================
ERROR: test_horizontal_mouse_wheel (enable.tests.wx.mouse_wheel_test_case.MouseWheelTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/.edm/envs/enable-test-3.6-wx-pillow/lib/python3.6/site-packages/enable/tests/wx/mouse_wheel_test_case.py", line 72, in test_horizontal_mouse_wheel
wx_event = wx.MouseEvent(mouseType=wx.wxEVT_MOUSEWHEEL)
TypeError: MouseEvent(): arguments did not match any overloaded call:
overload 1: 'mouseType' is not a valid keyword argument
overload 2: 'mouseType' is not a valid keyword argument
======================================================================
ERROR: test_vertical_mouse_wheel (enable.tests.wx.mouse_wheel_test_case.MouseWheelTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/.edm/envs/enable-test-3.6-wx-pillow/lib/python3.6/site-packages/enable/tests/wx/mouse_wheel_test_case.py", line 54, in test_vertical_mouse_wheel
wx_event = wx.MouseEvent(mouseType=wx.wxEVT_MOUSEWHEEL)
TypeError: MouseEvent(): arguments did not match any overloaded call:
overload 1: 'mouseType' is not a valid keyword argument
overload 2: 'mouseType' is not a valid keyword argument
```
That is an easy fix. `MouseEvent` has changed its argument name to `mouseEventType`, so changing those lines to `wx_event = wx.MouseEvent(mouseEventType=wx.wxEVT_MOUSEWHEEL)` get pass the TypeError.
Subsequently, we get an error also seen when the test was modified in #302:
```
======================================================================
FAIL: test_horizontal_mouse_wheel (enable.tests.wx.mouse_wheel_test_case.MouseWheelTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/.edm/envs/enable-test-2.7-wx-pillow/lib/python2.7/site-packages/enable-4.7.1.dev15-py2.7-linux-x86_64.egg/enable/tests/wx/mouse_wheel_test_case.py", line 82, in test_horizontal_mouse_wheel
self.assertEqual(self.tool.event.mouse_wheel_delta, (200, 0))
AssertionError: != (200, 0)
======================================================================
FAIL: test_vertical_mouse_wheel (enable.tests.wx.mouse_wheel_test_case.MouseWheelTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/.edm/envs/enable-test-2.7-wx-pillow/lib/python2.7/site-packages/enable-4.7.1.dev15-py2.7-linux-x86_64.egg/enable/tests/wx/mouse_wheel_test_case.py", line 63, in test_vertical_mouse_wheel
self.assertEqual(self.tool.event.mouse_wheel_delta, (0, 200))
AssertionError: != (0, 200)
```
So there is no evidence there was a regression, it has already been like this.
The fix for `undefined` is also easy, we just need to assign the value for `mouse_wheel_delta` in the `MouseEvent` here:
https://github.com/enthought/enable/blob/55fc728baf4f1f8f6c94a833ed251962fa8cfd04/enable/wx/base_window.py#L354-L388
However, then the tests failed with these:
```
======================================================================
FAIL: test_horizontal_mouse_wheel (enable.tests.wx.mouse_wheel_test_case.MouseWheelTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/kchoi/Work/ETS/enable/enable/tests/wx/mouse_wheel_test_case.py", line 85, in test_horizontal_mouse_wheel
self.assertEqual(self.tool.event.mouse_wheel_delta, (200, 0))
AssertionError: Tuples differ: (1.0, 0) != (200, 0)
First differing element 0:
1.0
200
- (1.0, 0)
? ^^
+ (200, 0)
? ^^
======================================================================
FAIL: test_vertical_mouse_wheel (enable.tests.wx.mouse_wheel_test_case.MouseWheelTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/kchoi/Work/ETS/enable/enable/tests/wx/mouse_wheel_test_case.py", line 66, in test_vertical_mouse_wheel
self.assertEqual(self.tool.event.mouse_wheel_delta, (0, 200))
AssertionError: Tuples differ: (0, 1.0) != (0, 200)
First differing element 1:
1.0
200
- (0, 1.0)
? ^^
+ (0, 200)
```
`(0, 200)` and `(200, 0)` would match the tests for Qt. Not sure what went wrong here for the wx code.
Contributor guide
Assessment
This issue has not been assessed yet.