Merge lp:~zsombi/ubuntu-ui-toolkit/inversemouseareaqt52 into lp:ubuntu-ui-toolkit

Proposed by Zsombor Egri
Status: Merged
Approved by: Timo Jyrinki
Approved revision: 924
Merged at revision: 924
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/inversemouseareaqt52
Merge into: lp:ubuntu-ui-toolkit
Prerequisite: lp:~zsombi/ubuntu-ui-toolkit/tabBarTestFailureQt52
Diff against target: 236 lines (+42/-155)
5 files modified
modules/Ubuntu/Components/plugin/inversemouseareatype.cpp (+6/-1)
tests/unit_x11/tst_components/tst_inversemousearea.qml (+0/-153)
tests/unit_x11/tst_inversemousearea/Defaults.qml (+24/-0)
tests/unit_x11/tst_inversemousearea/tst_inversemousearea.pro (+2/-1)
tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp (+10/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/inversemouseareaqt52
Reviewer Review Type Date Requested Status
Timo Jyrinki Approve
Zoltan Balogh Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+203280@code.launchpad.net

Commit message

InverseMouseArea API test removed, being a duplicate of the other InverseMouseArea tests. Connecting to th eproper enabledChanged signal in InverseMouseArea resolves the warning in Qt5.2 stating enabledChanged was overwritten in QQuickMouseArea.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) :
review: Approve
Revision history for this message
Timo Jyrinki (timo-jyrinki) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/plugin/inversemouseareatype.cpp'
2--- modules/Ubuntu/Components/plugin/inversemouseareatype.cpp 2013-11-12 11:19:15 +0000
3+++ modules/Ubuntu/Components/plugin/inversemouseareatype.cpp 2014-01-27 07:32:13 +0000
4@@ -231,7 +231,12 @@
5 m_topmostItem(false),
6 m_sensingArea(QuickUtils::instance().rootItem(this))
7 {
8- QObject::connect(this, SIGNAL(enabledChanged()), this, SLOT(update()));
9+ /*
10+ * QQuickMouseArea overrides enabledChanged() signal, therefore we must make sure
11+ * we connect to the proper signal.
12+ */
13+ QObject::connect(this, &QQuickMouseArea::enabledChanged,
14+ this, &InverseMouseAreaType::update);
15
16 if (!m_sensingArea) {
17 // get sensing area upon parent change
18
19=== removed file 'tests/unit_x11/tst_components/tst_inversemousearea.qml'
20--- tests/unit_x11/tst_components/tst_inversemousearea.qml 2013-08-05 12:23:16 +0000
21+++ tests/unit_x11/tst_components/tst_inversemousearea.qml 1970-01-01 00:00:00 +0000
22@@ -1,153 +0,0 @@
23-/*
24- * Copyright 2012 Canonical Ltd.
25- *
26- * This program is free software; you can redistribute it and/or modify
27- * it under the terms of the GNU Lesser General Public License as published by
28- * the Free Software Foundation; version 3.
29- *
30- * This program is distributed in the hope that it will be useful,
31- * but WITHOUT ANY WARRANTY; without even the implied warranty of
32- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33- * GNU Lesser General Public License for more details.
34- *
35- * You should have received a copy of the GNU Lesser General Public License
36- * along with this program. If not, see <http://www.gnu.org/licenses/>.
37- */
38-
39-import QtQuick 2.0
40-import QtTest 1.0
41-import Ubuntu.Components 0.1
42-
43-Item {
44- id: testCase
45- width: 100; height: 100
46-
47- Item {
48- id: testSensingArea
49- anchors{
50- fill: parent
51- topMargin: 5
52- }
53- }
54-
55- MouseArea {
56- id: fullArea
57- anchors.fill: parent
58- }
59-
60- InverseMouseArea {
61- id: ima
62- x: 10; y: 10
63- width: 10; height: 10
64- property bool acceptPressEvent: true
65- property bool acceptClickEvent: true
66- onPressed: mouse.accepted = acceptPressEvent
67- onClicked: mouse.accepted = acceptClickEvent
68- }
69-
70- TestCase {
71- name: "InverseMouseAreaAPI"
72- when: windowShown
73-
74- SignalSpy {
75- id: masterSpy
76- target: fullArea
77- }
78-
79- SignalSpy {
80- id: signalSpy
81- target: ima
82- }
83-
84- function test_0_pressed() {
85- compare(ima.pressed, false, "InverseMouseArea is not pressed by default");
86- try {
87- ima.pressed = true;
88- compare(true, false, "This should not be reached");
89- } catch (e) {
90- //expect failure
91- }
92- compare(ima.pressed, false, "InverseMouseArea is not pressed by default");
93- }
94-
95- function test_0_acceptedButtons() {
96- compare(ima.acceptedButtons, Qt.LeftButton, "InverseMouseArea accepts LeftButton by default");
97- ima.acceptedButtons = Qt.LeftButton | Qt.RightButton;
98- compare(ima.acceptedButtons, Qt.LeftButton | Qt.RightButton, "InverseMouseArea acceptButtons is not properly set");
99- ima.acceptedButtons = Qt.RightButton;
100- compare(ima.acceptedButtons, Qt.RightButton, "InverseMouseArea acceptButtons is not properly set");
101- ima.acceptedButtons = Qt.MiddleButton;
102- compare(ima.acceptedButtons, Qt.MiddleButton, "InverseMouseArea acceptButtons is not properly set");
103- ima.acceptedButtons = Qt.AllButtons;
104- compare(ima.acceptedButtons, Qt.AllButtons, "InverseMouseArea acceptButtons is not properly set");
105- }
106-
107- function test_0_pressedButtons() {
108- compare(ima.pressedButtons, Qt.NoButton, "InverseMouseArea has NoButton pressed by default");
109- try {
110- ima.pressed = Qt.LeftButton;
111- compare(true, false, "This should not be reached");
112- } catch (e) {
113- //expect failure
114- }
115- compare(ima.pressedButtons, Qt.NoButton, "InverseMouseArea has NoButton pressed by default");
116- }
117-
118- function test_0_propagateComposedEvents() {
119- compare(ima.propagateComposedEvents, false, "InverseMouseArea does not propagate composed events by default");
120- ima.propagateComposedEvents = true;
121- compare(ima.propagateComposedEvents, true, "InverseMouseArea does propagates composed events");
122- }
123-
124- function test_0_sensingArea() {
125- compare(ima.sensingArea, QuickUtils.rootItem(ima), "InverseMouseArea senses the root item area");
126- ima.sensingArea = testSensingArea
127- compare(ima.sensingArea, testSensingArea, "InverseMouseArea sensing area set to testSensingArea");
128- }
129-
130- function test_signals_data() {
131- return [
132- {signal: "onPressed", propagate: false, sensing: null, item: testCase, x: 1, y: 1, master: 0, inverse: 1, acceptClickEvent: false},
133- {signal: "onPressed", propagate: true, sensing: null, item: testCase, x: 1, y: 1, master: 1, inverse: 1, acceptPressEvent: false},
134- {signal: "onPressed", propagate: false, sensing: testSensingArea, item: testCase, x: 1, y: 1, master: 1, inverse: 0},
135- {signal: "onPressed", propagate: true, sensing: testSensingArea, item: testCase, x: 1, y: 1, master: 1, inverse: 0},
136-
137- {signal: "onReleased", propagate: false, sensing: null, item: testCase, x: 1, y: 1, master: 0, inverse: 1, acceptClickEvent: false},
138- {signal: "onReleased", propagate: true, sensing: null, item: testCase, x: 1, y: 1, master: 1, inverse: 0, acceptPressEvent: false},
139- {signal: "onReleased", propagate: false, sensing: testSensingArea, item: testCase, x: 1, y: 1, master: 1, inverse: 0},
140- {signal: "onReleased", propagate: true, sensing: testSensingArea, item: testCase, x: 1, y: 1, master: 1, inverse: 0},
141-
142- {signal: "onClicked", propagate: false, sensing: null, item: testCase, x: 1, y: 1, master: 0, inverse: 1},
143- {signal: "onClicked", propagate: true, sensing: null, item: testCase, x: 1, y: 1, master: 1, inverse: 1, acceptClickEvent: false},
144- {signal: "onClicked", propagate: false, sensing: testSensingArea, item: testCase, x: 1, y: 1, master: 1, inverse: 0},
145- {signal: "onClicked", propagate: true, sensing: testSensingArea, item: testCase, x: 1, y: 1, master: 1, inverse: 0},
146- ];
147- }
148-
149- function test_signals(data) {
150- masterSpy.clear();
151- signalSpy.clear();
152- masterSpy.signalName = data.signal;
153- signalSpy.signalName = data.signal;
154- if (data.acceptPressEvent !== undefined) {
155- ima.acceptPressEvent = data.acceptPressEvent;
156- } else {
157- ima.acceptPressEvent = true;
158- }
159- if (data.acceptClickEvent !== undefined) {
160- ima.acceptClickEvent = data.acceptClickEvent;
161- } else {
162- ima.acceptClickEvent = true;
163- }
164-
165- ima.acceptedButtons = Qt.LeftButton;
166- ima.propagateComposedEvents = data.propagate;
167- ima.sensingArea = data.sensing;
168-
169- mouseClick(testCase, data.x, data.y);
170- tryCompare(masterSpy, "count", data.master, 100);
171- tryCompare(signalSpy, "count", data.inverse, 100);
172- }
173- }
174-}
175-
176
177=== added file 'tests/unit_x11/tst_inversemousearea/Defaults.qml'
178--- tests/unit_x11/tst_inversemousearea/Defaults.qml 1970-01-01 00:00:00 +0000
179+++ tests/unit_x11/tst_inversemousearea/Defaults.qml 2014-01-27 07:32:13 +0000
180@@ -0,0 +1,24 @@
181+/*
182+ * Copyright 2014 Canonical Ltd.
183+ *
184+ * This program is free software; you can redistribute it and/or modify
185+ * it under the terms of the GNU Lesser General Public License as published by
186+ * the Free Software Foundation; version 3.
187+ *
188+ * This program is distributed in the hope that it will be useful,
189+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
190+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
191+ * GNU Lesser General Public License for more details.
192+ *
193+ * You should have received a copy of the GNU Lesser General Public License
194+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
195+ */
196+
197+import QtQuick 2.0
198+import Ubuntu.Components 0.1
199+
200+Item {
201+ InverseMouseArea {
202+ objectName: "testItem"
203+ }
204+}
205
206=== modified file 'tests/unit_x11/tst_inversemousearea/tst_inversemousearea.pro'
207--- tests/unit_x11/tst_inversemousearea/tst_inversemousearea.pro 2013-10-29 17:16:45 +0000
208+++ tests/unit_x11/tst_inversemousearea/tst_inversemousearea.pro 2014-01-27 07:32:13 +0000
209@@ -14,4 +14,5 @@
210 InverseMouseAreaNormalEventStack.qml \
211 InverseMouseAreaTopmostItem.qml \
212 InverseMouseAreaSensingArea.qml \
213- InverseMouseAreaOnTopNoAccept.qml
214+ InverseMouseAreaOnTopNoAccept.qml \
215+ Defaults.qml
216
217=== modified file 'tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp'
218--- tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp 2013-10-29 17:16:45 +0000
219+++ tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp 2014-01-27 07:32:13 +0000
220@@ -89,6 +89,16 @@
221 delete quickView;
222 }
223
224+ void testCase_Defaults()
225+ {
226+ InverseMouseAreaType *area = testArea("Defaults.qml");
227+ QVERIFY(area);
228+
229+ QCOMPARE(area->pressed(), false);
230+ QCOMPARE(area->acceptedButtons(), Qt::LeftButton);
231+ QCOMPARE(area->pressedButtons(), Qt::NoButton);
232+ QCOMPARE(area->propagateComposedEvents(), false);
233+ }
234 void testCase_DoNotPropagateEvents()
235 {
236 eventCleanup.clear();

Subscribers

People subscribed via source and target branches

to status/vote changes: