diff options
author | Ian Chen <ian.1.chen@nokia.com> | 2012-07-06 11:44:11 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-06 05:59:56 +0200 |
commit | cb91ea1d770e580ceb0287362154230060461c46 (patch) | |
tree | 0b26f9e4a66244ff762ae3116452ee0f76bc6e0d /tests | |
parent | b663a134285e0409d3bc90910ae6f4cf27d0b61c (diff) | |
download | qtlocation-cb91ea1d770e580ceb0287362154230060461c46.tar.gz |
Fix mouse wheel event handling and test
Task-number: QTBUG-26431
Change-Id: I5a04a7b62fd37aa87cae79ac2fb847ccf4fdeff1
Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative_ui/tst_map_mouse.qml | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/tests/auto/declarative_ui/tst_map_mouse.qml b/tests/auto/declarative_ui/tst_map_mouse.qml index 13d3a715..eb715fb6 100644 --- a/tests/auto/declarative_ui/tst_map_mouse.qml +++ b/tests/auto/declarative_ui/tst_map_mouse.qml @@ -106,8 +106,12 @@ Item { center: mapDefaultCenter plugin: testPlugin; - property real lastWheelDelta: 0 - onWheel: lastWheelDelta = delta + property real lastWheelAngleDeltaX: 0 + property real lastWheelAngleDeltaY: 0 + onWheelAngleChanged: { + lastWheelAngleDeltaX = angleDelta.x; + lastWheelAngleDeltaY = angleDelta.y; + } MapMouseArea { id: mouseUpper @@ -205,10 +209,11 @@ Item { SignalSpy {id: mouseOverlapperEnabledChangedSpy; target: mouseOverlapper; signalName: "enabledChanged"} - SignalSpy {id: mapWheelSpy; target: map; signalName: "wheel"} + SignalSpy {id: mapWheelSpy; target: map; signalName: "wheelAngleChanged"} function clear_data() { - map.lastWheelDelta = 0 + map.lastWheelAngleDeltaX = 0 + map.lastWheelAngleDeltaY = 0 mouseUpperClickedSpy.clear() mouseLowerClickedSpy.clear() mouseOverlapperClickedSpy.clear() @@ -298,24 +303,27 @@ Item { } function test_wheel() { - skip("Test currently broken, see QTBUG-26431"); clear_data() wait(500); // on map but without mouse area - mouseWheel(map, 5, 5, 15, Qt.LeftButton, Qt.NoModifiers) + mouseWheel(map, 5, 5, 15, 5, Qt.LeftButton, Qt.NoModifiers) compare(mapWheelSpy.count, 1) - compare(map.lastWheelDelta, 15) - mouseWheel(map, 5, 5, -15, Qt.LeftButton, Qt.NoModifiers) + compare(map.lastWheelAngleDeltaX, 15) + compare(map.lastWheelAngleDeltaY, 5) + mouseWheel(map, 5, 5, -15, -5, Qt.LeftButton, Qt.NoModifiers) compare(mapWheelSpy.count, 2) - compare(map.lastWheelDelta, -15) + compare(map.lastWheelAngleDeltaX, -15) + compare(map.lastWheelAngleDeltaY, -5) // on map on top of mouse area - mouseWheel(map, 55, 75, -30, Qt.LeftButton, Qt.NoModifiers) + mouseWheel(map, 55, 75, -30, -2, Qt.LeftButton, Qt.NoModifiers) compare(mapWheelSpy.count, 3) - compare(map.lastWheelDelta, -30) + compare(map.lastWheelAngleDeltaX, -30) + compare(map.lastWheelAngleDeltaY, -2) // outside of map - mouseWheel(map, -100, -100, 30, Qt.LeftButton, Qt.NoModifiers) + mouseWheel(map, -100, -100, 40, 4, Qt.LeftButton, Qt.NoModifiers) compare(mapWheelSpy.count, 3) - compare(map.lastWheelDelta, -30) + compare(map.lastWheelAngleDeltaX, -30) + compare(map.lastWheelAngleDeltaY, -2) } function test_aaa_basic_properties() // _aaa_ to ensure execution first |