Merge lp:~unity-team/unity/phablet.tests_coding-style into lp:unity/phablet

Proposed by Andrea Cimitan
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: no longer in the source branch.
Merged at revision: 562
Proposed branch: lp:~unity-team/unity/phablet.tests_coding-style
Merge into: lp:unity/phablet
Diff against target: 1944 lines (+776/-759)
21 files modified
tests/README (+25/-3)
tests/qmluitests/Components/tst_DraggingArea.qml (+79/-79)
tests/qmluitests/Components/tst_FilterGrid.qml (+81/-82)
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.tests_coding-style
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Daniel d'Andrada (community) Approve
Review via email: mp+157888@code.launchpad.net

Commit message

Coding styles for tests

Description of the change

Coding styles for tests

To post a comment you must log in.
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

"""
We follow a couple of coding guidelines, to keep consistency:
1. [...]
2. [...]
"""

This text is already under the "General Guidelines" section. So you don't have to say that you're talking about guidelines in the text itself. I.e. You can remove that first introductory line.
Secondly, the existing paragraphs in this section are not numbered. So you either have them all numbered or you don't number any of them.

-----------------------------

" 2. Both TestCase/UnityTestCase and their functions are placed after properties and Components being tested."

For the sake of clarity I would rephrase that to just:

" 2. The [Unity]TestCase comes after the Components being tested."

------------------------------

tests/unittests/README duplicates a lot of content from tests/qmluitest/README. Just as with source code, we should apply the "don't repeate yourself"[1] practice to documentation as well.
So if both dirs have recommendations in common, move the README to the tests parent dir. Adapt the first paragraph by modifying its beginning from "Tests here" to "Tests under qmluidir".

[1] - http://en.wikipedia.org/wiki/Don%27t_repeat_yourself

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

Copyright headers are merged now. Merge this with trunk and CI will pass again.

Revision history for this message
Daniel d'Andrada (dandrader) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

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

Subscribers

People subscribed via source and target branches

to all changes: