Merge lp:~mzanetti/unity8/virtual-touchpad-visual-updates into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 2174
Merged at revision: 2229
Proposed branch: lp:~mzanetti/unity8/virtual-touchpad-visual-updates
Merge into: lp:unity8
Diff against target: 224 lines (+120/-22)
2 files modified
qml/DisabledScreenNotice.qml (+44/-20)
tests/qmltests/tst_DisabledScreenNotice.qml (+76/-2)
To merge this branch: bzr merge lp:~mzanetti/unity8/virtual-touchpad-visual-updates
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Albert Astals Cid (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+284912@code.launchpad.net

Commit message

Some visual updates and rotation lock for the virtual touchpad

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.

no

 * Did you perform an exploratory manual test run of your code change and any related functionality?

yes

 * Did you make sure that your branch does not contain spurious tags?

yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

n/a

 * If you changed the UI, has there been a design review?

yes, Paty

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2173
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/265/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/265/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2173
http://jenkins.qa.ubuntu.com/job/unity8-ci/7207/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6313
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/622/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1912
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/615
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1807
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1807
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/614
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/613
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4851
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6324
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6324/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27274
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/331/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/620
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/620/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27273

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/7207/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

+ wait(0); // Spin event loop to be sure to update bindings etc
+ compare(content.rotation, oldRotation);

Why not a tryCompare?

review: Needs Information
Revision history for this message
Albert Astals Cid (aacid) wrote :

+ // For testing
+ property var screen: Screen
+ property var orientationLock: OrientationLock

I can't find these used on the tests, what am i missing?

review: Needs Information
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> + wait(0); // Spin event loop to be sure to update bindings etc
> + compare(content.rotation, oldRotation);
>
> Why not a tryCompare?

Because I want to make sure it does *not* change.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Ah, right, what we have in a few places is something like
expectFail()
tryCompareFunction(function( { return content.rotation != oldRotation; }, true, SomeTimeout);

it's a bit more reliable than "hoping" wait(0) will always update the bindings in the future, what do you think?

2174. By Michael Zanetti

use expectFail to make test more robust

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Ah, right, what we have in a few places is something like
> expectFail()
> tryCompareFunction(function( { return content.rotation != oldRotation; },
> true, SomeTimeout);
>
> it's a bit more reliable than "hoping" wait(0) will always update the bindings
> in the future, what do you think?

done. thanks

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> + // For testing
> + property var screen: Screen
> + property var orientationLock: OrientationLock
>
> I can't find these used on the tests, what am i missing?

Line 141 - 157 in the diff, I suppose.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2174
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/336/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/459/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/482
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/500
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/500
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/496
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/496/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/496/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/496
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/496/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/496/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/496
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/496/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/496/console

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/336/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2174
http://jenkins.qa.ubuntu.com/job/unity8-ci/7273/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6444
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/688/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1978
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/681
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1873
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1873
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/680
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/679
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4933
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6455
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6455/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27537
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/355/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/686
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/686/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27536

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/7273/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass?
Yes

 * Did you make sure that the branch does not contain spurious tags?
Yes

review: Approve
2175. By Michael Zanetti

merge trunk

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2175
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/514/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/678
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay/256
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial/256
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay/258
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/701
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/719
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/719
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/715
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/715/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/715
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/715/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/715
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/715/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/715
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/715/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/715
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/715/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/715
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/715/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/514/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/DisabledScreenNotice.qml'
2--- qml/DisabledScreenNotice.qml 2016-01-26 15:29:54 +0000
3+++ qml/DisabledScreenNotice.qml 2016-02-18 16:38:27 +0000
4@@ -17,6 +17,7 @@
5 import QtQuick 2.4
6 import QtQuick.Layouts 1.1
7 import Ubuntu.Components 1.3
8+import Unity.Session 0.1
9 import QtQuick.Window 2.2
10 import "Components"
11
12@@ -25,19 +26,36 @@
13
14 property bool infoNoteDisplayed: true
15
16- WallpaperResolver {
17- width: root.width
18- id: wallpaperResolver
19+ // For testing
20+ property var screen: Screen
21+ property var orientationLock: OrientationLock
22+
23+ DeviceConfiguration {
24+ id: deviceConfiguration
25+ name: applicationArguments.deviceName
26 }
27
28 Item {
29 id: contentContainer
30+ objectName: "contentContainer"
31 anchors.centerIn: parent
32 height: rotation == 90 || rotation == 270 ? parent.width : parent.height
33 width: rotation == 90 || rotation == 270 ? parent.height : parent.width
34
35+ property int savedOrientation: deviceConfiguration.primaryOrientation == deviceConfiguration.useNativeOrientation
36+ ? (root.width > root.height ? Qt.LandscapeOrientation : Qt.PortraitOrientation)
37+ : deviceConfiguration.primaryOrientation
38+
39 rotation: {
40- switch (Screen.orientation) {
41+ var usedOrientation = root.screen.orientation;
42+
43+ if (root.orientationLock.enabled) {
44+ usedOrientation = savedOrientation;
45+ }
46+
47+ savedOrientation = usedOrientation;
48+
49+ switch (usedOrientation) {
50 case Qt.PortraitOrientation:
51 return 0;
52 case Qt.LandscapeOrientation:
53@@ -47,6 +65,8 @@
54 case Qt.InvertedLandscapeOrientation:
55 return 90;
56 }
57+
58+ return 0;
59 }
60 transformOrigin: Item.Center
61
62@@ -60,9 +80,9 @@
63 }
64 }
65
66- Image {
67+ Rectangle {
68 anchors.fill: parent
69- source: wallpaperResolver.background
70+ color: "#3b3b3b"
71 }
72
73 Item {
74@@ -74,22 +94,26 @@
75 UbuntuNumberAnimation { }
76 }
77
78- Rectangle {
79- anchors.fill: parent
80- color: "black"
81- opacity: 0.4
82- }
83-
84- Label {
85- id: text
86+ Column {
87 anchors.centerIn: parent
88 width: parent.width - units.gu(8)
89- text: i18n.tr("Your device is now connected to an external display. Use this screen as a touch pad to interact with the mouse.")
90- color: "white"
91- horizontalAlignment: Text.AlignHCenter
92- verticalAlignment: Text.AlignVCenter
93- fontSize: "x-large"
94- wrapMode: Text.Wrap
95+ spacing: units.gu(4)
96+
97+ Label {
98+ id: text
99+ text: i18n.tr("Your device is now connected to an external display. Use this screen as a touch pad to interact with the pointer.")
100+ color: "white"
101+ width: parent.width
102+ fontSize: "large"
103+ wrapMode: Text.Wrap
104+ }
105+ Icon {
106+ height: units.gu(8)
107+ width: height
108+ name: "input-touchpad-symbolic"
109+ color: "white"
110+ anchors.horizontalCenter: parent.horizontalCenter
111+ }
112 }
113 }
114
115
116=== modified file 'tests/qmltests/tst_DisabledScreenNotice.qml'
117--- tests/qmltests/tst_DisabledScreenNotice.qml 2016-01-21 22:03:42 +0000
118+++ tests/qmltests/tst_DisabledScreenNotice.qml 2016-02-18 16:38:27 +0000
119@@ -15,18 +15,62 @@
120 */
121
122 import QtQuick 2.4
123+import QtQuick.Layouts 1.1
124 import QtTest 1.0
125 import Unity.Test 0.1
126+import Ubuntu.Components 1.3
127+import Ubuntu.Components.ListItems 1.3
128 import "../../qml"
129
130 Item {
131 id: root
132- width: units.gu(40)
133+ width: units.gu(80)
134 height: units.gu(70)
135
136 DisabledScreenNotice {
137 id: touchScreenPad
138 anchors.fill: parent
139+ anchors.rightMargin: units.gu(40)
140+
141+ screen: QtObject {
142+ property int orientation: {
143+ switch (orientationSelector.selectedIndex) {
144+ case 0:
145+ return Qt.PortraitOrientation;
146+ case 1:
147+ return Qt.LandscapeOrientation;
148+ case 2:
149+ return Qt.InvertedPortraitOrientation;
150+ case 3:
151+ return Qt.InvertedLandscapeOrientation;
152+ }
153+ }
154+ }
155+ orientationLock: QtObject {
156+ property bool enabled: orientationLockCheckBox.checked
157+ }
158+ }
159+
160+ Column {
161+ anchors.fill: parent
162+ anchors.leftMargin: units.gu(40)
163+
164+ ItemSelector {
165+ id: orientationSelector
166+ model: ["Portrait", "Landscape", "InvertedPortrait", "InvertedLandscape"]
167+ selectedIndex: 0
168+ }
169+
170+ RowLayout {
171+ CheckBox {
172+ id: orientationLockCheckBox
173+ checked: false
174+ }
175+ Label {
176+ text: "Rotation lock"
177+ Layout.fillWidth: true
178+ }
179+ }
180 }
181
182 UnityTestCase {
183@@ -36,10 +80,40 @@
184
185 function test_mouseAreaHidesOnFirstTap() {
186 var noticeArea = findChild(touchScreenPad, "infoNoticeArea")
187- print("noticeArea", noticeArea.visible)
188 compare(noticeArea.visible, true)
189 tap(root)
190 tryCompare(noticeArea, "visible", false)
191 }
192+
193+ function test_rotation_data() {
194+ return [
195+ {tag: "portrait", selectedOrientation: 0, expectedAngle: 0},
196+ {tag: "landscape", selectedOrientation: 1, expectedAngle: 270},
197+ {tag: "invertedportrait", selectedOrientation: 2, expectedAngle: 180},
198+ {tag: "invertetlandscape", selectedOrientation: 3, expectedAngle: 90}
199+ ];
200+ }
201+
202+ function test_rotation(data) {
203+ var content = findChild(touchScreenPad, "contentContainer");
204+
205+ var oldRotation = content.rotation;
206+
207+ // Turn on orientation lock
208+ orientationLockCheckBox.checked = true;
209+
210+ // simulate the rotation
211+ orientationSelector.selectedIndex = data.selectedOrientation;
212+
213+ // Make sure it is still in the old rotation (as we have the lock turned on)
214+ expectFail("", "Rotation lock set. Expecting automatic rotation to fail.");
215+ tryCompareFunction(function() { return content.rotation != oldRotation; }, true, 300);
216+
217+ // Now uncheck the rotation lock
218+ orientationLockCheckBox.checked = false;
219+
220+ // And make sure it catches up to the expected angle
221+ tryCompare(content, "rotation", data.expectedAngle);
222+ }
223 }
224 }

Subscribers

People subscribed via source and target branches