Merge lp:~faenil/ubuntu-ui-toolkit/mousefilter_setHovered_onMouseMove into lp:ubuntu-ui-toolkit/staging
- mousefilter_setHovered_onMouseMove
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Andrea Bernabei |
Approved revision: | 1809 |
Merged at revision: | 1922 |
Proposed branch: | lp:~faenil/ubuntu-ui-toolkit/mousefilter_setHovered_onMouseMove |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Diff against target: |
132 lines (+104/-1) 3 files modified
src/Ubuntu/Components/plugin/ucmousefilters.cpp (+2/-1) tests/unit_x11/tst_mousefilters/EnteredExitedOnMouseMove.qml (+32/-0) tests/unit_x11/tst_mousefilters/tst_mousefilterstest.cpp (+70/-0) |
To merge this branch: | bzr merge lp:~faenil/ubuntu-ui-toolkit/mousefilter_setHovered_onMouseMove |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ubuntu-sdk-build-bot | continuous-integration | Approve | |
Zsombor Egri | Approve | ||
Review via email: mp+291033@code.launchpad.net |
Commit message
Mouse filter: check if mouse is inside the area on mouse moves and setHovered accordingly. Fixes lp#1566378
Description of the change
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1806
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1806
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1806
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1807
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1807
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1807
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1807
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Zsombor Egri (zsombi) wrote : | # |
Nice one, thanks for fixing!
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1807
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1807
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1807
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1808
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1808
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1808
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1808
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1808
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1808
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1808
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
- 1809. By Andrea Bernabei
-
send mouse event to top left of the view, not middle
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1809
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1809
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1809
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1809
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1809
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1809
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1809
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'src/Ubuntu/Components/plugin/ucmousefilters.cpp' |
2 | --- src/Ubuntu/Components/plugin/ucmousefilters.cpp 2016-01-30 12:03:31 +0000 |
3 | +++ src/Ubuntu/Components/plugin/ucmousefilters.cpp 2016-04-06 22:19:21 +0000 |
4 | @@ -608,7 +608,8 @@ |
5 | m_pressAndHoldTimer.stop(); |
6 | } |
7 | |
8 | - setHovered(true, 0); |
9 | + setHovered(m_owner->contains(m_lastPos), Q_NULLPTR); |
10 | + |
11 | m_moved = true; |
12 | m_doubleClicked = false; |
13 | QQuickMouseEvent mev(m_lastPos.x(), m_lastPos.y(), m_lastButton, m_lastButtons, m_lastModifiers, |
14 | |
15 | === added file 'tests/unit_x11/tst_mousefilters/EnteredExitedOnMouseMove.qml' |
16 | --- tests/unit_x11/tst_mousefilters/EnteredExitedOnMouseMove.qml 1970-01-01 00:00:00 +0000 |
17 | +++ tests/unit_x11/tst_mousefilters/EnteredExitedOnMouseMove.qml 2016-04-06 22:19:21 +0000 |
18 | @@ -0,0 +1,32 @@ |
19 | +/* |
20 | + * Copyright 2016 Canonical Ltd. |
21 | + * |
22 | + * This program is free software; you can redistribute it and/or modify |
23 | + * it under the terms of the GNU Lesser General Public License as published by |
24 | + * the Free Software Foundation; version 3. |
25 | + * |
26 | + * This program is distributed in the hope that it will be useful, |
27 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
28 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
29 | + * GNU Lesser General Public License for more details. |
30 | + * |
31 | + * You should have received a copy of the GNU Lesser General Public License |
32 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
33 | + */ |
34 | + |
35 | +import QtQuick 2.4 |
36 | +import Ubuntu.Components 1.3 |
37 | + |
38 | +Rectangle { |
39 | + width: units.gu(50) |
40 | + height: units.gu(40) |
41 | + |
42 | + MouseArea { |
43 | + anchors.fill: parent |
44 | + anchors.margins: units.gu(10) |
45 | + |
46 | + objectName: "FilterOwner" |
47 | + hoverEnabled: true |
48 | + Mouse.enabled: true |
49 | + } |
50 | +} |
51 | \ No newline at end of file |
52 | |
53 | === modified file 'tests/unit_x11/tst_mousefilters/tst_mousefilterstest.cpp' |
54 | --- tests/unit_x11/tst_mousefilters/tst_mousefilterstest.cpp 2016-02-09 13:15:19 +0000 |
55 | +++ tests/unit_x11/tst_mousefilters/tst_mousefilterstest.cpp 2016-04-06 22:19:21 +0000 |
56 | @@ -981,6 +981,76 @@ |
57 | QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(x, i)); |
58 | } |
59 | |
60 | + //This is to test that entered/exited events are fired as a consequence of a mouse move. |
61 | + //When mouse is PRESSED, in fact, you won't get hover events. Mouse moves have to update |
62 | + //the hovered state (and that will trigger entered()/exited()). This fixes lp:1566378 |
63 | + void testCase_enteredExitedOnMouseMove_lp1566378() { |
64 | + QScopedPointer<QQuickView> view(loadTest("EnteredExitedOnMouseMove.qml")); |
65 | + QVERIFY(view); |
66 | + UCMouse *filter = attachedFilter<UCMouse>(view->rootObject(), "FilterOwner"); |
67 | + QVERIFY(filter); |
68 | + QSignalSpy pressed(filter, SIGNAL(pressed(QQuickMouseEvent*, QQuickItem*))); |
69 | + QSignalSpy positionChanged(filter, SIGNAL(positionChanged(QQuickMouseEvent*, QQuickItem*))); |
70 | + QSignalSpy entered(filter, SIGNAL(entered(QQuickMouseEvent*, QQuickItem*))); |
71 | + QSignalSpy exited(filter, SIGNAL(exited(QQuickMouseEvent*, QQuickItem*))); |
72 | + |
73 | + QObject::connect(filter, SIGNAL(pressed(QQuickMouseEvent*, QQuickItem*)), this, SLOT(onMouseEvent(QQuickMouseEvent*, QQuickItem*))); |
74 | + QObject::connect(filter, SIGNAL(positionChanged(QQuickMouseEvent*, QQuickItem*)), this, SLOT(onMouseEvent2(QQuickMouseEvent*, QQuickItem*))); |
75 | + QObject::connect(filter, SIGNAL(entered(QQuickMouseEvent*, QQuickItem*)), this, SLOT(onMouseEvent3(QQuickMouseEvent*, QQuickItem*))); |
76 | + QObject::connect(filter, SIGNAL(exited(QQuickMouseEvent*, QQuickItem*)), this, SLOT(onMouseEvent3(QQuickMouseEvent*, QQuickItem*))); |
77 | + |
78 | + preventDblClick(); |
79 | + |
80 | + //don't use guPoint(0,0) as it's the same as not passing any point, i.e. it sends mouseMove to the |
81 | + //center of the view |
82 | + QTest::mouseMove(view.data(), guPoint(1, 1)); |
83 | + QTest::mouseMove(view.data(), guPoint(15, 15)); |
84 | + QTest::waitForEvents(); |
85 | + |
86 | + QCOMPARE(entered.count(), 1); |
87 | + QCOMPARE(mouseEvent3Params.handler, QString("EVENT4")); |
88 | + QCOMPARE(mouseEvent3Params.pressedButton, Qt::NoButton); |
89 | + |
90 | + QTest::mousePress(view.data(), Qt::LeftButton, 0, guPoint(15, 15)); |
91 | + QTest::waitForEvents(); |
92 | + QCOMPARE(mouseEventParams.handler, QString("EVENT1")); |
93 | + QCOMPARE(mouseEventParams.pressedButton, Qt::LeftButton); |
94 | + |
95 | + QTest::mouseMove(view.data(), guPoint(25, 15)); |
96 | + |
97 | + //go out of the mousearea on the right |
98 | + QTest::mouseMove(view.data(), guPoint(45, 15)); |
99 | + QTest::waitForEvents(); |
100 | + QCOMPARE(mouseEvent2Params.handler, QString("EVENT2")); |
101 | + QCOMPARE(mouseEvent2Params.pressedButton, Qt::LeftButton); |
102 | + QCOMPARE(exited.count(), 1); |
103 | + QCOMPARE(mouseEvent3Params.handler, QString("EVENT4")); |
104 | + QCOMPARE(mouseEvent3Params.pressedButton, Qt::LeftButton); |
105 | + |
106 | + //move back in |
107 | + QTest::mouseMove(view.data(), guPoint(25, 15)); |
108 | + QTest::waitForEvents(); |
109 | + QCOMPARE(mouseEvent2Params.handler, QString("EVENT2")); |
110 | + QCOMPARE(mouseEvent2Params.pressedButton, Qt::LeftButton); |
111 | + QCOMPARE(entered.count(), 2); |
112 | + QCOMPARE(mouseEvent3Params.handler, QString("EVENT4")); |
113 | + QCOMPARE(mouseEvent3Params.pressedButton, Qt::LeftButton); |
114 | + |
115 | + //and out again |
116 | + QTest::mouseMove(view.data(), guPoint(45, 15)); |
117 | + QTest::waitForEvents(); |
118 | + QCOMPARE(mouseEvent2Params.handler, QString("EVENT2")); |
119 | + QCOMPARE(mouseEvent2Params.pressedButton, Qt::LeftButton); |
120 | + QCOMPARE(exited.count(), 2); |
121 | + QCOMPARE(mouseEvent3Params.handler, QString("EVENT4")); |
122 | + QCOMPARE(mouseEvent3Params.pressedButton, Qt::LeftButton); |
123 | + |
124 | + QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(45, 15)); |
125 | + QTest::waitForEvents(); |
126 | + |
127 | + QCOMPARE(positionChanged.count(), 4); |
128 | + } |
129 | + |
130 | void testCase_hoverEvents() { |
131 | QScopedPointer<QQuickView> view(loadTest("HoverEvent.qml")); |
132 | QVERIFY(view); |
PASSED: Continuous integration, rev:1806 /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- stable/ 618/ /jenkins. ubuntu. com/ubuntu- sdk/job/ generic- update- mp/2338/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- stable/ 618/rebuild
https:/