Merge lp:~unity-team/unity/phablet.test_responsiveflowview into lp:unity/phablet

Proposed by Andrea Cimitan
Status: Superseded
Proposed branch: lp:~unity-team/unity/phablet.test_responsiveflowview
Merge into: lp:unity/phablet
Prerequisite: lp:~unity-team/unity/phablet.moving_tests
Diff against target: 2164 lines (+970/-759)
24 files modified
Components/ResponsiveFlowView.qml (+2/-0)
tests/README (+25/-3)
tests/qmluitests/Components/CMakeLists.txt (+1/-0)
tests/qmluitests/Components/tst_DraggingArea.qml (+79/-79)
tests/qmluitests/Components/tst_FilterGrid.qml (+81/-82)
tests/qmluitests/Components/tst_ResponsiveFlowView.qml (+191/-0)
tests/qmluitests/Components/tst_ResponsiveGridView.qml (+72/-72)
tests/qmluitests/Components/tst_Revealer.qml (+29/-30)
tests/qmluitests/Components/tst_Showable.qml (+70/-71)
tests/qmluitests/Components/tst_Stage.qml (+140/-142)
tests/qmluitests/Components/tst_Stage/FakeApplicationScreenshot.qml (+0/-2)
tests/qmluitests/Components/tst_Tile.qml (+10/-10)
tests/qmluitests/Dash/tst_DashPreview.qml (+65/-66)
tests/qmluitests/Greeter/tst_Greeter.qml (+18/-18)
tests/qmluitests/Hud/tst_Hud.qml (+5/-5)
tests/qmluitests/Launcher/tst_Launcher.qml (+29/-30)
tests/qmluitests/Panel/tst_IndicatorRow.qml (+22/-22)
tests/qmluitests/Panel/tst_SearchIndicator.qml (+12/-12)
tests/unittests/Components/tst_AnimationControllerWithSignals.qml (+95/-95)
tests/unittests/Components/tst_Carousel.qml (+5/-1)
tests/unittests/Components/tst_CrossFadeImage.qml (+10/-10)
tests/unittests/Components/tst_MathLocal.qml (+1/-1)
tests/unittests/Components/tst_RatingStars.qml (+7/-7)
tests/unittests/Components/tst_TimeLocal.qml (+1/-1)
To merge this branch: bzr merge lp:~unity-team/unity/phablet.test_responsiveflowview
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Approve
Review via email: mp+157830@code.launchpad.net

This proposal supersedes a proposal from 2013-04-05.

This proposal has been superseded by a proposal from 2013-04-09.

Commit message

Adds tests for ResponsiveFlowView, adapting from ResponsiveGridView

Description of the change

Adds tests for ResponsiveFlowView, adapting from ResponsiveGridView

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

