diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-10-15 09:34:11 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-10-17 09:53:25 +0000 |
commit | ed7521d27cbba69196870005c9d97129a6d7b781 (patch) | |
tree | 725f6b3c253a51873547af384eba6a4246527af7 /tests/auto/controls | |
parent | b32cd6480c332ca14e472d7e164914c7d3f7aaa5 (diff) |
Clear hover when moved outside while pressing
As noticed in QTBUG-56269, QEvent::HoverLeave is not sent while there
is an active mouse grabber item. Therefore we must hit test move events
to figure out if the control is still effectively hovered.
Task-number: QTBUG-56556
Change-Id: I8a5e3dbd77375aace7fc5594e4315288304d852f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls')
-rw-r--r-- | tests/auto/controls/data/tst_control.qml | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/auto/controls/data/tst_control.qml b/tests/auto/controls/data/tst_control.qml index 9ecbed93..3018498e 100644 --- a/tests/auto/controls/data/tst_control.qml +++ b/tests/auto/controls/data/tst_control.qml @@ -847,8 +847,15 @@ TestCase { compare(control.mirroredspy_5.count, 1) } - function test_hover() { - var control = component.createObject(testCase, {width: 100, height: 100}) + function test_hover_data() { + return [ + { tag: "normal", target: component, pressed: false }, + { tag: "pressed", target: button, pressed: true } + ] + } + + function test_hover(data) { + var control = data.target.createObject(testCase, {width: 100, height: 100}) verify(control) compare(control.hovered, false) @@ -862,9 +869,19 @@ TestCase { mouseMove(control, control.width / 2, control.height / 2) compare(control.hovered, true) + if (data.pressed) { + mousePress(control, control.width / 2, control.height / 2) + compare(control.hovered, true) + } + mouseMove(control, -10, -10) compare(control.hovered, false) + if (data.pressed) { + mouseRelease(control, -10, control.height / 2) + compare(control.hovered, false) + } + mouseMove(control, control.width / 2, control.height / 2) compare(control.hovered, true) |