@@ -0,0 +1,133 @@
1+/*
2+ * Copyright 2013-2016 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.4
18+import QtQuick.Layouts 1.1
19+import Ubuntu.Components 1.3
20+import ".."
21+import "../../../qml/Launcher"
22+import Unity.Launcher 0.1
23+import Utils 0.1 // For EdgeBarrierSettings
24+import Unity.Test 0.1
25+
26+StyledItem {
27+ id: root
28+ theme.name: "Ubuntu.Components.Themes.SuruDark"
29+
30+ width: units.gu(140)
31+ height: units.gu(70)
32+ Rectangle {
33+ anchors.fill: parent
34+ color: UbuntuColors.graphite // something neither white nor black
35+ }
36+
37+ Launcher {
38+ id: launcher
39+ x: 0
40+ y: 0
41+ width: units.gu(40)
42+ height: root.height
43+
44+ lockedVisible: lockedVisibleCheckBox.checked
45+
46+ Component.onCompleted: {
47+ launcher.focus = true
48+ edgeBarrierControls.target = testCase.findChild(this, "edgeBarrierController");
49+ }
50+ }
51+
52+ ColumnLayout {
53+ anchors { bottom: parent.bottom; right: parent.right; margins: units.gu(1) }
54+ spacing: units.gu(1)
55+ width: childrenRect.width
56+
57+ RowLayout {
58+ CheckBox {
59+ id: lockedVisibleCheckBox
60+ checked: false
61+ }
62+ Label {
63+ text: "Launcher always visible"
64+ }
65+ }
66+
67+ Slider {
68+ id: widthSlider
69+ Layout.fillWidth: true
70+ minimumValue: 6
71+ maximumValue: 12
72+ value: 10
73+ }
74+
75+ MouseTouchEmulationCheckbox {}
76+
77+ EdgeBarrierControls {
78+ id: edgeBarrierControls
79+ text: "Drag here to pull out launcher"
80+ onDragged: { launcher.pushEdge(amount); }
81+ }
82+ }
83+
84+ UnityTestCase {
85+ id: testCase
86+ when: windowShown
87+
88+ function dragDrawerIntoView() {
89+ var startX = launcher.dragAreaWidth/2;
90+ var startY = launcher.height/2;
91+ touchFlick(launcher,
92+ startX, startY,
93+ startX+units.gu(35), startY);
94+
95+ var drawer = findChild(launcher, "drawer");
96+ verify(!!drawer);
97+
98+ // wait until it gets fully extended
99+ // a tryCompare doesn't work since
100+ // compare(-0.000005917593600024418, 0);
101+ // is true and in this case we want exactly 0 or will have pain later on
102+ tryCompareFunction( function(){ return drawer.x === 0; }, true );
103+ tryCompare(launcher, "state", "drawer");
104+ }
105+
106+ function revealByEdgePush() {
107+ // Place the mouse against the window/screen edge and push beyond the barrier threshold
108+ mouseMove(root, 1, root.height / 2);
109+ launcher.pushEdge(EdgeBarrierSettings.pushThreshold * 1.1);
110+
111+ var panel = findChild(launcher, "launcherPanel");
112+ verify(!!panel);
113+
114+ // wait until it gets fully extended
115+ tryCompare(panel, "x", 0);
116+ tryCompare(launcher, "state", "drawer");
117+ }
118+
119+ function init() {
120+ launcher.hide();
121+ var drawer = findChild(launcher, "drawer");
122+ tryCompare(drawer, "x", -drawer.width);
123+ }
124+
125+ function test_revealByEdgeDrag() {
126+ dragDrawerIntoView();
127+ }
128+
129+ function test_revealByEdgePush() {
130+ revealByEdgePush();
131+ }
132+ }
133+}