@@ -1,262 +0,0 @@
2− * Copyright 2013 Canonical Ltd.
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.
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.
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/>.
19−import Unity.Test 0.1 as UT
23− There's a revealer on each window edge. If you press and hold any edge you
24− should see a black bar appearing from that edge. If you them slide the
25− pointer/finger towards the opposite edge, that black bar should follow
26− the movement up to around the center of the window. Next to the black bar,
27− which represents the "handle" area of the Revealer, You should see a red rectangle,
28− which is the main body of the Showable concrolled by the Revealer (Showable = red
36− id: topRevealingRectangle
38− orientation: Qt.Vertical
39− direction: Qt.LeftToRight
43− id: bottomRevealingRectangle
45− orientation: Qt.Vertical
46− direction: Qt.RightToLeft
50− id: leftRevealingRectangle
52− orientation: Qt.Horizontal
53− direction: Qt.LeftToRight
57− id: rightRevealingRectangle
59− orientation: Qt.Horizontal
60− direction: Qt.RightToLeft
68− A bit of the showable should be displayed when you press over the
69− handle area of the Revealer.
71− Once released, it should go out of sight again.
73− function test_showHintOnPress() {
74− var revealer = topRevealingRectangle.revealer
75− var showable = topRevealingRectangle.showable
77− // It starts out of sight
78− compare(showable.y, -showable.height)
80− // (item, x, y, button, modifiers, delay)
83− revealer.handleSize/2,
84− Qt.LeftButton, Qt.NoModifier, 0);
86− tryCompare(showable, "y", -showable.height + revealer.handleSize)
88− // (item, x, y, button, modifiers, delay)
89− mouseRelease(revealer,
91− revealer.handleSize/2,
92− Qt.LeftButton, Qt.NoModifier, 0);
94− tryCompare(showable, "y", -showable.height)
98− Press over the handle area of the Revealer and drag it to pull
99− its target Showable. Release it half-way and the Showable will
100− continue moving by itself until it's completely shown.
103− Press over the handle area and drag it back to hide the Showable.
104− Release it half-way and it will continue moving by itself until it's
105− completely hidden again.
107− function test_dragToRevealAndDragBackToHide_top() {
108− var revealer = topRevealingRectangle.revealer
109− var showable = topRevealingRectangle.showable
110− revealer.__dateTime = fakeDateTime
112− // It starts out of sight
113− compare(showable.y, -showable.height)
115− mouseFlick(revealer,
116− revealer.width/2, // from_x
117− revealer.handleSize/2, // from_y
118− revealer.width/2, // to_x
119− showable.height/2); // to_y
121− // Should eventually get fully extended
122− tryCompare(showable, "y", 0)
124− // Now drag it back to get it hidden
126− mouseFlick(revealer,
128− showable.height - (revealer.handleSize/2),
132− // Should eventually be completely out of sight
133− tryCompare(showable, "y", -showable.height)
136− function test_dragToRevealAndDragBackToHide_bottom() {
137− var revealer = bottomRevealingRectangle.revealer
138− var showable = bottomRevealingRectangle.showable
139− var revRect = bottomRevealingRectangle
140− revealer.__dateTime = fakeDateTime
142− // It starts out of sight
143− compare(showable.y, revRect.height)
145− mouseFlick(revealer,
146− revealer.width/2, // from_x
147− revealer.height - revealer.handleSize/2, // from_y
148− revealer.width/2, // to_x
149− revealer.height - showable.height/2); // to_y
151− // Should eventually get fully extended
152− tryCompare(showable, "y", revRect.height - showable.height)
154− // Now drag it back to get it hidden
156− mouseFlick(revealer,
158− revealer.handleSize/2,
160− revealer.height - showable.height/2)
162− // Should eventually be completely out of sight
163− tryCompare(showable, "y", revRect.height)
166− function test_dragToRevealAndDragBackToHide_left() {
167− var revealer = leftRevealingRectangle.revealer
168− var showable = leftRevealingRectangle.showable
169− revealer.__dateTime = fakeDateTime
171− // It starts out of sight
172− compare(showable.x, -showable.width)
174− mouseFlick(revealer,
175− revealer.handleSize/2, // from_x
176− revealer.height/2, // from_y
177− showable.width/2, // to_x
178− revealer.height/2) // to_y
180− // Should eventually get fully extended
181− tryCompare(showable, "x", 0)
183− // Now drag it back to get it hidden
185− mouseFlick(revealer,
186− showable.width - (revealer.handleSize/2),
191− // Should eventually be completely out of sight
192− tryCompare(showable, "x", -showable.width)
195− function test_dragToRevealAndDragBackToHide_right() {
196− var revealer = rightRevealingRectangle.revealer
197− var showable = rightRevealingRectangle.showable
198− var revRect = rightRevealingRectangle
199− revealer.__dateTime = fakeDateTime
201− // It starts out of sight
202− compare(showable.x, revRect.width)
204− mouseFlick(revealer,
205− revealer.width - revealer.handleSize/2, // from_x
206− revealer.height/2, // from_y
207− revealer.width - showable.width/2, // to_x
208− revealer.height/2) // to_y
210− // Should eventually get fully extended
211− tryCompare(showable, "x", revRect.width - showable.width)
213− // Now drag it back to get it hidden
215− mouseFlick(revealer,
216− revealer.handleSize/2,
218− revealer.width - showable.width/2,
221− // Should eventually be completely out of sight
222− tryCompare(showable, "x", revRect.width)
226− Start dragging down (pulling the showable into view) and then,
227− midway, drag a bit upwards and release it.
228− The showable should keep moving away, ending up hidden again.
230− function test_dragForthAndBackReturnsOriginalState() {
231− var revealer = topRevealingRectangle.revealer
232− var showable = topRevealingRectangle.showable
233− revealer.__dateTime = fakeDateTime
235− // It starts out of sight
236− compare(showable.y, -showable.height)
238− mouseFlick(revealer,
239− revealer.width/2, // from_x
240− revealer.handleSize/2, // from_y
241− revealer.width/2, // to_x
242− showable.height/2, // to_y
243− true /* do press */, false /* don't release */);
245− // Should be about half-extended
246− verify(showable.y > -showable.height*3/4)
247− verify(showable.y < -showable.height*1/4)
250− // Now drag it back a bit
251− mouseFlick(revealer,
252− revealer.width/2, // from_x
253− showable.height/2, // from_y
254− revealer.width/2, // to_x
255− showable.height/4, // to_y
256− false /* don't press */, true /* do release */);
258− // Should eventually be completely out of sight again
259− tryCompare(showable, "y", -showable.height)