Change ResponsiveGridView -> Change ResponsiveFlowView

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good to me, let's wait for CI before merging

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Components/ResponsiveFlowView.qml'
2--- Components/ResponsiveFlowView.qml 2013-04-09 12:30:58 +0000
3+++ Components/ResponsiveFlowView.qml 2013-04-09 15:54:20 +0000
4@@ -30,6 +30,8 @@
5 property alias firstModel: repeater1.model
6 property alias secondModel: repeater2.model
7 property alias delegate: repeater1.delegate
8+ readonly property int cellWidth: referenceDelegateWidth + horizontalSpacing
9+ readonly property int cellHeight: referenceDelegateWidth + verticalSpacing
10
11 height: flow.height + flow.anchors.topMargin
12
13
14=== renamed file 'tests/qmluitests/README' => 'tests/README'
15--- tests/qmluitests/README 2013-04-03 14:28:06 +0000
16+++ tests/README 2013-04-09 15:54:20 +0000
17@@ -1,9 +1,12 @@
18+For qmluitests and unittests tests.
19+
20+
21 General guidelines
22 ==================
23
24-Tests here should be designed in a way that they can be run either automatically
25-(with qmltestrunner) or manually (with qmlscene). So make sure you add UI controls
26-for manual interaction and labels for monitoring output when needed.
27+Tests under qmluitests dir should be designed in a way that they can be run either
28+automatically (with qmltestrunner) or manually (with qmlscene). So make sure you
29+add UI controls for manual interaction and labels for monitoring output when needed.
30
31 The order in which tests are run should not matter. The test application
32 should be in its initial state before each and every test function is called.
33@@ -11,6 +14,25 @@
34 one starts. A convenient way of doing so is using the init() function of the
35 TestCase component. It gets called automatically before each test function.
36
37+The name property of [Unity]TestCase does not include a 'Test' suffix.
38+Both [Unity]TestCase and their functions are placed after properties
39+and Components being tested.
40+e.g.:
41+ Item {
42+ Component { }
43+
44+ Component { }
45+
46+ TestCase {
47+ name: "Launcher"
48+
49+ property var exampleProperty
50+
51+ function test_something() {}
52+ }
53+ }
54+
55+
56 Documenting
57 ===========
58
59
60=== modified file 'tests/qmluitests/Components/CMakeLists.txt'
61--- tests/qmluitests/Components/CMakeLists.txt 2013-04-08 17:08:40 +0000
62+++ tests/qmluitests/Components/CMakeLists.txt 2013-04-09 15:54:20 +0000
63@@ -1,5 +1,6 @@
64 add_qml_test(DraggingArea)
65 add_qml_test(FilterGrid IMPORT_PATH ${CMAKE_BINARY_DIR}/plugins)
66+add_qml_test(ResponsiveFlowView)
67 add_qml_test(ResponsiveGridView)
68 add_qml_test(Revealer)
69 add_qml_test(Showable)
70
71=== modified file 'tests/qmluitests/Components/tst_DraggingArea.qml'
72--- tests/qmluitests/Components/tst_DraggingArea.qml 2013-04-08 17:08:40 +0000
73+++ tests/qmluitests/Components/tst_DraggingArea.qml 2013-04-09 15:54:20 +0000
74@@ -35,85 +35,6 @@
75 property int dragStartCount: 0
76 property int dragEndCount: 0
77
78- TestCase {
79- name: "DraggingAreaTest"
80- when: windowShown
81-
82- function test_horizontalDrag() {
83- draggingArea.orientation = Qt.Horizontal;
84-
85- dragStartCount = 0
86- dragEndCount = 0
87-
88- compare(draggingArea.dragging, false);
89-
90- // (item, x, y, button, modifiers, delay)
91- mousePress(draggingArea,
92- 25, 25,
93- Qt.LeftButton, Qt.NoModifier, 0);
94-
95- compare(draggingArea.dragging, false);
96- compare(dragStartCount, 0);
97- compare(dragEndCount, 0);
98-
99- // (item, x, y, delay, button)
100- mouseMove(draggingArea,
101- -100, 25,
102- 0, Qt.LeftButton);
103-
104- compare(draggingArea.dragging, true);
105- compare(draggingArea.dragValue, -125);
106- compare(dragStartCount, 1);
107- compare(dragEndCount, 0);
108-
109- // (item, x, y, button, modifiers, delay)
110- mouseRelease(draggingArea,
111- -100, 25,
112- Qt.LeftButton, Qt.NoModifier, 0);
113-
114- compare(draggingArea.dragging, false);
115- compare(dragStartCount, 1);
116- compare(dragEndCount, 1);
117- }
118-
119- function test_verticalDrag() {
120- draggingArea.orientation = Qt.Vertical;
121-
122- dragStartCount = 0
123- dragEndCount = 0
124-
125- compare(draggingArea.dragging, false);
126-
127- // (item, x, y, button, modifiers, delay)
128- mousePress(draggingArea,
129- 25, 25,
130- Qt.LeftButton, Qt.NoModifier, 0);
131-
132- compare(draggingArea.dragging, false);
133- compare(dragStartCount, 0);
134- compare(dragEndCount, 0);
135-
136- // (item, x, y, delay, button)
137- mouseMove(draggingArea,
138- 25, 125,
139- 0, Qt.LeftButton);
140-
141- compare(draggingArea.dragging, true);
142- compare(draggingArea.dragValue, 100);
143- compare(dragStartCount, 1);
144- compare(dragEndCount, 0);
145-
146- // (item, x, y, button, modifiers, delay)
147- mouseRelease(draggingArea,
148- 25, 125,
149- Qt.LeftButton, Qt.NoModifier, 0);
150-
151- compare(draggingArea.dragging, false);
152- compare(dragStartCount, 1);
153- compare(dragEndCount, 1);
154- }
155- }
156-
157 Column {
158 anchors.left: parent.left
159 anchors.top: parent.top
160@@ -181,4 +102,83 @@
161 onDragEnd : { ++root.dragEndCount }
162 }
163 }
164+
165+ TestCase {
166+ name: "DraggingArea"
167+ when: windowShown
168+
169+ function test_horizontalDrag() {
170+ draggingArea.orientation = Qt.Horizontal;
171+
172+ dragStartCount = 0
173+ dragEndCount = 0
174+
175+ compare(draggingArea.dragging, false);
176+
177+ // (item, x, y, button, modifiers, delay)
178+ mousePress(draggingArea,
179+ 25, 25,
180+ Qt.LeftButton, Qt.NoModifier, 0);
181+
182+ compare(draggingArea.dragging, false);
183+ compare(dragStartCount, 0);
184+ compare(dragEndCount, 0);
185+
186+ // (item, x, y, delay, button)
187+ mouseMove(draggingArea,
188+ -100, 25,
189+ 0, Qt.LeftButton);
190+
191+ compare(draggingArea.dragging, true);
192+ compare(draggingArea.dragValue, -125);
193+ compare(dragStartCount, 1);
194+ compare(dragEndCount, 0);
195+
196+ // (item, x, y, button, modifiers, delay)
197+ mouseRelease(draggingArea,
198+ -100, 25,
199+ Qt.LeftButton, Qt.NoModifier, 0);
200+
201+ compare(draggingArea.dragging, false);
202+ compare(dragStartCount, 1);
203+ compare(dragEndCount, 1);
204+ }
205+
206+ function test_verticalDrag() {
207+ draggingArea.orientation = Qt.Vertical;
208+
209+ dragStartCount = 0
210+ dragEndCount = 0
211+
212+ compare(draggingArea.dragging, false);
213+
214+ // (item, x, y, button, modifiers, delay)
215+ mousePress(draggingArea,
216+ 25, 25,
217+ Qt.LeftButton, Qt.NoModifier, 0);
218+
219+ compare(draggingArea.dragging, false);
220+ compare(dragStartCount, 0);
221+ compare(dragEndCount, 0);
222+
223+ // (item, x, y, delay, button)
224+ mouseMove(draggingArea,
225+ 25, 125,
226+ 0, Qt.LeftButton);
227+
228+ compare(draggingArea.dragging, true);
229+ compare(draggingArea.dragValue, 100);
230+ compare(dragStartCount, 1);
231+ compare(dragEndCount, 0);
232+
233+ // (item, x, y, button, modifiers, delay)
234+ mouseRelease(draggingArea,
235+ 25, 125,
236+ Qt.LeftButton, Qt.NoModifier, 0);
237+
238+ compare(draggingArea.dragging, false);
239+ compare(dragStartCount, 1);
240+ compare(dragEndCount, 1);
241+ }
242+ }
243 }
244
245=== modified file 'tests/qmluitests/Components/tst_FilterGrid.qml'
246--- tests/qmluitests/Components/tst_FilterGrid.qml 2013-04-08 17:08:40 +0000
247+++ tests/qmluitests/Components/tst_FilterGrid.qml 2013-04-09 15:54:20 +0000
248@@ -25,92 +25,10 @@
249 Once you press that button other 6 green squares (from "G" to "L") should show up.
250 */
251 Rectangle {
252- id: rootRect
253 width: gridRect.width + controls.width
254 height: units.gu(50)
255 color: "white"
256
257- TestCase {
258- name: "FilterGridTest"
259- when: windowShown
260-
261- function test_turningFilterOffShowsAllElements() {
262- compare(countVisibleDelegates(), 6)
263-
264- filterCheckBox.checked = false
265-
266- // wait for animations to complete
267- tryCompare(filterGrid.__expansionAnimation, "running", false)
268- compare(countVisibleDelegates(), 12)
269-
270- // back to initial state
271- filterCheckBox.checked = true
272- // wait for animations to complete
273- tryCompare(filterGrid.__expansionAnimation, "running", false)
274- }
275-
276- function test_collapsedRowCount() {
277- for (var i = 0; i < 4; ++i) {
278- collapsedRowCountSelector.selectedIndex = i
279- // wait for animations to complete
280- tryCompare(filterGrid.__expansionAnimation, "running", false)
281- // We have 3 elements per row.
282- // row count == index + 1
283- compare(countVisibleDelegates(), 3*(i+1))
284- }
285-
286- // back to initial state
287- collapsedRowCountSelector.selectedIndex = 1
288- // wait for animations to complete
289- tryCompare(filterGrid.__expansionAnimation, "running", false)
290- }
291-
292- // Checks that the filter toggle button, the one that says "View All (xy)",
293- // shows up only when it's possible for the grid to be expanded.
294- function test_filterToggleButton() {
295- var filterToggleButton = filterGrid.__filterToggleButton
296-
297- for (var i = 0; i < 4; ++i) {
298- collapsedRowCountSelector.selectedIndex = i
299- // wait for animations to complete
300- tryCompare(filterGrid.__expansionAnimation, "running", false)
301- // row count == index + 1
302- // The total number of rows is 4.
303-
304- expandableCheckBox.checked = false
305- compare(filterToggleButton.visible, false)
306- expandableCheckBox.checked = true
307-
308- if ((i+1) < 4)
309- compare(filterToggleButton.visible, true)
310- else
311- compare(filterToggleButton.visible, false)
312- }
313-
314- // back to initial state
315- collapsedRowCountSelector.selectedIndex = 1
316- expandableCheckBox.checked = true
317- // wait for animations to complete
318- tryCompare(filterGrid.__expansionAnimation, "running", false)
319- }
320-
321- function countVisibleDelegates() {
322- return __countVisibleDelegates(filterGrid.visibleChildren, 0)
323- }
324-
325- function __countVisibleDelegates(objList, total) {
326- for (var i = 0; i < objList.length; ++i) {
327- var child = objList[i];
328- if (child.isGridDelegate !== undefined) {
329- ++total;
330- } else {
331- total = __countVisibleDelegates(child.visibleChildren, total)
332- }
333- }
334- return total
335- }
336- }
337-
338 Column {
339 id: controls
340 width: units.gu(30)
341@@ -195,5 +113,86 @@
342 }
343 }
344 }
345+
346+ TestCase {
347+ name: "FilterGrid"
348+ when: windowShown
349+
350+ function test_turningFilterOffShowsAllElements() {
351+ compare(countVisibleDelegates(), 6)
352+
353+ filterCheckBox.checked = false
354+
355+ // wait for animations to complete
356+ tryCompare(filterGrid.__expansionAnimation, "running", false)
357+ compare(countVisibleDelegates(), 12)
358+
359+ // back to initial state
360+ filterCheckBox.checked = true
361+ // wait for animations to complete
362+ tryCompare(filterGrid.__expansionAnimation, "running", false)
363+ }
364+
365+ function test_collapsedRowCount() {
366+ for (var i = 0; i < 4; ++i) {
367+ collapsedRowCountSelector.selectedIndex = i
368+ // wait for animations to complete
369+ tryCompare(filterGrid.__expansionAnimation, "running", false)
370+ // We have 3 elements per row.
371+ // row count == index + 1
372+ compare(countVisibleDelegates(), 3*(i+1))
373+ }
374+
375+ // back to initial state
376+ collapsedRowCountSelector.selectedIndex = 1
377+ // wait for animations to complete
378+ tryCompare(filterGrid.__expansionAnimation, "running", false)
379+ }
380+
381+ // Checks that the filter toggle button, the one that says "View All (xy)",
382+ // shows up only when it's possible for the grid to be expanded.
383+ function test_filterToggleButton() {
384+ var filterToggleButton = filterGrid.__filterToggleButton
385+
386+ for (var i = 0; i < 4; ++i) {
387+ collapsedRowCountSelector.selectedIndex = i
388+ // wait for animations to complete
389+ tryCompare(filterGrid.__expansionAnimation, "running", false)
390+ // row count == index + 1
391+ // The total number of rows is 4.
392+
393+ expandableCheckBox.checked = false
394+ compare(filterToggleButton.visible, false)
395+ expandableCheckBox.checked = true
396+
397+ if ((i+1) < 4)
398+ compare(filterToggleButton.visible, true)
399+ else
400+ compare(filterToggleButton.visible, false)
401+ }
402+
403+ // back to initial state
404+ collapsedRowCountSelector.selectedIndex = 1
405+ expandableCheckBox.checked = true
406+ // wait for animations to complete
407+ tryCompare(filterGrid.__expansionAnimation, "running", false)
408+ }
409+
410+ function countVisibleDelegates() {
411+ return __countVisibleDelegates(filterGrid.visibleChildren, 0)
412+ }
413+
414+ function __countVisibleDelegates(objList, total) {
415+ for (var i = 0; i < objList.length; ++i) {
416+ var child = objList[i];
417+ if (child.isGridDelegate !== undefined) {
418+ ++total;
419+ } else {
420+ total = __countVisibleDelegates(child.visibleChildren, total)
421+ }
422+ }
423+ return total
424+ }
425+ }
426 }
427
428
429=== added file 'tests/qmluitests/Components/tst_ResponsiveFlowView.qml'
430--- tests/qmluitests/Components/tst_ResponsiveFlowView.qml 1970-01-01 00:00:00 +0000
431+++ tests/qmluitests/Components/tst_ResponsiveFlowView.qml 2013-04-09 15:54:20 +0000
432@@ -0,0 +1,191 @@
433+/*
434+ * Copyright 2013 Canonical Ltd.
435+ *
436+ * This program is free software; you can redistribute it and/or modify
437+ * it under the terms of the GNU General Public License as published by
438+ * the Free Software Foundation; version 3.
439+ *
440+ * This program is distributed in the hope that it will be useful,
441+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
442+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
443+ * GNU General Public License for more details.
444+ *
445+ * You should have received a copy of the GNU General Public License
446+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
447+ */
448+
449+import QtQuick 2.0
450+import QtTest 1.0
451+import ".."
452+import "../../../Components"
453+import Ubuntu.Components.ListItems 0.1 as ListItem
454+import Ubuntu.Components 0.1
455+
456+Item {
457+ width: flowRect.width + controls.width
458+ height: units.gu(80)
459+
460+ Column {
461+ id: controls
462+ width: units.gu(40)
463+ height: parent.height
464+ anchors.top: parent.top
465+ anchors.right: parent.right
466+ ListItem.ValueSelector {
467+ id: maxColumnsSelector
468+ text: "maximumNumberOfColumns"
469+ values: [2,4,8,13,1000]
470+ selectedIndex: 1
471+ }
472+ ListItem.ValueSelector {
473+ id: minHSpacingSelector
474+ text: "minHorizontalSpacing"
475+ values: [0,units.gu(2),units.gu(8),units.gu(25)]
476+ selectedIndex: 0
477+ }
478+ }
479+
480+ ListModel {
481+ id: fakeModel
482+ ListElement { name: "A" }
483+ ListElement { name: "B" }
484+ ListElement { name: "C" }
485+ ListElement { name: "D" }
486+ ListElement { name: "E" }
487+ ListElement { name: "F" }
488+ ListElement { name: "G" }
489+ ListElement { name: "H" }
490+ ListElement { name: "I" }
491+ ListElement { name: "J" }
492+ ListElement { name: "K" }
493+ ListElement { name: "L" }
494+ ListElement { name: "M" }
495+ ListElement { name: "N" }
496+ ListElement { name: "O" }
497+ ListElement { name: "P" }
498+ ListElement { name: "Q" }
499+ ListElement { name: "R" }
500+ ListElement { name: "S" }
501+ ListElement { name: "T" }
502+ ListElement { name: "U" }
503+ }
504+
505+ Rectangle {
506+ id: flowRect
507+ width: units.gu(80)
508+ height: parent.height
509+ color: "grey"
510+ anchors.top: parent.top
511+ anchors.left: parent.left
512+
513+ ResponsiveFlowView {
514+ id: flow
515+ anchors.fill: parent
516+ firstModel: fakeModel
517+ secondModel: fakeModel
518+ minimumHorizontalSpacing:
519+ minHSpacingSelector.values[minHSpacingSelector.selectedIndex]
520+ verticalSpacing: units.gu(2)
521+ maximumNumberOfColumns:
522+ maxColumnsSelector.values[maxColumnsSelector.selectedIndex]
523+ referenceDelegateWidth: units.gu(6)
524+
525+ delegate: Rectangle {
526+ // So that it can be identified by test code
527+ property bool isFlowDelegate: true
528+ color: "grey"
529+ border.color: "red"
530+ border.width: 1
531+
532+ // IMPORTANT: always use flow's cellWidth and cellHeight here to get
533+ // ResponsiveFlowView's intended result
534+ width: flow.cellWidth
535+ height: flow.cellHeight
536+
537+ Rectangle {
538+ color: "green"
539+ anchors.centerIn: parent
540+ width: units.gu(6)
541+ height: units.gu(6)
542+ Text {
543+ anchors.centerIn: parent
544+ text: name
545+ }
546+ }
547+
548+ Text { x:0; y:0; text:"(" + parent.x + ", " + parent.y + ")"}
549+ }
550+ }
551+ }
552+
553+ UnityTestCase {
554+ name: "ResponsiveFlowView"
555+ when: windowShown
556+
557+ function test_maximumNumberOfColumns_data() {
558+ var data = new Array()
559+
560+ data.push({selectedIndex: 0, maxColumnCount:2, columnCount: 2})
561+ data.push({selectedIndex: 1, maxColumnCount:4, columnCount: 4})
562+ data.push({selectedIndex: 2, maxColumnCount:8, columnCount: 8})
563+ data.push({selectedIndex: 4, maxColumnCount:1000, columnCount: 13})
564+
565+ return data
566+ }
567+
568+ /* Change ResponsiveFlowView's maximumNumberOfColumns property and check
569+ that the resulting number of columns matches expectations */
570+ function test_maximumNumberOfColumns(data) {
571+ minHSpacingSelector.selectedIndex = 0
572+
573+ // sanity checks
574+ compare(maxColumnsSelector.values[data.selectedIndex], data.maxColumnCount)
575+ compare(minHSpacingSelector.values[0], 0)
576+
577+ maxColumnsSelector.selectedIndex = data.selectedIndex
578+ tryCompareFunction(countFlowDelegatesOnFirstRow, data.columnCount);
579+ compare(flow.columns, data.columnCount)
580+ }
581+
582+ function test_minimumHorizontalSpacing_data() {
583+ var data = new Array()
584+
585+ data.push({selectedIndex: 0, minHSpacing:0, columnCount: 13})
586+ data.push({selectedIndex: 1, minHSpacing:units.gu(2), columnCount: 9})
587+ data.push({selectedIndex: 2, minHSpacing:units.gu(8), columnCount: 5})
588+ data.push({selectedIndex: 3, minHSpacing:units.gu(25), columnCount: 2})
589+
590+ return data
591+ }
592+
593+ /* Change ResponsiveFlowView's minimumHorizontalSpacing property and check
594+ that the resulting number of columns matches expectations */
595+ function test_minimumHorizontalSpacing(data) {
596+ maxColumnsSelector.selectedIndex = 4
597+
598+ // sanity checks
599+ compare(maxColumnsSelector.values[4], 1000)
600+ compare(minHSpacingSelector.values[data.selectedIndex], data.minHSpacing)
601+
602+ minHSpacingSelector.selectedIndex = data.selectedIndex
603+ tryCompareFunction(countFlowDelegatesOnFirstRow, data.columnCount);
604+ compare(flow.columns, data.columnCount)
605+ }
606+
607+ function countFlowDelegatesOnFirstRow() {
608+ return __countFlowDelegatesOnFirstRow(flow.visibleChildren, 0)
609+ }
610+
611+ function __countFlowDelegatesOnFirstRow(objList, total) {
612+ for (var i = 0; i < objList.length; ++i) {
613+ var child = objList[i];
614+ if (child.isFlowDelegate !== undefined && child.y === 0) {
615+ ++total;
616+ } else {
617+ total = __countFlowDelegatesOnFirstRow(child.visibleChildren, total)
618+ }
619+ }
620+ return total
621+ }
622+ }
623+}
624
625=== modified file 'tests/qmluitests/Components/tst_ResponsiveGridView.qml'
626--- tests/qmluitests/Components/tst_ResponsiveGridView.qml 2013-04-08 17:08:40 +0000
627+++ tests/qmluitests/Components/tst_ResponsiveGridView.qml 2013-04-09 15:54:20 +0000
628@@ -25,78 +25,6 @@
629 width: gridRect.width + controls.width
630 height: units.gu(80)
631
632- UnityTestCase {
633- name: "ResponsiveGridViewTest"
634- when: windowShown
635-
636- function test_maximumNumberOfColumns_data() {
637- var data = new Array()
638-
639- data.push({selectedIndex: 0, maxColumnCount:2, columnCount: 2})
640- data.push({selectedIndex: 1, maxColumnCount:4, columnCount: 4})
641- data.push({selectedIndex: 2, maxColumnCount:8, columnCount: 8})
642- data.push({selectedIndex: 4, maxColumnCount:1000, columnCount: 13})
643-
644- return data
645- }
646-
647- /* Change ResponsiveGridView's maximumNumberOfColumns property and check
648- that the resulting number of columns matches expectations */
649- function test_maximumNumberOfColumns(data) {
650- minHSpacingSelector.selectedIndex = 0
651-
652- // sanity checks
653- compare(maxColumnsSelector.values[data.selectedIndex], data.maxColumnCount)
654- compare(minHSpacingSelector.values[0], 0)
655-
656- maxColumnsSelector.selectedIndex = data.selectedIndex
657- tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount);
658- compare(grid.columns, data.columnCount)
659- }
660-
661- function test_minimumHorizontalSpacing_data() {
662- var data = new Array()
663-
664- data.push({selectedIndex: 0, minHSpacing:0, columnCount: 13})
665- data.push({selectedIndex: 1, minHSpacing:units.gu(2), columnCount: 9})
666- data.push({selectedIndex: 2, minHSpacing:units.gu(8), columnCount: 5})
667- data.push({selectedIndex: 3, minHSpacing:units.gu(25), columnCount: 2})
668-
669- return data
670- }
671-
672- /* Change ResponsiveGridView's minimumHorizontalSpacing property and check
673- that the resulting number of columns matches expectations */
674- function test_minimumHorizontalSpacing(data) {
675- maxColumnsSelector.selectedIndex = 4
676-
677- // sanity checks
678- compare(maxColumnsSelector.values[4], 1000)
679- compare(minHSpacingSelector.values[data.selectedIndex], data.minHSpacing)
680-
681- minHSpacingSelector.selectedIndex = data.selectedIndex
682- tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount);
683- compare(grid.columns, data.columnCount)
684- }
685-
686-
687- function countGridDelegatesOnFirstRow() {
688- return __countGridDelegatesOnFirstRow(grid.visibleChildren, 0)
689- }
690-
691- function __countGridDelegatesOnFirstRow(objList, total) {
692- for (var i = 0; i < objList.length; ++i) {
693- var child = objList[i];
694- if (child.isGridDelegate !== undefined && child.y === 0) {
695- ++total;
696- } else {
697- total = __countGridDelegatesOnFirstRow(child.visibleChildren, total)
698- }
699- }
700- return total
701- }
702- }
703-
704 Column {
705 id: controls
706 width: units.gu(40)
707@@ -189,4 +117,76 @@
708 }
709 }
710 }
711+
712+ UnityTestCase {
713+ name: "ResponsiveGridView"
714+ when: windowShown
715+
716+ function test_maximumNumberOfColumns_data() {
717+ var data = new Array()
718+
719+ data.push({selectedIndex: 0, maxColumnCount:2, columnCount: 2})
720+ data.push({selectedIndex: 1, maxColumnCount:4, columnCount: 4})
721+ data.push({selectedIndex: 2, maxColumnCount:8, columnCount: 8})
722+ data.push({selectedIndex: 4, maxColumnCount:1000, columnCount: 13})
723+
724+ return data
725+ }
726+
727+ /* Change ResponsiveGridView's maximumNumberOfColumns property and check
728+ that the resulting number of columns matches expectations */
729+ function test_maximumNumberOfColumns(data) {
730+ minHSpacingSelector.selectedIndex = 0
731+
732+ // sanity checks
733+ compare(maxColumnsSelector.values[data.selectedIndex], data.maxColumnCount)
734+ compare(minHSpacingSelector.values[0], 0)
735+
736+ maxColumnsSelector.selectedIndex = data.selectedIndex
737+ tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount);
738+ compare(grid.columns, data.columnCount)
739+ }
740+
741+ function test_minimumHorizontalSpacing_data() {
742+ var data = new Array()
743+
744+ data.push({selectedIndex: 0, minHSpacing:0, columnCount: 13})
745+ data.push({selectedIndex: 1, minHSpacing:units.gu(2), columnCount: 9})
746+ data.push({selectedIndex: 2, minHSpacing:units.gu(8), columnCount: 5})
747+ data.push({selectedIndex: 3, minHSpacing:units.gu(25), columnCount: 2})
748+
749+ return data
750+ }
751+
752+ /* Change ResponsiveGridView's minimumHorizontalSpacing property and check
753+ that the resulting number of columns matches expectations */
754+ function test_minimumHorizontalSpacing(data) {
755+ maxColumnsSelector.selectedIndex = 4
756+
757+ // sanity checks
758+ compare(maxColumnsSelector.values[4], 1000)
759+ compare(minHSpacingSelector.values[data.selectedIndex], data.minHSpacing)
760+
761+ minHSpacingSelector.selectedIndex = data.selectedIndex
762+ tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount);
763+ compare(grid.columns, data.columnCount)
764+ }
765+
766+
767+ function countGridDelegatesOnFirstRow() {
768+ return __countGridDelegatesOnFirstRow(grid.visibleChildren, 0)
769+ }
770+
771+ function __countGridDelegatesOnFirstRow(objList, total) {
772+ for (var i = 0; i < objList.length; ++i) {
773+ var child = objList[i];
774+ if (child.isGridDelegate !== undefined && child.y === 0) {
775+ ++total;
776+ } else {
777+ total = __countGridDelegatesOnFirstRow(child.visibleChildren, total)
778+ }
779+ }
780+ return total
781+ }
782+ }
783 }
784
785=== modified file 'tests/qmluitests/Components/tst_Revealer.qml'
786--- tests/qmluitests/Components/tst_Revealer.qml 2013-04-08 17:08:40 +0000
787+++ tests/qmluitests/Components/tst_Revealer.qml 2013-04-09 15:54:20 +0000
788@@ -28,12 +28,39 @@
789 + black rects).
790 */
791 Item {
792- id: rootItem
793 width: units.gu(75)
794 height: units.gu(50)
795
796+ RevealingRectangle {
797+ id: topRevealingRectangle
798+ anchors.fill: parent
799+ orientation: Qt.Vertical
800+ direction: Qt.LeftToRight
801+ }
802+
803+ RevealingRectangle {
804+ id: bottomRevealingRectangle
805+ anchors.fill: parent
806+ orientation: Qt.Vertical
807+ direction: Qt.RightToLeft
808+ }
809+
810+ RevealingRectangle {
811+ id: leftRevealingRectangle
812+ anchors.fill: parent
813+ orientation: Qt.Horizontal
814+ direction: Qt.LeftToRight
815+ }
816+
817+ RevealingRectangle {
818+ id: rightRevealingRectangle
819+ anchors.fill: parent
820+ orientation: Qt.Horizontal
821+ direction: Qt.RightToLeft
822+ }
823+
824 UnityTestCase {
825- name: "RevealerTest"
826+ name: "Revealer"
827 when: windowShown
828
829 /*
830@@ -231,33 +258,5 @@
831 tryCompare(showable, "y", -showable.height)
832 }
833 }
834-
835- RevealingRectangle {
836- id: topRevealingRectangle
837- anchors.fill: parent
838- orientation: Qt.Vertical
839- direction: Qt.LeftToRight
840- }
841-
842- RevealingRectangle {
843- id: bottomRevealingRectangle
844- anchors.fill: parent
845- orientation: Qt.Vertical
846- direction: Qt.RightToLeft
847- }
848-
849- RevealingRectangle {
850- id: leftRevealingRectangle
851- anchors.fill: parent
852- orientation: Qt.Horizontal
853- direction: Qt.LeftToRight
854- }
855-
856- RevealingRectangle {
857- id: rightRevealingRectangle
858- anchors.fill: parent
859- orientation: Qt.Horizontal
860- direction: Qt.RightToLeft
861- }
862 }
863
864
865=== modified file 'tests/qmluitests/Components/tst_Showable.qml'
866--- tests/qmluitests/Components/tst_Showable.qml 2013-04-08 17:08:40 +0000
867+++ tests/qmluitests/Components/tst_Showable.qml 2013-04-09 15:54:20 +0000
868@@ -28,12 +28,80 @@
869 This transparency change is the animation change set for the show/hide of the showable.
870 */
871 Item {
872- id: rootItem
873 width: units.gu(40)
874 height: units.gu(60)
875
876+ Showable {
877+ id: show1
878+ anchors.left: parent.left
879+ anchors.top: parent.top
880+ anchors.right: parent.right
881+ height: units.gu(20)
882+
883+ opacity: 0.2
884+ shown: false
885+ hides: [show2, show3]
886+ showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
887+ hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
888+
889+ Rectangle {
890+ anchors.fill: parent
891+ color: "red"
892+ }
893+ MouseArea {
894+ anchors.fill: parent
895+ onClicked: { parent.show() }
896+ }
897+ }
898+
899+ Showable {
900+ id: show2
901+ anchors.left: parent.left
902+ anchors.top: show1.bottom
903+ anchors.right: parent.right
904+ height: units.gu(20)
905+
906+ opacity: 0.2
907+ shown: false
908+ hides: [show1, show3]
909+ showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
910+ hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
911+
912+ Rectangle {
913+ anchors.fill: parent
914+ color: "green"
915+ }
916+ MouseArea {
917+ anchors.fill: parent
918+ onClicked: { parent.show() }
919+ }
920+ }
921+
922+ Showable {
923+ id: show3
924+ anchors.left: parent.left
925+ anchors.top: show2.bottom
926+ anchors.right: parent.right
927+ anchors.bottom: parent.bottom
928+
929+ opacity: 0.1
930+ shown: false
931+ hides: [show1, show2]
932+ showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
933+ hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
934+
935+ Rectangle {
936+ anchors.fill: parent
937+ color: "blue"
938+ }
939+ MouseArea {
940+ anchors.fill: parent
941+ onClicked: { parent.show() }
942+ }
943+ }
944+
945 UnityTestCase {
946- name: "ShowableTest"
947+ name: "Showable"
948 when: windowShown
949
950 function init_test() {
951@@ -87,73 +155,4 @@
952 compare(show1.shown, true, "Showable should automatically show when created changes to true if attempted to show before.");
953 }
954 }
955-
956- Showable {
957- id: show1
958- anchors.left: parent.left
959- anchors.top: parent.top
960- anchors.right: parent.right
961- height: units.gu(20)
962-
963- opacity: 0.2
964- shown: false
965- hides: [show2, show3]
966- showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
967- hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
968-
969- Rectangle {
970- anchors.fill: parent
971- color: "red"
972- }
973- MouseArea {
974- anchors.fill: parent
975- onClicked: { parent.show() }
976- }
977- }
978-
979- Showable {
980- id: show2
981- anchors.left: parent.left
982- anchors.top: show1.bottom
983- anchors.right: parent.right
984- height: units.gu(20)
985-
986- opacity: 0.2
987- shown: false
988- hides: [show1, show3]
989- showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
990- hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
991-
992- Rectangle {
993- anchors.fill: parent
994- color: "green"
995- }
996- MouseArea {
997- anchors.fill: parent
998- onClicked: { parent.show() }
999- }
1000- }
1001-
1002- Showable {
1003- id: show3
1004- anchors.left: parent.left
1005- anchors.top: show2.bottom
1006- anchors.right: parent.right
1007- anchors.bottom: parent.bottom
1008-
1009- opacity: 0.1
1010- shown: false
1011- hides: [show1, show2]
1012- showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
1013- hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
1014-
1015- Rectangle {
1016- anchors.fill: parent
1017- color: "blue"
1018- }
1019- MouseArea {
1020- anchors.fill: parent
1021- onClicked: { parent.show() }
1022- }
1023- }
1024 }
1025
1026=== modified file 'tests/qmluitests/Components/tst_Stage.qml'
1027--- tests/qmluitests/Components/tst_Stage.qml 2013-04-08 17:08:40 +0000
1028+++ tests/qmluitests/Components/tst_Stage.qml 2013-04-09 15:54:20 +0000
1029@@ -23,151 +23,9 @@
1030 import "tst_Stage"
1031
1032 Rectangle {
1033- id: root
1034-
1035 width: units.gu(70)
1036 height: stageRect.height
1037
1038- UnityTestCase {
1039- name: "StageTest"
1040- when: windowShown
1041-
1042- /* If you press Stage's right edge it should show the hint that it's possible to
1043- switch to the next running application. This means (graphically) sliding the
1044- next application window from Stage's right edge for a small part of its width */
1045- function test_pressingRightEdgeShowsHint() {
1046-
1047- // it shoulnd't be showing anything at first
1048- compare(stage.usingScreenshots, false)
1049-
1050- redControl.checked = true
1051-
1052- tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1053- wait(600)
1054- tryCompare(stage, "usingScreenshots", false) // and then for it to end
1055- compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
1056- compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
1057-
1058- greenControl.checked = true
1059-
1060- tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1061- wait(600)
1062- tryCompare(stage, "usingScreenshots", false) // and then for it to end
1063- compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green")
1064- compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green")
1065-
1066- var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
1067- var draggingAreaCenterY = stage.height / 2
1068- mousePress(stage, draggingAreaCenterX, draggingAreaCenterY)
1069-
1070- // wait for the animation to start
1071- tryCompare(stage, "usingScreenshots", true)
1072-
1073- // "red" should be the new/next application being shown
1074- compare(newAppScreenshot.application.desktopFile, "red")
1075- tryCompareFunction(isShowingABitOfNewApp, true);
1076-
1077- // "green" should be the current application being shown
1078- compare(oldAppScreenshot.application.desktopFile, "green")
1079- tryCompareFunction(isCurrentAppFadingOut, true);
1080-
1081- mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY)
1082- }
1083-
1084- function isShowingABitOfNewApp() {
1085- // it should come from the right and take less than half of the screen
1086- // but at least 15% of it
1087- return newAppScreenshot.x > stage.width/2
1088- && newAppScreenshot.x < stage.width*(85/100)
1089- && newAppScreenshot.y === 0
1090- && newAppScreenshot.visible
1091- }
1092-
1093- function isCurrentAppFadingOut() {
1094- // it should get a bit translucent and smaller
1095- return oldAppScreenshot.opacity < 0.98
1096- && oldAppScreenshot.opacity >= 0.1
1097- && oldAppScreenshot.scale < 0.98
1098- && oldAppScreenshot.scale >= 0.1
1099- && oldAppScreenshot.visible
1100- }
1101-
1102- function init() {
1103- redControl.checked = false;
1104- greenControl.checked = false;
1105- blueControl.checked = false;
1106- // give some room for animations to start
1107- wait(50)
1108- // wait until animations end, if any
1109- tryCompare(stage, "usingScreenshots", false)
1110- }
1111-
1112- /* If you flick from the right edge of the stage leftwards it should cause an
1113- application switch. */
1114- function test_dragFromRightEdgeToSwitchApplication() {
1115- // it shoulnd't be showing anything at first
1116- compare(stage.usingScreenshots, false)
1117-
1118- redControl.checked = true
1119-
1120- tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1121- tryCompare(stage, "usingScreenshots", false) // and then for it to end
1122- compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
1123- compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
1124-
1125- greenControl.checked = true
1126-
1127- tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1128- tryCompare(stage, "usingScreenshots", false) // and then for it to end
1129- compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green")
1130- compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green")
1131-
1132- var mouseX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
1133- var mouseY = stage.height / 2
1134- mouseFlick(stage, mouseX, mouseY,
1135- mouseX - units.gu(5), mouseY)
1136-
1137- // wait until animations end, if any
1138- tryCompare(stage, "usingScreenshots", false)
1139-
1140- // "red" should be the new topmost, focused, application
1141- compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
1142- compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
1143- }
1144-
1145- /* When an application is launched, it needs a background before it's drawn on screen
1146- so that the user does not see the previous running app while the new one is launching.
1147- When switching between applications, backgrounds are unnecessary, 'cause the
1148- applications are in front of them. */
1149- function test_background() {
1150- // it shoulnd't be showing anything at first
1151- compare(stage.usingScreenshots, false)
1152-
1153- redControl.checked = true
1154- tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1155-
1156- compare(newAppScreenshot.withBackground, true, "starting app screenshot does not have background enabled")
1157-
1158- tryCompare(stage, "usingScreenshots", false) // wait for the animation to finish
1159-
1160- greenControl.checked = true
1161- tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1162- tryCompare(stage, "usingScreenshots", false) // and finish
1163-
1164- var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
1165- var draggingAreaCenterY = stage.height / 2
1166- mousePress(stage, draggingAreaCenterX, draggingAreaCenterY)
1167-
1168- // wait for the animation to start
1169- tryCompare(stage, "usingScreenshots", true)
1170-
1171- compare(newAppScreenshot.withBackground, false, "switched app does have background enabled")
1172-
1173- tryCompareFunction(isShowingABitOfNewApp, true); // wait for the hint animation to finish
1174- mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY)
1175- }
1176- }
1177-
1178 // Even though we replace the ApplicationScreenshot instances in Stage
1179 // with our own fake ones, ApplicationScreenshot.qml still gives out a warning
1180 // if shell.importUbuntuApplicationAvailable is missing.
1181@@ -331,4 +189,144 @@
1182 AppControl {id: blueControl; desktopFile:"blue"}
1183 }
1184 }
1185+
1186+ UnityTestCase {
1187+ name: "Stage"
1188+ when: windowShown
1189+
1190+ /* If you press Stage's right edge it should show the hint that it's possible to
1191+ switch to the next running application. This means (graphically) sliding the
1192+ next application window from Stage's right edge for a small part of its width */
1193+ function test_pressingRightEdgeShowsHint() {
1194+
1195+ // it shoulnd't be showing anything at first
1196+ compare(stage.usingScreenshots, false)
1197+
1198+ redControl.checked = true
1199+
1200+ tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1201+ wait(600)
1202+ tryCompare(stage, "usingScreenshots", false) // and then for it to end
1203+ compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
1204+ compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
1205+
1206+ greenControl.checked = true
1207+
1208+ tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1209+ wait(600)
1210+ tryCompare(stage, "usingScreenshots", false) // and then for it to end
1211+ compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green")
1212+ compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green")
1213+
1214+ var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
1215+ var draggingAreaCenterY = stage.height / 2
1216+ mousePress(stage, draggingAreaCenterX, draggingAreaCenterY)
1217+
1218+ // wait for the animation to start
1219+ tryCompare(stage, "usingScreenshots", true)
1220+
1221+ // "red" should be the new/next application being shown
1222+ compare(newAppScreenshot.application.desktopFile, "red")
1223+ tryCompareFunction(isShowingABitOfNewApp, true);
1224+
1225+ // "green" should be the current application being shown
1226+ compare(oldAppScreenshot.application.desktopFile, "green")
1227+ tryCompareFunction(isCurrentAppFadingOut, true);
1228+
1229+ mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY)
1230+ }
1231+
1232+ function isShowingABitOfNewApp() {
1233+ // it should come from the right and take less than half of the screen
1234+ // but at least 15% of it
1235+ return newAppScreenshot.x > stage.width/2
1236+ && newAppScreenshot.x < stage.width*(85/100)
1237+ && newAppScreenshot.y === 0
1238+ && newAppScreenshot.visible
1239+ }
1240+
1241+ function isCurrentAppFadingOut() {
1242+ // it should get a bit translucent and smaller
1243+ return oldAppScreenshot.opacity < 0.98
1244+ && oldAppScreenshot.opacity >= 0.1
1245+ && oldAppScreenshot.scale < 0.98
1246+ && oldAppScreenshot.scale >= 0.1
1247+ && oldAppScreenshot.visible
1248+ }
1249+
1250+ function init() {
1251+ redControl.checked = false;
1252+ greenControl.checked = false;
1253+ blueControl.checked = false;
1254+ // give some room for animations to start
1255+ wait(50)
1256+ // wait until animations end, if any
1257+ tryCompare(stage, "usingScreenshots", false)
1258+ }
1259+
1260+ /* If you flick from the right edge of the stage leftwards it should cause an
1261+ application switch. */
1262+ function test_dragFromRightEdgeToSwitchApplication() {
1263+ // it shoulnd't be showing anything at first
1264+ compare(stage.usingScreenshots, false)
1265+
1266+ redControl.checked = true
1267+
1268+ tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1269+ tryCompare(stage, "usingScreenshots", false) // and then for it to end
1270+ compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
1271+ compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
1272+
1273+ greenControl.checked = true
1274+
1275+ tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1276+ tryCompare(stage, "usingScreenshots", false) // and then for it to end
1277+ compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green")
1278+ compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green")
1279+
1280+ var mouseX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
1281+ var mouseY = stage.height / 2
1282+ mouseFlick(stage, mouseX, mouseY,
1283+ mouseX - units.gu(5), mouseY)
1284+
1285+ // wait until animations end, if any
1286+ tryCompare(stage, "usingScreenshots", false)
1287+
1288+ // "red" should be the new topmost, focused, application
1289+ compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
1290+ compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
1291+ }
1292+
1293+ /* When an application is launched, it needs a background before it's drawn on screen
1294+ so that the user does not see the previous running app while the new one is launching.
1295+ When switching between applications, backgrounds are unnecessary, 'cause the
1296+ applications are in front of them. */
1297+ function test_background() {
1298+ // it shoulnd't be showing anything at first
1299+ compare(stage.usingScreenshots, false)
1300+
1301+ redControl.checked = true
1302+ tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1303+
1304+ compare(newAppScreenshot.withBackground, true, "starting app screenshot does not have background enabled")
1305+
1306+ tryCompare(stage, "usingScreenshots", false) // wait for the animation to finish
1307+
1308+ greenControl.checked = true
1309+ tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
1310+ tryCompare(stage, "usingScreenshots", false) // and finish
1311+
1312+ var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
1313+ var draggingAreaCenterY = stage.height / 2
1314+ mousePress(stage, draggingAreaCenterX, draggingAreaCenterY)
1315+
1316+ // wait for the animation to start
1317+ tryCompare(stage, "usingScreenshots", true)
1318+
1319+ compare(newAppScreenshot.withBackground, false, "switched app does have background enabled")
1320+
1321+ tryCompareFunction(isShowingABitOfNewApp, true); // wait for the hint animation to finish
1322+ mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY)
1323+ }
1324+ }
1325 }
1326
1327=== modified file 'tests/qmluitests/Components/tst_Stage/FakeApplicationScreenshot.qml'
1328--- tests/qmluitests/Components/tst_Stage/FakeApplicationScreenshot.qml 2013-04-09 12:30:58 +0000
1329+++ tests/qmluitests/Components/tst_Stage/FakeApplicationScreenshot.qml 2013-04-09 15:54:20 +0000
1330@@ -17,8 +17,6 @@
1331 import QtQuick 2.0
1332
1333 Item {
1334- id: root
1335-
1336 property var application
1337 property bool withBackground: true
1338 property bool ready: application != undefined
1339
1340=== modified file 'tests/qmluitests/Components/tst_Tile.qml'
1341--- tests/qmluitests/Components/tst_Tile.qml 2013-04-08 17:08:40 +0000
1342+++ tests/qmluitests/Components/tst_Tile.qml 2013-04-09 15:54:20 +0000
1343@@ -27,8 +27,17 @@
1344
1345 property bool helper: false
1346
1347+ Tile {
1348+ id: tile
1349+ anchors.fill: parent
1350+ source: "../../../graphics/clock@18.png"
1351+ text: "Testing rocks, debugging sucks!"
1352+ imageWidth: width
1353+ imageHeight: width
1354+ }
1355+
1356 UnityTestCase {
1357- name: "TileTest"
1358+ name: "Tile"
1359 when: windowShown
1360
1361 function test_click_highlight() {
1362@@ -58,13 +67,4 @@
1363 mouseRelease(label, 1, 1)
1364 }
1365 }
1366-
1367- Tile {
1368- id: tile
1369- anchors.fill: parent
1370- source: "../../../graphics/clock@18.png"
1371- text: "Testing rocks, debugging sucks!"
1372- imageWidth: width
1373- imageHeight: width
1374- }
1375 }
1376
1377=== modified file 'tests/qmluitests/Dash/tst_DashPreview.qml'
1378--- tests/qmluitests/Dash/tst_DashPreview.qml 2013-04-08 17:08:40 +0000
1379+++ tests/qmluitests/Dash/tst_DashPreview.qml 2013-04-09 15:54:20 +0000
1380@@ -27,8 +27,72 @@
1381
1382 property bool helper: false
1383
1384+ DashPreview {
1385+ id: preview
1386+ anchors.fill: parent
1387+ title: "Testing rocks, debugging sucks!"
1388+ forceSquare: true
1389+
1390+ buttons: Row {
1391+ width: parent.width
1392+ height: units.gu(5)
1393+ Rectangle {
1394+ width: parent.width / 3
1395+ height: parent.height
1396+ color: "blue"
1397+ MouseArea {
1398+ id: buttonMouseArea
1399+ objectName: "buttonMouseArea"
1400+ anchors.fill: parent
1401+ onClicked: root.helper = true
1402+ }
1403+ }
1404+ Rectangle {
1405+ width: parent.width / 3
1406+ height: parent.height
1407+ color: "green"
1408+ }
1409+ }
1410+
1411+ caption: Label { text: "Caption label" }
1412+
1413+ description: Column {
1414+ id: testContent
1415+ objectName: "testContent"
1416+ width: parent.width
1417+ height: units.gu(50)
1418+ Rectangle {
1419+ width: parent.width
1420+ height: parent.height / 3
1421+ color: "green"
1422+ }
1423+ Rectangle {
1424+ width: parent.width
1425+ height: parent.height / 3
1426+ color: "red"
1427+ }
1428+ Rectangle {
1429+ width: parent.width
1430+ height: parent.height / 3
1431+ color: "blue"
1432+ }
1433+ }
1434+ }
1435+
1436+ SignalSpy {
1437+ id: closeSpy
1438+ target: preview
1439+ signalName: "close"
1440+ }
1441+
1442+ SignalSpy {
1443+ id: previewClickedSpy
1444+ target: preview
1445+ signalName: "previewImageClicked"
1446+ }
1447+
1448 UnityTestCase {
1449- name: "PreviewTest"
1450+ name: "DashPreview"
1451 when: windowShown
1452
1453 function test_close() {
1454@@ -108,70 +172,5 @@
1455 // reset to false in case any other test wants to use it
1456 root.helper = false
1457 }
1458-
1459- }
1460-
1461- DashPreview {
1462- id: preview
1463- anchors.fill: parent
1464- title: "Testing rocks, debugging sucks!"
1465- forceSquare: true
1466-
1467- buttons: Row {
1468- width: parent.width
1469- height: units.gu(5)
1470- Rectangle {
1471- width: parent.width / 3
1472- height: parent.height
1473- color: "blue"
1474- MouseArea {
1475- id: buttonMouseArea
1476- objectName: "buttonMouseArea"
1477- anchors.fill: parent
1478- onClicked: root.helper = true
1479- }
1480- }
1481- Rectangle {
1482- width: parent.width / 3
1483- height: parent.height
1484- color: "green"
1485- }
1486- }
1487-
1488- caption: Label { text: "Caption label" }
1489-
1490- description: Column {
1491- id: testContent
1492- objectName: "testContent"
1493- width: parent.width
1494- height: units.gu(50)
1495- Rectangle {
1496- width: parent.width
1497- height: parent.height / 3
1498- color: "green"
1499- }
1500- Rectangle {
1501- width: parent.width
1502- height: parent.height / 3
1503- color: "red"
1504- }
1505- Rectangle {
1506- width: parent.width
1507- height: parent.height / 3
1508- color: "blue"
1509- }
1510- }
1511- }
1512-
1513- SignalSpy {
1514- id: closeSpy
1515- target: preview
1516- signalName: "close"
1517- }
1518-
1519- SignalSpy {
1520- id: previewClickedSpy
1521- target: preview
1522- signalName: "previewImageClicked"
1523 }
1524 }
1525
1526=== modified file 'tests/qmluitests/Greeter/tst_Greeter.qml'
1527--- tests/qmluitests/Greeter/tst_Greeter.qml 2013-04-08 17:08:40 +0000
1528+++ tests/qmluitests/Greeter/tst_Greeter.qml 2013-04-09 15:54:20 +0000
1529@@ -24,8 +24,25 @@
1530 width: units.gu(120)
1531 height: units.gu(80)
1532
1533+ Greeter {
1534+ id: greeter
1535+ anchors.fill: parent
1536+ }
1537+
1538+ SignalSpy {
1539+ id: unlockSpy
1540+ target: greeter
1541+ signalName: "unlocked"
1542+ }
1543+
1544+ SignalSpy {
1545+ id: selectionSpy
1546+ target: greeter
1547+ signalName: "selected"
1548+ }
1549+
1550 UnityTestCase {
1551- name: "GreeterTest"
1552+ name: "Greeter"
1553 when: windowShown
1554
1555 function test_cycle_data() {
1556@@ -95,21 +112,4 @@
1557 compare(unlockSpy.count, 1)
1558 }
1559 }
1560-
1561- Greeter {
1562- id: greeter
1563- anchors.fill: parent
1564- }
1565-
1566- SignalSpy {
1567- id: unlockSpy
1568- target: greeter
1569- signalName: "unlocked"
1570- }
1571-
1572- SignalSpy {
1573- id: selectionSpy
1574- target: greeter
1575- signalName: "selected"
1576- }
1577 }
1578
1579=== modified file 'tests/qmluitests/Hud/tst_Hud.qml'
1580--- tests/qmluitests/Hud/tst_Hud.qml 2013-04-08 17:08:40 +0000
1581+++ tests/qmluitests/Hud/tst_Hud.qml 2013-04-09 15:54:20 +0000
1582@@ -33,8 +33,12 @@
1583 }
1584 }
1585
1586+ HudClientStub {
1587+ id: hudClientStub
1588+ }
1589+
1590 UnityTestCase {
1591- name: "HudTest"
1592+ name: "Hud"
1593 when: windowShown
1594
1595 function resetToInitialState() {
1596@@ -277,8 +281,4 @@
1597 compare(hudClientStub.lastParametrizedCommandCommited, true, "Confirming does commit")
1598 }
1599 }
1600-
1601- HudClientStub {
1602- id: hudClientStub
1603- }
1604 }
1605
1606=== modified file 'tests/qmluitests/Launcher/tst_Launcher.qml'
1607--- tests/qmluitests/Launcher/tst_Launcher.qml 2013-04-08 17:08:40 +0000
1608+++ tests/qmluitests/Launcher/tst_Launcher.qml 2013-04-09 15:54:20 +0000
1609@@ -23,13 +23,40 @@
1610 /* Nothing is shown at first. If you drag from left edge you will bring up the
1611 launcher. */
1612 Item {
1613- id: root
1614 width: units.gu(50)
1615 height: units.gu(81)
1616
1617+ Launcher {
1618+ id: launcher
1619+ x: 0
1620+ y: 0
1621+ width: units.gu(40)
1622+ height: units.gu(71)
1623+
1624+ favourites: ["/usr/share/applications/phone-app.desktop",
1625+ "/usr/share/applications/camera-app.desktop",
1626+ "/usr/share/applications/gallery-app.desktop"]
1627+
1628+ shortcutsWidth: units.gu(9)
1629+ shortcutsThreshold: units.gu(2)
1630+ iconPath: "graphics/applicationIcons"
1631+ __dateTime: testCase.fakeDateTime
1632+
1633+ property string latestApplicationSelected
1634+
1635+ onLauncherApplicationSelected: {
1636+ latestApplicationSelected = name
1637+ }
1638+
1639+ property int dashItemSelected_count: 0
1640+ onDashItemSelected: {
1641+ dashItemSelected_count++;
1642+ }
1643+ }
1644+
1645 UnityTestCase {
1646 id: testCase
1647- name: "LauncherTest"
1648+ name: "Launcher"
1649 when: windowShown
1650
1651 // Drag from the left edge of the screen rightwards and check that the launcher
1652@@ -215,32 +242,4 @@
1653 tryCompare(shortcuts, "x", -shortcuts.width, 1000)
1654 }
1655 }
1656-
1657- Launcher {
1658- id: launcher
1659- x: 0
1660- y: 0
1661- width: units.gu(40)
1662- height: units.gu(71)
1663-
1664- favourites: ["/usr/share/applications/phone-app.desktop",
1665- "/usr/share/applications/camera-app.desktop",
1666- "/usr/share/applications/gallery-app.desktop"]
1667-
1668- shortcutsWidth: units.gu(9)
1669- shortcutsThreshold: units.gu(2)
1670- iconPath: "graphics/applicationIcons"
1671- __dateTime: testCase.fakeDateTime
1672-
1673- property string latestApplicationSelected
1674-
1675- onLauncherApplicationSelected: {
1676- latestApplicationSelected = name
1677- }
1678-
1679- property int dashItemSelected_count: 0
1680- onDashItemSelected: {
1681- dashItemSelected_count++;
1682- }
1683- }
1684 }
1685
1686=== modified file 'tests/qmluitests/Panel/tst_IndicatorRow.qml'
1687--- tests/qmluitests/Panel/tst_IndicatorRow.qml 2013-04-08 17:08:40 +0000
1688+++ tests/qmluitests/Panel/tst_IndicatorRow.qml 2013-04-09 15:54:20 +0000
1689@@ -36,8 +36,26 @@
1690 indicatorRow.currentItem = null;
1691 }
1692
1693+ PanelBackground {
1694+ anchors.fill: indicatorRow
1695+ }
1696+
1697+ IndicatorRow {
1698+ id: indicatorRow
1699+ anchors {
1700+ left: parent.left
1701+ right: parent.right
1702+ }
1703+
1704+ indicatorsModel: indicatorModel
1705+ }
1706+
1707+ ChewieUI.PluginModel {
1708+ id: indicatorModel
1709+ }
1710+
1711 UnityTestCase {
1712- name: "IndicatorRowTest"
1713+ name: "IndicatorRow"
1714 when: windowShown
1715
1716 function test_set_current_item() {
1717@@ -54,7 +72,7 @@
1718 }
1719
1720 UnityTestCase {
1721- name: "IndicatorRow_IconPositionTest"
1722+ name: "IndicatorRow_IconPosition"
1723 when: windowShown
1724
1725 function get_indicator_item_at(index) {
1726@@ -76,7 +94,7 @@
1727 }
1728
1729 UnityTestCase {
1730- name: "IndicatorRow_HighlightTest"
1731+ name: "IndicatorRow_Highlight"
1732 when: windowShown
1733
1734 function get_indicator_item_at(index) {
1735@@ -150,7 +168,7 @@
1736 }
1737
1738 UnityTestCase {
1739- name: "IndicatorRow_DimmedTest"
1740+ name: "IndicatorRow_Dimmed"
1741 when: windowShown
1742
1743 function get_indicator_item_at(index) {
1744@@ -235,22 +253,4 @@
1745 compare(get_indicator_item_at(4).dimmed, true, "Indicator should dim when in overview");
1746 }
1747 }
1748-
1749- PanelBackground {
1750- anchors.fill: indicatorRow
1751- }
1752-
1753- IndicatorRow {
1754- id: indicatorRow
1755- anchors {
1756- left: parent.left
1757- right: parent.right
1758- }
1759-
1760- indicatorsModel: indicatorModel
1761- }
1762-
1763- ChewieUI.PluginModel {
1764- id: indicatorModel
1765- }
1766 }
1767
1768=== modified file 'tests/qmluitests/Panel/tst_SearchIndicator.qml'
1769--- tests/qmluitests/Panel/tst_SearchIndicator.qml 2013-04-09 09:58:41 +0000
1770+++ tests/qmluitests/Panel/tst_SearchIndicator.qml 2013-04-09 15:54:20 +0000
1771@@ -24,8 +24,19 @@
1772 width: units.gu(9)
1773 height: units.gu(3)
1774
1775+ SignalSpy {
1776+ id: clickedSpy
1777+ target: searchIndicator
1778+ signalName: "clicked"
1779+ }
1780+
1781+ SearchIndicator {
1782+ id: searchIndicator
1783+ anchors.fill: parent
1784+ }
1785+
1786 UnityTestCase {
1787- name: "SearchIndicatorTest"
1788+ name: "SearchIndicator"
1789 when: windowShown
1790
1791 function test_clickedSignal() {
1792@@ -49,15 +60,4 @@
1793 tryCompare(container, "y", 0)
1794 }
1795 }
1796-
1797- SignalSpy {
1798- id: clickedSpy
1799- target: searchIndicator
1800- signalName: "clicked"
1801- }
1802-
1803- SearchIndicator {
1804- id: searchIndicator
1805- anchors.fill: parent
1806- }
1807 }
1808
1809=== modified file 'tests/unittests/Components/tst_AnimationControllerWithSignals.qml'
1810--- tests/unittests/Components/tst_AnimationControllerWithSignals.qml 2013-04-08 16:25:49 +0000
1811+++ tests/unittests/Components/tst_AnimationControllerWithSignals.qml 2013-04-09 15:54:20 +0000
1812@@ -20,104 +20,10 @@
1813
1814 TestCase {
1815 id: testCase
1816- name: "AnimationControllerWithSignalsTest"
1817+ name: "AnimationControllerWithSignals"
1818
1819 property real someNumber: 0.0
1820
1821- function test_completeToEndWithSignal() {
1822- loader.sourceComponent = testSubjectComponent;
1823- var testSubject = loader.item;
1824-
1825- testSubject.animation = someNumberAnimation;
1826- testSubject.progress = 0;
1827-
1828- signalSpy.signalName = "animationCompletedAtEnd";
1829- signalSpy.target = testSubject;
1830- signalSpy.clear();
1831-
1832- compare(testSubject.completing, false)
1833- compare(testSubject.completed, true)
1834-
1835- testSubject.completeToEndWithSignal();
1836- compare(testSubject.completing, true)
1837- compare(testSubject.completed, true)
1838- compare(signalSpy.count, 0);
1839-
1840- testSubject.progress = 0.5;
1841- compare(testSubject.completing, true)
1842- compare(testSubject.completed, false)
1843- compare(signalSpy.count, 0);
1844-
1845- testSubject.progress = 1.0;
1846- compare(testSubject.completing, false)
1847- compare(testSubject.completed, true)
1848- compare(signalSpy.count, 1);
1849-
1850- testSubject.animation = null
1851- loader.sourceComponent = undefined;
1852- }
1853-
1854- function test_completeToBeginningWithSignal() {
1855- loader.sourceComponent = testSubjectComponent;
1856- var testSubject = loader.item;
1857-
1858- testSubject.animation = someNumberAnimation;
1859- testSubject.progress = 1;
1860-
1861- signalSpy.signalName = "animationCompletedAtBeginning";
1862- signalSpy.target = testSubject;
1863- signalSpy.clear();
1864-
1865- compare(testSubject.completing, false)
1866- compare(testSubject.completed, true)
1867-
1868- testSubject.completeToBeginningWithSignal();
1869- compare(testSubject.completing, true)
1870- compare(testSubject.completed, true)
1871- compare(signalSpy.count, 0);
1872-
1873- testSubject.progress = 0.5;
1874- compare(testSubject.completing, true)
1875- compare(testSubject.completed, false)
1876- compare(signalSpy.count, 0);
1877-
1878- testSubject.progress = 0;
1879- compare(testSubject.completing, false)
1880- compare(testSubject.completed, true)
1881- compare(signalSpy.count, 1);
1882-
1883- testSubject.animation = null
1884- loader.sourceComponent = undefined;
1885- }
1886-
1887- function test_settingProgressWithoutCallingCompleteWithSignal() {
1888- loader.sourceComponent = testSubjectComponent;
1889- var testSubject = loader.item;
1890-
1891- testSubject.animation = someNumberAnimation;
1892- testSubject.progress = 0;
1893-
1894- signalSpy.signalName = "animationCompletedAtEnd";
1895- signalSpy.target = testSubject;
1896- signalSpy.clear();
1897-
1898- compare(testSubject.completing, false)
1899- compare(testSubject.completed, true)
1900-
1901- testSubject.progress = 0.5;
1902- compare(testSubject.completing, false)
1903- compare(testSubject.completed, false)
1904- compare(signalSpy.count, 0);
1905-
1906- testSubject.progress = 1;
1907- compare(testSubject.completing, false)
1908- compare(testSubject.completed, true)
1909- compare(signalSpy.count, 0);
1910-
1911- testSubject.animation = null
1912- loader.sourceComponent = undefined;
1913- }
1914-
1915 NumberAnimation {
1916 id: someNumberAnimation
1917 target: testCase
1918@@ -139,4 +45,98 @@
1919 SignalSpy {
1920 id: signalSpy
1921 }
1922+
1923+ function test_completeToEndWithSignal() {
1924+ loader.sourceComponent = testSubjectComponent;
1925+ var testSubject = loader.item;
1926+
1927+ testSubject.animation = someNumberAnimation;
1928+ testSubject.progress = 0;
1929+
1930+ signalSpy.signalName = "animationCompletedAtEnd";
1931+ signalSpy.target = testSubject;
1932+ signalSpy.clear();
1933+
1934+ compare(testSubject.completing, false)
1935+ compare(testSubject.completed, true)
1936+
1937+ testSubject.completeToEndWithSignal();
1938+ compare(testSubject.completing, true)
1939+ compare(testSubject.completed, true)
1940+ compare(signalSpy.count, 0);
1941+
1942+ testSubject.progress = 0.5;
1943+ compare(testSubject.completing, true)
1944+ compare(testSubject.completed, false)
1945+ compare(signalSpy.count, 0);
1946+
1947+ testSubject.progress = 1.0;
1948+ compare(testSubject.completing, false)
1949+ compare(testSubject.completed, true)
1950+ compare(signalSpy.count, 1);
1951+
1952+ testSubject.animation = null
1953+ loader.sourceComponent = undefined;
1954+ }
1955+
1956+ function test_completeToBeginningWithSignal() {
1957+ loader.sourceComponent = testSubjectComponent;
1958+ var testSubject = loader.item;
1959+
1960+ testSubject.animation = someNumberAnimation;
1961+ testSubject.progress = 1;
1962+
1963+ signalSpy.signalName = "animationCompletedAtBeginning";
1964+ signalSpy.target = testSubject;
1965+ signalSpy.clear();
1966+
1967+ compare(testSubject.completing, false)
1968+ compare(testSubject.completed, true)
1969+
1970+ testSubject.completeToBeginningWithSignal();
1971+ compare(testSubject.completing, true)
1972+ compare(testSubject.completed, true)
1973+ compare(signalSpy.count, 0);
1974+
1975+ testSubject.progress = 0.5;
1976+ compare(testSubject.completing, true)
1977+ compare(testSubject.completed, false)
1978+ compare(signalSpy.count, 0);
1979+
1980+ testSubject.progress = 0;
1981+ compare(testSubject.completing, false)
1982+ compare(testSubject.completed, true)
1983+ compare(signalSpy.count, 1);
1984+
1985+ testSubject.animation = null
1986+ loader.sourceComponent = undefined;
1987+ }
1988+
1989+ function test_settingProgressWithoutCallingCompleteWithSignal() {
1990+ loader.sourceComponent = testSubjectComponent;
1991+ var testSubject = loader.item;
1992+
1993+ testSubject.animation = someNumberAnimation;
1994+ testSubject.progress = 0;
1995+
1996+ signalSpy.signalName = "animationCompletedAtEnd";
1997+ signalSpy.target = testSubject;
1998+ signalSpy.clear();
1999+
2000+ compare(testSubject.completing, false)
2001+ compare(testSubject.completed, true)
2002+
2003+ testSubject.progress = 0.5;
2004+ compare(testSubject.completing, false)
2005+ compare(testSubject.completed, false)
2006+ compare(signalSpy.count, 0);
2007+
2008+ testSubject.progress = 1;
2009+ compare(testSubject.completing, false)
2010+ compare(testSubject.completed, true)
2011+ compare(signalSpy.count, 0);
2012+
2013+ testSubject.animation = null
2014+ loader.sourceComponent = undefined;
2015+ }
2016 }
2017
2018=== modified file 'tests/unittests/Components/tst_Carousel.qml'
2019--- tests/unittests/Components/tst_Carousel.qml 2013-04-08 16:25:49 +0000
2020+++ tests/unittests/Components/tst_Carousel.qml 2013-04-09 15:54:20 +0000
2021@@ -19,7 +19,7 @@
2022 import "../../../Components/carousel.js" as Carousel
2023
2024 TestCase {
2025- name: "CarouselTest"
2026+ name: "Carousel"
2027
2028 property real carouselWidth
2029 property int itemCount
2030@@ -47,6 +47,7 @@
2031 x: 600, carouselWidth:400, tileWidth:100, itemCount:10, result: 9},
2032 ]
2033 }
2034+
2035 function test_getContinuousIndex(data) {
2036 carouselWidth = data.carouselWidth
2037 tileWidth = data.tileWidth
2038@@ -80,6 +81,7 @@
2039 // index: 9, carouselWidth:400, tileWidth:100, itemCount:10, drawBuffer:100, result: 500},
2040 ]
2041 }
2042+
2043 function test_getXFromContinuousIndex(data) {
2044 carouselWidth = data.carouselWidth
2045 tileWidth = data.tileWidth
2046@@ -145,6 +147,7 @@
2047 {distance: 1, continuousIndex: 50, numberOfItems: 53, scaleFactor: 2, result: 0.996666666}, // = 1 - (1 / 300) - distanceToBounds is used
2048 ]
2049 }
2050+
2051 function test_getItemScale(data) {
2052 var scale = Carousel.getItemScale(data.distance,
2053 data.continuousIndex,
2054@@ -176,6 +179,7 @@
2055 {distance: 1, scale: 0, maxScale: 1, maxTranslation: 0, result: 0},
2056 ]
2057 }
2058+
2059 function test_getItemTranslation(data) {
2060 var scale = Carousel.getItemTranslation(data.distance,
2061 data.scale,
2062
2063=== modified file 'tests/unittests/Components/tst_CrossFadeImage.qml'
2064--- tests/unittests/Components/tst_CrossFadeImage.qml 2013-04-08 16:25:49 +0000
2065+++ tests/unittests/Components/tst_CrossFadeImage.qml 2013-04-09 15:54:20 +0000
2066@@ -19,7 +19,7 @@
2067 import "../../../Components"
2068
2069 TestCase {
2070- name: "CrossFadeImageTest"
2071+ name: "CrossFadeImage"
2072
2073 property alias status: crossFadeImage.status
2074 property alias source: crossFadeImage.source
2075@@ -27,6 +27,15 @@
2076 property alias fadeInFirst: crossFadeImage.fadeInFirst
2077 property alias running: crossFadeImage.running
2078
2079+ CrossFadeImage {
2080+ id: crossFadeImage
2081+ }
2082+
2083+ SignalSpy {
2084+ id: signalSpy
2085+ target: crossFadeImage
2086+ }
2087+
2088 function initTestFunction(argCrossFade, argFadeInFirst) {
2089 source = ""
2090 crossFade = argCrossFade
2091@@ -113,13 +122,4 @@
2092
2093 cleanupTest()
2094 }
2095-
2096- CrossFadeImage {
2097- id: crossFadeImage
2098- }
2099-
2100- SignalSpy {
2101- id: signalSpy
2102- target: crossFadeImage
2103- }
2104 }
2105
2106=== modified file 'tests/unittests/Components/tst_MathLocal.qml'
2107--- tests/unittests/Components/tst_MathLocal.qml 2013-04-08 16:25:49 +0000
2108+++ tests/unittests/Components/tst_MathLocal.qml 2013-04-09 15:54:20 +0000
2109@@ -19,7 +19,7 @@
2110 import "../../../Components/Math.js" as MathLocal
2111
2112 TestCase {
2113- name: "MathLocalTest"
2114+ name: "MathLocal"
2115
2116 property int minValue
2117 property int maxValue
2118
2119=== modified file 'tests/unittests/Components/tst_RatingStars.qml'
2120--- tests/unittests/Components/tst_RatingStars.qml 2013-04-08 16:25:49 +0000
2121+++ tests/unittests/Components/tst_RatingStars.qml 2013-04-09 15:54:20 +0000
2122@@ -19,12 +19,18 @@
2123 import "../../../Components"
2124
2125 TestCase {
2126- name: "RatingStarsTest"
2127+ name: "RatingStars"
2128
2129 property int maximumRating: 5
2130 property int rating: 3
2131 property alias effectiveRating: ratingStars.effectiveRating
2132
2133+ RatingStars {
2134+ id: ratingStars
2135+ maximumRating: parent.maximumRating
2136+ rating: parent.rating
2137+ }
2138+
2139 function test_rating_init() {
2140 compare(effectiveRating, rating, "EffectiveRating not initialized properly")
2141 }
2142@@ -53,10 +59,4 @@
2143 rating = maximumRating
2144 compare(effectiveRating, maximumRating, "EffectiveRating not calculated correctly")
2145 }
2146-
2147- RatingStars {
2148- id: ratingStars
2149- maximumRating: parent.maximumRating
2150- rating: parent.rating
2151- }
2152 }
2153
2154=== modified file 'tests/unittests/Components/tst_TimeLocal.qml'
2155--- tests/unittests/Components/tst_TimeLocal.qml 2013-04-08 16:25:49 +0000
2156+++ tests/unittests/Components/tst_TimeLocal.qml 2013-04-09 15:54:20 +0000
2157@@ -19,7 +19,7 @@
2158 import "../../../Components/Time.js" as TimeLocal
2159
2160 TestCase {
2161- name: "TimeLocalTest"
2162+ name: "TimeLocal"
2163
2164 property var readableDate
2165

Subscribers

People subscribed via source and target branches

to all changes: