Merge lp:~tpeeters/ubuntu-ui-toolkit/cleanHeaderTests into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Cris Dywan
Approved revision: 1439
Merged at revision: 1441
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/cleanHeaderTests
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 625 lines (+301/-278)
6 files modified
tests/resources/header/actions.qml (+47/-0)
tests/resources/header/automaticColors.qml (+87/-0)
tests/resources/header/backButton.qml (+59/-0)
tests/resources/header/header.qml (+0/-278)
tests/resources/header/search.qml (+67/-0)
tests/resources/header/sections.qml (+41/-0)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/cleanHeaderTests
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+251534@code.launchpad.net

Commit message

Make the filenames for header and navigation tests consistent and split up the big tabbed header.qml into multiple smaller test files.

Description of the change

I took tests/resources/header/header.qml which had a lot of different header tests (in different tabs), and split them up in separate qml apps which are easier to manage. Some deprecated code was left out from the new test files. All the new tests have updated import versions.

I also gave the files of a bunch of tests (unit tests and files in tests/resources) consistent names.

To post a comment you must log in.
1433. By Tim Peeters

start test names with lowercase. They are not ComponentsNames

1434. By Tim Peeters

update filenames for navigation tests

1435. By Tim Peeters

correct naming

1436. By Tim Peeters

rename file

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: Needs Fixing (continuous-integration)
1437. By Tim Peeters

merge staging

Revision history for this message
Cris Dywan (kalikiana) wrote :

As I consider manual tests to be superb dust collectors by design (read: they silently break or go out of sync with code) I'd prefer for these to be merged with unit tests - as tests/launcher/launcher can run these just fine.

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

merge staging

1439. By Tim Peeters

link bug

Revision history for this message
Tim Peeters (tpeeters) wrote :

> As I consider manual tests to be superb dust collectors by design (read: they
> silently break or go out of sync with code) I'd prefer for these to be merged
> with unit tests - as tests/launcher/launcher can run these just fine.

I agree.

I'll do that in a next step. The split up files that I have in this MR are easier to convert to unit tests than the big tabbed header.qml that used to be there.

Revision history for this message
Tim Peeters (tpeeters) wrote :

Note that I actually use these tests quite frequently when I am making changes in UITK, so they are not only collecting dust.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Even if they're not collecting dust you end up duplicating everything unless either unit or manual tests are incomplete - and they're manual so you all you can do by design is make a best guess that they are complete.

In any case I agree, separate steps are fine. This is some very nice clean-up!

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'tests/resources/header/actions.qml'
2--- tests/resources/header/actions.qml 1970-01-01 00:00:00 +0000
3+++ tests/resources/header/actions.qml 2015-03-09 12:45:45 +0000
4@@ -0,0 +1,47 @@
5+/*
6+ * Copyright (C) 2013-2015 Canonical Ltd.
7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU Lesser General Public License as published by
10+ * the Free Software Foundation; version 3.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU Lesser General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU Lesser General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+
21+import QtQuick 2.4
22+import Ubuntu.Components 1.2
23+
24+MainView {
25+ width: units.gu(50)
26+ height: units.gu(70)
27+
28+ Page {
29+ title: "Actions"
30+ Label {
31+ anchors.centerIn: parent
32+ text: "New API"
33+ }
34+ head {
35+ actions: [
36+ Action {
37+ iconName: "settings"
38+ onTriggered: print("Trigger first action")
39+ },
40+ Action {
41+ iconName: "camera-flip"
42+ onTriggered: print("Trigger second action")
43+ }
44+ ]
45+ backAction: Action {
46+ iconName: "close"
47+ onTriggered: print("Trigger custom back action")
48+ }
49+ }
50+ }
51+}
52
53=== added file 'tests/resources/header/automaticColors.qml'
54--- tests/resources/header/automaticColors.qml 1970-01-01 00:00:00 +0000
55+++ tests/resources/header/automaticColors.qml 2015-03-09 12:45:45 +0000
56@@ -0,0 +1,87 @@
57+/*
58+ * Copyright (C) 2013-2015 Canonical Ltd.
59+ *
60+ * This program is free software; you can redistribute it and/or modify
61+ * it under the terms of the GNU Lesser General Public License as published by
62+ * the Free Software Foundation; version 3.
63+ *
64+ * This program is distributed in the hope that it will be useful,
65+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
66+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
67+ * GNU Lesser General Public License for more details.
68+ *
69+ * You should have received a copy of the GNU Lesser General Public License
70+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
71+ */
72+
73+import QtQuick 2.4
74+import Ubuntu.Components 1.2
75+
76+MainView {
77+ id: mainView
78+ width: units.gu(50)
79+ height: units.gu(70)
80+
81+ Page {
82+ title: "Colors"
83+
84+ head.actions: [
85+ Action {
86+ iconName: "close"
87+ text: "one"
88+ },
89+ Action {
90+ iconName: "close"
91+ text: "two"
92+ },
93+ Action {
94+ iconName: "close"
95+ text: "three"
96+ }
97+ ]
98+
99+ Column {
100+ height: childrenRect.height
101+ width: parent.width - units.gu(8)
102+ spacing: units.gu(1)
103+ anchors.centerIn: parent
104+
105+ Button {
106+ anchors {
107+ left: parent.left
108+ right: parent.right
109+ }
110+ text: "Light"
111+ onTriggered: {
112+ mainView.backgroundColor = "#eeeeee";
113+ mainView.headerColor = mainView.backgroundColor;
114+ mainView.footerColor = mainView.backgroundColor;
115+ }
116+ }
117+ Button {
118+ anchors {
119+ left: parent.left
120+ right: parent.right
121+ }
122+ text: "Dark"
123+ onTriggered: {
124+ mainView.backgroundColor = "#333333";
125+ mainView.headerColor = mainView.backgroundColor;
126+ mainView.footerColor = mainView.backgroundColor;
127+ }
128+ }
129+ Button {
130+ anchors {
131+ left: parent.left
132+ right: parent.right
133+ }
134+ text: "Gradient"
135+ onTriggered: {
136+ mainView.backgroundColor = "#6A69A2";
137+ mainView.headerColor ="#343C60";
138+ mainView.footerColor = "#8896D5";
139+ }
140+ }
141+ }
142+ }
143+}
144
145=== added file 'tests/resources/header/backButton.qml'
146--- tests/resources/header/backButton.qml 1970-01-01 00:00:00 +0000
147+++ tests/resources/header/backButton.qml 2015-03-09 12:45:45 +0000
148@@ -0,0 +1,59 @@
149+/*
150+ * Copyright (C) 2013-2015 Canonical Ltd.
151+ *
152+ * This program is free software; you can redistribute it and/or modify
153+ * it under the terms of the GNU Lesser General Public License as published by
154+ * the Free Software Foundation; version 3.
155+ *
156+ * This program is distributed in the hope that it will be useful,
157+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
158+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
159+ * GNU Lesser General Public License for more details.
160+ *
161+ * You should have received a copy of the GNU Lesser General Public License
162+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
163+ */
164+
165+import QtQuick 2.4
166+import Ubuntu.Components 1.2
167+
168+MainView {
169+ id: mainView
170+ width: units.gu(50)
171+ height: units.gu(70)
172+
173+ PageStack {
174+ id: stack
175+
176+ Component.onCompleted: stack.push(firstPage)
177+ Page {
178+ id: firstPage
179+ title: "Stack"
180+ Button {
181+ anchors.centerIn: parent
182+ text: "Click me"
183+ onTriggered: stack.push(pageOnStack)
184+ }
185+ head {
186+ actions: Action {
187+ iconName: "settings"
188+ text: "Settings"
189+ }
190+ }
191+ }
192+
193+ Page {
194+ id: pageOnStack
195+ visible: false
196+ title: "Stacked page"
197+ Label {
198+ anchors.centerIn: parent
199+ text: "Use back button to return"
200+ }
201+ head.actions: Action {
202+ iconName: "info"
203+ text: "information"
204+ }
205+ }
206+ }
207+}
208
209=== removed file 'tests/resources/header/header.qml'
210--- tests/resources/header/header.qml 2015-02-12 11:19:57 +0000
211+++ tests/resources/header/header.qml 1970-01-01 00:00:00 +0000
212@@ -1,278 +0,0 @@
213-/*
214- * Copyright (C) 2013-2015 Canonical Ltd.
215- *
216- * This program is free software; you can redistribute it and/or modify
217- * it under the terms of the GNU Lesser General Public License as published by
218- * the Free Software Foundation; version 3.
219- *
220- * This program is distributed in the hope that it will be useful,
221- * but WITHOUT ANY WARRANTY; without even the implied warranty of
222- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
223- * GNU Lesser General Public License for more details.
224- *
225- * You should have received a copy of the GNU Lesser General Public License
226- * along with this program. If not, see <http://www.gnu.org/licenses/>.
227- */
228-
229-import QtQuick 2.3
230-import Ubuntu.Components 1.2
231-
232-MainView {
233- id: mainView
234- width: units.gu(50)
235- height: units.gu(70)
236-
237- PageStack {
238- id: stack
239-
240- Component.onCompleted: stack.push(tabs)
241- Tabs {
242- id: tabs
243- Tab {
244- title: "Colors"
245- page: Page {
246- head.actions: [
247- Action {
248- iconName: "close"
249- text: "one"
250- },
251- Action {
252- iconName: "close"
253- text: "two"
254- },
255- Action {
256- iconName: "close"
257- text: "three"
258- }
259- ]
260-
261- Column {
262- height: childrenRect.height
263- width: parent.width - units.gu(8)
264- spacing: units.gu(1)
265- anchors.centerIn: parent
266-
267- Button {
268- anchors {
269- left: parent.left
270- right: parent.right
271- }
272- text: "Light"
273- onTriggered: {
274- mainView.backgroundColor = "#eeeeee";
275- mainView.headerColor = mainView.backgroundColor;
276- mainView.footerColor = mainView.backgroundColor;
277- }
278- }
279- Button {
280- anchors {
281- left: parent.left
282- right: parent.right
283- }
284- text: "Dark"
285- onTriggered: {
286- mainView.backgroundColor = "#333333";
287- mainView.headerColor = mainView.backgroundColor;
288- mainView.footerColor = mainView.backgroundColor;
289- }
290- }
291- Button {
292- anchors {
293- left: parent.left
294- right: parent.right
295- }
296- text: "Gradient"
297- onTriggered: {
298- mainView.backgroundColor = "#6A69A2";
299- mainView.headerColor ="#343C60";
300- mainView.footerColor = "#8896D5";
301- }
302- }
303- }
304- }
305- }
306-
307- Tab {
308- title: "Stack"
309- page: Page {
310- Button {
311- anchors.centerIn: parent
312- text: "Click me"
313- onTriggered: stack.push(pageOnStack)
314- }
315- head {
316- actions: Action {
317- iconName: "settings"
318- text: "Settings"
319- }
320- foregroundColor: UbuntuColors.purple
321- }
322- }
323- }
324- Tab {
325- title: "Tools"
326- page: Page {
327- Label {
328- anchors.centerIn: parent
329- text: "Tools no longer supported in\nUbuntu.Components 1.2." +
330- "\nUse Page.head.actions instead."
331- }
332-
333- tools: ToolbarItems {
334- ToolbarButton {
335- action: Action {
336- iconName: "settings"
337- text: "Settings"
338- }
339- }
340- ToolbarButton {
341- action: Action {
342- iconName: "contact"
343- text: "Contacts"
344- }
345- }
346- ToolbarButton {
347- action: Action {
348- iconName: "share"
349- text: "Share"
350- }
351- }
352- ToolbarButton {
353- action: Action {
354- iconName: "select"
355- text: "Select"
356- }
357- }
358- }
359- }
360- }
361- Tab {
362- title: "Switch"
363- page: Page {
364- Switch {
365- id: newHeaderSwitch
366- anchors.centerIn: parent
367- checked: !mainView.useDeprecatedToolbar
368- onTriggered: {
369- mainView.useDeprecatedToolbar = !checked;
370- }
371- }
372- Label {
373- anchors {
374- horizontalCenter: parent.horizontalCenter
375- bottom: newHeaderSwitch.top
376- bottomMargin: units.gu(1)
377- }
378- text: "Use new header"
379- }
380- tools: ToolbarItems {
381- ToolbarButton {
382- action: Action {
383- iconName: "camera-flip"
384- text: "hello"
385- }
386- }
387- }
388- }
389- }
390- Tab {
391- title: "Actions"
392- page: Page {
393- Label {
394- anchors.centerIn: parent
395- text: "New API"
396- }
397- head {
398- actions: [
399- Action {
400- iconName: "settings"
401- },
402- Action {
403- iconName: "camera-flip"
404- }
405- ]
406- backAction: Action {
407- iconName: "close"
408- onTriggered: tabs.selectedTabIndex = 0
409- }
410- }
411- }
412- }
413- Tab {
414- title: "Search"
415- page: Page {
416- id: searchPage
417-
418- Label {
419- anchors.centerIn: parent
420- text: searchPage.state == "search" ? "search mode" : "normal mode"
421- }
422-
423- state: "default"
424- states: [
425- PageHeadState {
426- name: "default"
427- head: searchPage.head
428- actions: Action {
429- id: searchAction
430- iconName: "search"
431- onTriggered: searchPage.state = "search"
432- }
433- },
434- PageHeadState {
435- id: headerState
436- name: "search"
437- head: searchPage.head
438- actions: [
439- Action {
440- iconName: "contact"
441- }
442- ]
443- backAction: Action {
444- id: leaveSearchAction
445- text: "back"
446- iconName: "back"
447- onTriggered: searchPage.state = "default"
448- }
449- contents: TextField {
450- placeholderText: "search..."
451- }
452- }
453- ]
454- }
455- }
456- Tab {
457- title: "Sections"
458- page: Page {
459- id: sectionsPage
460- head {
461- sections {
462- model: ["navy", "lightblue", "brown"]
463- }
464- }
465- Rectangle {
466- anchors {
467- fill: parent
468- margins: units.gu(2)
469- }
470- color: sectionsPage.head.sections.model[sectionsPage.head.sections.selectedIndex]
471- }
472- }
473- }
474- }
475- }
476-
477- Page {
478- id: pageOnStack
479- visible: false
480- title: "Stacked page"
481- Label {
482- anchors.centerIn: parent
483- text: "Use back button to return"
484- }
485- head.actions: Action {
486- iconName: "settings"
487- text: "settings"
488- }
489- }
490-}
491
492=== renamed file 'tests/resources/header/LockedToolbar.qml' => 'tests/resources/header/lockedToolbar.deprecated.qml'
493=== renamed file 'tests/resources/header/select.qml' => 'tests/resources/header/presets.qml'
494=== added file 'tests/resources/header/search.qml'
495--- tests/resources/header/search.qml 1970-01-01 00:00:00 +0000
496+++ tests/resources/header/search.qml 2015-03-09 12:45:45 +0000
497@@ -0,0 +1,67 @@
498+/*
499+ * Copyright (C) 2013-2015 Canonical Ltd.
500+ *
501+ * This program is free software; you can redistribute it and/or modify
502+ * it under the terms of the GNU Lesser General Public License as published by
503+ * the Free Software Foundation; version 3.
504+ *
505+ * This program is distributed in the hope that it will be useful,
506+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
507+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
508+ * GNU Lesser General Public License for more details.
509+ *
510+ * You should have received a copy of the GNU Lesser General Public License
511+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
512+ */
513+
514+import QtQuick 2.4
515+import Ubuntu.Components 1.2
516+
517+MainView {
518+ id: mainView
519+ width: units.gu(50)
520+ height: units.gu(70)
521+
522+ Page {
523+ title: "Search"
524+
525+ id: searchPage
526+
527+ Label {
528+ anchors.centerIn: parent
529+ text: searchPage.state == "search" ? "search mode" : "normal mode"
530+ }
531+
532+ state: "default"
533+ states: [
534+ PageHeadState {
535+ name: "default"
536+ head: searchPage.head
537+ actions: Action {
538+ id: searchAction
539+ iconName: "search"
540+ onTriggered: searchPage.state = "search"
541+ }
542+ },
543+ PageHeadState {
544+ id: headerState
545+ name: "search"
546+ head: searchPage.head
547+ actions: [
548+ Action {
549+ iconName: "contact"
550+ }
551+ ]
552+ backAction: Action {
553+ id: leaveSearchAction
554+ text: "back"
555+ iconName: "back"
556+ onTriggered: searchPage.state = "default"
557+ }
558+ contents: TextField {
559+ placeholderText: "search..."
560+ }
561+ }
562+ ]
563+ }
564+}
565
566=== added file 'tests/resources/header/sections.qml'
567--- tests/resources/header/sections.qml 1970-01-01 00:00:00 +0000
568+++ tests/resources/header/sections.qml 2015-03-09 12:45:45 +0000
569@@ -0,0 +1,41 @@
570+/*
571+ * Copyright (C) 2013-2015 Canonical Ltd.
572+ *
573+ * This program is free software; you can redistribute it and/or modify
574+ * it under the terms of the GNU Lesser General Public License as published by
575+ * the Free Software Foundation; version 3.
576+ *
577+ * This program is distributed in the hope that it will be useful,
578+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
579+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
580+ * GNU Lesser General Public License for more details.
581+ *
582+ * You should have received a copy of the GNU Lesser General Public License
583+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
584+ */
585+
586+import QtQuick 2.4
587+import Ubuntu.Components 1.2
588+
589+MainView {
590+ id: mainView
591+ width: units.gu(50)
592+ height: units.gu(70)
593+
594+ Page {
595+ title: "Sections"
596+ id: sectionsPage
597+ head {
598+ sections {
599+ model: ["navy", "lightblue", "brown"]
600+ }
601+ }
602+ Rectangle {
603+ anchors {
604+ fill: parent
605+ margins: units.gu(2)
606+ }
607+ color: sectionsPage.head.sections.model[sectionsPage.head.sections.selectedIndex]
608+ }
609+ }
610+}
611
612=== renamed file 'tests/resources/header/headerTextInput.qml' => 'tests/resources/header/textInput.qml'
613=== renamed file 'tests/resources/header/toolbar.qml' => 'tests/resources/header/toolbar.deprecated.qml'
614=== renamed file 'tests/resources/header/headerTools.qml' => 'tests/resources/header/toolsInHeader.deprecated.qml'
615=== renamed file 'tests/resources/navigation/PageStack.qml' => 'tests/resources/navigation/pagestack.qml'
616=== renamed file 'tests/resources/header/panels.qml' => 'tests/resources/navigation/panels.qml'
617=== renamed file 'tests/resources/navigation/PullToRefreshTest.qml' => 'tests/resources/navigation/pullToRefresh.qml'
618=== renamed file 'tests/resources/navigation/RepeaterTabs.qml' => 'tests/resources/navigation/repeaterTabs.deprecated.qml'
619=== renamed file 'tests/resources/navigation/SimpleTabs.qml' => 'tests/resources/navigation/simpleTabs.qml'
620=== renamed file 'tests/resources/navigation/StackWithTabs.qml' => 'tests/resources/navigation/stackWithTabs.qml'
621=== renamed file 'tests/resources/navigation/TabView.qml' => 'tests/resources/navigation/tabView.deprecated.qml'
622=== renamed file 'tests/resources/navigation/Tabs.qml' => 'tests/resources/navigation/tabs.qml'
623=== renamed file 'tests/unit_x11/tst_components/tst_headActions.qml' => 'tests/unit_x11/tst_components/tst_header_actions.qml'
624=== renamed file 'tests/unit_x11/tst_components/tst_header.qml' => 'tests/unit_x11/tst_components/tst_header_with_listview_header.qml'
625=== renamed file 'tests/unit_x11/tst_components/tst_pagestack_new_header.qml' => 'tests/unit_x11/tst_components/tst_pagestack.new_header.qml'

Subscribers

People subscribed via source and target branches