Merge lp:~tpeeters/ubuntu-ui-toolkit/noViewReference into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Superseded
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/noViewReference
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 1370 lines (+614/-117)
34 files modified
components.api (+3/-0)
debian/control.gles (+1/-1)
examples/ubuntu-ui-toolkit-gallery/Colors.qml (+8/-6)
examples/ubuntu-ui-toolkit-gallery/PageHeaders.qml (+41/-14)
examples/ubuntu-ui-toolkit-gallery/SwipeAreaPage.qml (+8/-8)
src/Ubuntu/Components/1.3/AdaptivePageLayout.qml (+4/-3)
src/Ubuntu/Components/1.3/Tabs.qml (+0/-6)
src/Ubuntu/Components/1.3/TextArea.qml (+16/-10)
src/Ubuntu/Components/1.3/TextField.qml (+3/-4)
src/Ubuntu/Components/1.3/ToolbarButton.qml (+1/-1)
src/Ubuntu/Components/1.3/UbuntuListView.qml (+3/-1)
src/Ubuntu/Components/Themes/1.3/Palette.qml (+5/-0)
src/Ubuntu/Components/Themes/1.3/PaletteValues.qml (+11/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceNormal.qml (+3/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceSelected.qml (+2/-3)
src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml (+1/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/Palette.qml (+21/-5)
src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml (+36/-17)
src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsForPageHeadStyle.qml (+2/-2)
src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml (+2/-2)
src/Ubuntu/Components/Themes/Ambiance/1.3/TextCursorStyle.qml (+2/-2)
src/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml (+37/-13)
src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkNormal.qml (+3/-1)
src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkSelected.qml (+3/-5)
src/Ubuntu/Components/plugin/ucheader.cpp (+1/-1)
src/Ubuntu/Components/plugin/uclistitem.cpp (+0/-3)
src/Ubuntu/Components/plugin/ucmainviewbase.cpp (+6/-1)
src/Ubuntu/Components/plugin/ucstyleditembase.cpp (+29/-0)
tests/packaging-sorting.sh (+2/-0)
tests/unit_x11/tst_components/tst_pulltorefresh_listview.qml (+1/-1)
tests/unit_x11/tst_components/tst_pulltorefresh_pagestack_topmargin.qml (+86/-0)
tests/unit_x11/tst_components/tst_pulltorefresh_topmargin.qml (+59/-0)
tests/unit_x11/tst_components/tst_tabs11.qml (+198/-0)
tests/unit_x11/tst_components/tst_tabs13.qml (+16/-4)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/noViewReference
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu SDK team Pending
Review via email: mp+295032@code.launchpad.net

Commit message

Fix reference error in PullToRefreshStyle.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1981. By Tim Peeters

rename view to flickable

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2016-04-25 10:45:41 +0000
3+++ components.api 2016-05-18 10:22:28 +0000
4@@ -872,6 +872,7 @@
5 property PaletteValues selected
6 Ubuntu.Components.Themes.Palette 1.3: QtObject
7 property PaletteValues disabled
8+ property PaletteValues focused
9 property PaletteValues highlighted
10 property PaletteValues normal
11 property PaletteValues selected
12@@ -908,6 +909,8 @@
13 property color overlay
14 property color overlaySecondaryText
15 property color overlayText
16+ property color position
17+ property color positionText
18 property color positive
19 property color positiveText
20 property color raised
21
22=== modified file 'debian/control.gles'
23--- debian/control.gles 2016-04-21 13:10:34 +0000
24+++ debian/control.gles 2016-05-18 10:22:28 +0000
25@@ -32,8 +32,8 @@
26 libxkbcommon-dev,
27 libxrender-dev,
28 locales,
29+ pep8,
30 python-autopilot (>= 1.4),
31- pep8,
32 python3-sphinx,
33 python3:any,
34 python:any,
35
36=== modified file 'examples/ubuntu-ui-toolkit-gallery/Colors.qml'
37--- examples/ubuntu-ui-toolkit-gallery/Colors.qml 2016-03-01 15:08:08 +0000
38+++ examples/ubuntu-ui-toolkit-gallery/Colors.qml 2016-05-18 10:22:28 +0000
39@@ -29,7 +29,7 @@
40 className: "Palette"
41 documentation: "qml-palette.html"
42
43- property var palettes: ["normal", "disabled", "selected", "selectedDisabled", "highlighted"]
44+ property var palettes: ["normal", "disabled", "selected", "selectedDisabled", "highlighted", "focused"]
45 property var paletteValues: [["background", ["backgroundText", "backgroundSecondaryText", "backgroundTertiaryText"]],
46 ["base", ["baseText"]],
47 ["foreground", ["foregroundText"]],
48@@ -40,7 +40,9 @@
49 ["overlay", ["overlayText", "overlaySecondaryText"]],
50 ["positive", ["positiveText"]],
51 ["raised", ["raisedText", "raisedSecondaryText"]],
52- ["selection", ["selectionText"]]]
53+ ["selection", ["selectionText"]],
54+ ["position", ["positionText"]],
55+ ]
56
57 Flow {
58 id: paletteFlow
59@@ -75,7 +77,7 @@
60 property string mainColor: modelData[0]
61 property var textColors: modelData[1]
62 property bool previewed: paletteFlow.previewed == paletteColor
63- width: units.gu(4)
64+ width: units.gu(8)
65 height: units.gu(5)
66 z: previewed ? 10 : 0
67
68@@ -106,7 +108,7 @@
69
70 Rectangle {
71 anchors.fill: parent
72- color: palette[mainColor]
73+ color: palette ? palette[mainColor] : "transparent"
74 border.width: color == theme.palette.normal.background ? units.dp(1) : 0
75 border.color: theme.palette.normal.backgroundText
76 }
77@@ -124,8 +126,8 @@
78 model: textColors
79 Label {
80 width: previewed ? implicitWidth : parent.width
81- text: previewed ? modelData : modelData.slice(0, 4)
82- color: palette[modelData]
83+ text: previewed ? modelData : modelData.slice(0, 10)
84+ color: palette ? palette[modelData] : "transparent"
85 textSize: previewed ? Label.Medium : Label.XSmall
86 elide: Text.ElideRight
87 }
88
89=== modified file 'examples/ubuntu-ui-toolkit-gallery/PageHeaders.qml'
90--- examples/ubuntu-ui-toolkit-gallery/PageHeaders.qml 2016-02-17 14:45:09 +0000
91+++ examples/ubuntu-ui-toolkit-gallery/PageHeaders.qml 2016-05-18 10:22:28 +0000
92@@ -26,7 +26,47 @@
93 className: "PageHeader"
94
95 Label {
96- text: "Use the icons in the header."
97+ text: "Use the icons in the header for search and edit header."
98+ }
99+
100+ Grid {
101+ id: switchGrid
102+ columns: 2
103+ spacing: units.gu(1)
104+ anchors {
105+ left: parent.left
106+ leftMargin: units.gu(5)
107+ }
108+
109+ Switch {
110+ id: lockedSwitch
111+ checked: standardHeader.extension
112+ onTriggered: {
113+ if (standardHeader.extension) {
114+ standardHeader.extension = null;
115+ } else {
116+ standardHeader.extension = sections;
117+ }
118+ }
119+ }
120+ Label {
121+ text: "Sections"
122+ }
123+
124+ Switch {
125+ id: subtitleSwitch
126+ checked: standardHeader.subtitle
127+ onTriggered: {
128+ if (standardHeader.subtitle) {
129+ standardHeader.subtitle = "";
130+ } else {
131+ standardHeader.subtitle = "Hello, this is your subtitle";
132+ }
133+ }
134+ }
135+ Label {
136+ text: "Subtitle"
137+ }
138 }
139 }
140
141@@ -44,19 +84,6 @@
142 iconName: "edit"
143 text: "Edit"
144 onTriggered: page.header = editHeader
145- },
146- Action {
147- iconName: standardHeader.extension === sections
148- ? "media-playback-stop"
149- : "filters"
150- text: "Sections"
151- onTriggered: {
152- if (standardHeader.extension) {
153- standardHeader.extension = null;
154- } else {
155- standardHeader.extension = sections;
156- }
157- }
158 }
159 ]
160
161
162=== modified file 'examples/ubuntu-ui-toolkit-gallery/SwipeAreaPage.qml'
163--- examples/ubuntu-ui-toolkit-gallery/SwipeAreaPage.qml 2015-11-09 14:46:02 +0000
164+++ examples/ubuntu-ui-toolkit-gallery/SwipeAreaPage.qml 2016-05-18 10:22:28 +0000
165@@ -28,8 +28,8 @@
166 TemplateRow {
167 title: i18n.tr("Upwards")
168 Rectangle {
169- width: units.gu(40)
170- height: units.gu(20)
171+ width: parent.width / 1.5
172+ height: width / 2
173 color: theme.palette.normal.foreground
174
175 SwipeArea {
176@@ -56,8 +56,8 @@
177 TemplateRow {
178 title: i18n.tr("Downwards")
179 Rectangle {
180- width: units.gu(40)
181- height: units.gu(20)
182+ width: parent.width / 1.5
183+ height: width / 2
184 color: theme.palette.normal.foreground
185
186 SwipeArea {
187@@ -84,8 +84,8 @@
188 TemplateRow {
189 title: i18n.tr("Rightwards")
190 Rectangle {
191- width: units.gu(40)
192- height: units.gu(20)
193+ width: parent.width / 1.5
194+ height: width / 2
195 color: theme.palette.normal.foreground
196
197 SwipeArea {
198@@ -114,8 +114,8 @@
199 TemplateRow {
200 title: i18n.tr("Leftwards")
201 Rectangle {
202- width: units.gu(40)
203- height: units.gu(20)
204+ width: parent.width / 1.5
205+ height: width / 2
206 color: theme.palette.normal.foreground
207
208 SwipeArea {
209
210=== modified file 'src/Ubuntu/Components/1.3/AdaptivePageLayout.qml'
211--- src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2016-03-16 09:15:39 +0000
212+++ src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2016-05-18 10:22:28 +0000
213@@ -788,7 +788,7 @@
214 bottom: parent.bottom
215 left: parent.left
216 right: parent.right
217- rightMargin: dividerThickness
218+ rightMargin: dividerThickness + verticalDivider.width
219 }
220 Item {
221 id: hiddenItem
222@@ -806,6 +806,7 @@
223 left: parent.left
224 top: parent.top
225 right: parent.right
226+ rightMargin: dividerThickness + verticalDivider.width
227 }
228 height: body.headerHeight
229
230@@ -856,7 +857,7 @@
231 right: parent.right
232 rightMargin: dividerThickness
233 }
234- width: (column == (d.columns - 1)) || !pageWrapper ? 0 : units.dp(1)
235+ width: (column == (d.columns - 1)) ? 0 : units.dp(1)
236 color: theme.palette.normal.base
237 MouseArea {
238 id: resizerSensing
239@@ -923,7 +924,7 @@
240 wrapper.active = false;
241 subHeader.config = null;
242 pageWrapper = null;
243- wrapper.parent = hiddenPool;
244+ wrapper.parent = hiddenItem;
245 wrapper.pageHolder = null;
246 return wrapper;
247 }
248
249=== modified file 'src/Ubuntu/Components/1.3/Tabs.qml'
250--- src/Ubuntu/Components/1.3/Tabs.qml 2015-12-08 18:34:40 +0000
251+++ src/Ubuntu/Components/1.3/Tabs.qml 2016-05-18 10:22:28 +0000
252@@ -49,12 +49,6 @@
253 anchors.centerIn: parent
254 text: "A centered label"
255 }
256- tools: ToolbarItems {
257- ToolbarButton {
258- text: "action"
259- onTriggered: print("action triggered")
260- }
261- }
262 }
263 }
264 Tab {
265
266=== modified file 'src/Ubuntu/Components/1.3/TextArea.qml'
267--- src/Ubuntu/Components/1.3/TextArea.qml 2016-04-26 05:33:41 +0000
268+++ src/Ubuntu/Components/1.3/TextArea.qml 2016-05-18 10:22:28 +0000
269@@ -769,6 +769,7 @@
270 property string displayText: editor.getText(0, editor.length)
271 property real frameSpacing: control.__styleInstance.frameSpacing
272 property real minimumSize: units.gu(4)
273+ property real scrollbarSpacing: rightScrollbar.__interactive ? units.gu(2) : 0
274
275 function linesHeight(lines)
276 {
277@@ -824,15 +825,6 @@
278 }
279
280 //scrollbars and flickable
281- Scrollbar {
282- id: rightScrollbar
283- flickableItem: flicker
284- }
285- Scrollbar {
286- id: bottomScrollbar
287- flickableItem: flicker
288- align: Qt.AlignBottom
289- }
290 Flickable {
291 id: flicker
292 objectName: "input_scroller"
293@@ -853,7 +845,7 @@
294 objectName: "text_input"
295 readOnly: false
296 id: editor
297- width: control.contentWidth
298+ width: control.contentWidth - internal.scrollbarSpacing
299 height: Math.max(control.contentHeight, editor.contentHeight)
300 wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
301 mouseSelectionMode: TextEdit.SelectWords
302@@ -883,6 +875,20 @@
303 }
304 }
305 }
306+ Scrollbar {
307+ id: rightScrollbar
308+ flickableItem: flicker
309+ // Attach right inside the frame
310+ // Flickable uses anchors.margins relative to the frame
311+ // rather than *Margin which would scroll with the content
312+ anchors.topMargin: -internal.frameSpacing
313+ anchors.rightMargin: -internal.frameSpacing
314+ anchors.bottomMargin: -internal.frameSpacing
315+ Ubuntu.StyleHints {
316+ // No background color
317+ troughColorSteppersStyle: Qt.rgba(0, 0, 0, 0)
318+ }
319+ }
320
321 styleName: "TextAreaStyle"
322 }
323
324=== modified file 'src/Ubuntu/Components/1.3/TextField.qml'
325--- src/Ubuntu/Components/1.3/TextField.qml 2016-04-26 05:33:41 +0000
326+++ src/Ubuntu/Components/1.3/TextField.qml 2016-05-18 10:22:28 +0000
327@@ -995,11 +995,11 @@
328 anchors {
329 left: leftPane.right
330 right: clearButton.left
331- top: parent.top
332- bottom: parent.bottom
333 margins: internal.spacing
334+ verticalCenter: parent.verticalCenter
335 }
336 topMargin: internal.spacing
337+ bottomMargin: internal.spacing
338 // do not allow rebounding
339 boundsBehavior: Flickable.StopAtBounds
340 // need to forward events as events occurred on topMargin area are not grabbed by the MouseArea.
341@@ -1008,13 +1008,12 @@
342 clip: true
343 contentWidth: editor.contentWidth
344 contentHeight: editor.contentHeight
345+ height: editor.contentHeight
346
347 TextInput {
348 id: editor
349 objectName: "text_input"
350 // FocusScope will forward focus to this component
351- anchors.verticalCenter: parent.verticalCenter
352- verticalAlignment: TextInput.AlignVCenter
353 width: flicker.width
354 height: flicker.height
355 cursorDelegate: TextCursor {
356
357=== modified file 'src/Ubuntu/Components/1.3/ToolbarButton.qml'
358--- src/Ubuntu/Components/1.3/ToolbarButton.qml 2015-09-28 14:36:54 +0000
359+++ src/Ubuntu/Components/1.3/ToolbarButton.qml 2016-05-18 10:22:28 +0000
360@@ -29,7 +29,7 @@
361 Example of different ways to define the toolbar button:
362 \qml
363 import QtQuick 2.4
364- import Ubuntu.Components 1.3
365+ import Ubuntu.Components 1.2
366
367 MainView {
368 width: units.gu(50)
369
370=== modified file 'src/Ubuntu/Components/1.3/UbuntuListView.qml'
371--- src/Ubuntu/Components/1.3/UbuntuListView.qml 2016-03-01 14:53:44 +0000
372+++ src/Ubuntu/Components/1.3/UbuntuListView.qml 2016-05-18 10:22:28 +0000
373@@ -196,7 +196,9 @@
374
375 // highlight current item
376 highlight: Rectangle {
377- color: theme.palette.selected.background
378+ color: root.activeFocus
379+ ? theme.palette.focused.background
380+ : theme.palette.selected.background
381 }
382 highlightMoveDuration: 0
383 }
384
385=== modified file 'src/Ubuntu/Components/Themes/1.3/Palette.qml'
386--- src/Ubuntu/Components/Themes/1.3/Palette.qml 2016-03-01 15:06:38 +0000
387+++ src/Ubuntu/Components/Themes/1.3/Palette.qml 2016-05-18 10:22:28 +0000
388@@ -60,6 +60,11 @@
389 property PaletteValues disabled: PaletteValues{}
390
391 /*!
392+ Color palette to use when the widget is focused.
393+ */
394+ property PaletteValues focused: PaletteValues{}
395+
396+ /*!
397 Color palette to use when the widget is selected, for example when
398 a tab is the current one.
399 */
400
401=== modified file 'src/Ubuntu/Components/Themes/1.3/PaletteValues.qml'
402--- src/Ubuntu/Components/Themes/1.3/PaletteValues.qml 2016-04-26 05:33:41 +0000
403+++ src/Ubuntu/Components/Themes/1.3/PaletteValues.qml 2016-05-18 10:22:28 +0000
404@@ -140,7 +140,7 @@
405 property color activityText
406
407 /*!
408- Color applied to selected text in editable components.
409+ Color applied to selected text background in editable components.
410 */
411 property color selection
412 /*!
413@@ -159,4 +159,14 @@
414 Color applied to elements placed on top of the \l focus color.
415 */
416 property color focusText
417+
418+ /*!
419+ Color applied to navigation elements' background.
420+ */
421+ property color position
422+
423+ /*!
424+ Color applied to navigation elements to indicate current position.
425+ */
426+ property color positionText
427 }
428
429=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceNormal.qml'
430--- src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceNormal.qml 2016-04-26 05:33:41 +0000
431+++ src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceNormal.qml 2016-05-18 10:22:28 +0000
432@@ -24,7 +24,7 @@
433 backgroundSecondaryText: UbuntuColors.slate
434 backgroundTertiaryText: UbuntuColors.ash
435 base: UbuntuColors.silk
436- baseText: UbuntuColors.ash
437+ baseText: UbuntuColors.graphite
438 foreground: UbuntuColors.porcelain
439 foregroundText: UbuntuColors.jet
440 raised: "#FFFFFF"
441@@ -45,4 +45,6 @@
442 negativeText: "#FFFFFF"
443 activity: UbuntuColors.blue
444 activityText: "#FFFFFF"
445+ position: "#00000000"
446+ positionText: UbuntuColors.blue
447 }
448
449=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceSelected.qml'
450--- src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceSelected.qml 2016-03-01 15:06:38 +0000
451+++ src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceSelected.qml 2016-05-18 10:22:28 +0000
452@@ -19,9 +19,8 @@
453
454 AmbianceNormal {
455 background: UbuntuColors.porcelain
456- backgroundText: UbuntuColors.blue
457- backgroundTertiaryText: UbuntuColors.blue
458 base: UbuntuColors.ash
459- baseText: UbuntuColors.blue
460+ baseText: UbuntuColors.inkstone
461 foreground: UbuntuColors.ash
462+ overlay: UbuntuColors.porcelain
463 }
464
465=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml'
466--- src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml 2016-01-28 11:54:29 +0000
467+++ src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml 2016-05-18 10:22:28 +0000
468@@ -26,7 +26,7 @@
469 color: styledItem.enabled
470 ? theme.palette.normal.focus
471 : theme.palette.disabled.focus
472- thickness: units.gu(0.21)
473+ thickness: units.dp(1)
474 radius: units.gu(1.7)
475 visible: styledItem.keyNavigationFocus
476
477
478=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/Palette.qml'
479--- src/Ubuntu/Components/Themes/Ambiance/1.3/Palette.qml 2016-04-26 05:33:41 +0000
480+++ src/Ubuntu/Components/Themes/Ambiance/1.3/Palette.qml 2016-05-18 10:22:28 +0000
481@@ -26,15 +26,18 @@
482 // specific disabled colors
483 var diff = {
484 field: UbuntuColors.porcelain,
485- positiveText: normal.positiveText,
486- negativeText: normal.negativeText,
487+ selection: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.1),
488+ positiveText: "#FFFFFF",
489+ negativeText: "#FFFFFF",
490+ activityText: "#FFFFFF",
491+ focusText: "#FFFFFF"
492 };
493 for (var p in normal) {
494 // skip objectName and all change signals
495 if (p === "objectName" || p.indexOf("Changed") > 0) continue;
496 disabled[p] = diff[p] || (
497 // if not specific, colors are 30% opaque normal
498- Qt.rgba(normal[p].r, normal[p].g, normal[p].b, 0.3)
499+ Qt.rgba(normal[p].r, normal[p].g, normal[p].b, normal[p].a * 0.5)
500 );
501 }
502 }
503@@ -51,13 +54,18 @@
504 background: UbuntuColors.porcelain,
505 base: UbuntuColors.porcelain,
506 foreground: UbuntuColors.porcelain,
507+ selection: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.1),
508+ positiveText: "#FFFFFF",
509+ negativeText: "#FFFFFF",
510+ activityText: "#FFFFFF",
511+ focusText: "#FFFFFF"
512 };
513 for (var p in selected) {
514 // skip objectName and all change signals
515 if (p === "objectName" || p.indexOf("Changed") > 0) continue;
516 selectedDisabled[p] = diff[p] || (
517 // if not specific, colors are 30% opaque normal
518- Qt.rgba(selected[p].r, selected[p].g, selected[p].b, 0.3)
519+ Qt.rgba(selected[p].r, selected[p].g, selected[p].b, normal[p].a * 0.5)
520 );
521 }
522 }
523@@ -65,7 +73,15 @@
524
525 highlighted: AmbianceNormal {
526 background: UbuntuColors.silk
527- base: UbuntuColors.jet
528+ base: UbuntuColors.ash
529+ baseText: UbuntuColors.inkstone
530 foreground: UbuntuColors.silk
531+ raised: UbuntuColors.silk
532+ raisedText: UbuntuColors.inkstone
533+ raisedSecondaryText: UbuntuColors.ash
534+ }
535+
536+ focused: AmbianceNormal {
537+ background: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.2)
538 }
539 }
540
541=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml'
542--- src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml 2015-12-16 11:53:01 +0000
543+++ src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml 2016-05-18 10:22:28 +0000
544@@ -1,5 +1,5 @@
545 /*
546- * Copyright 2014 Canonical Ltd.
547+ * Copyright 2016 Canonical Ltd.
548 *
549 * This program is free software; you can redistribute it and/or modify
550 * it under the terms of the GNU Lesser General Public License as published by
551@@ -56,16 +56,22 @@
552 Local properties
553 */
554 readonly property PullToRefresh control: styledItem
555- // property to store Flickable's toipMargin at the time the pull or auto-refresh is started
556- property real flickableTopMargin: 0.0
557+ // property to control adding of control.height to the Flickable's topMargin.
558+ property bool extendTopMargin: false
559+ onExtendTopMarginChanged: {
560+ if (extendTopMargin) {
561+ control.target.topMargin += control.height;
562+ } else {
563+ control.target.topMargin -= control.height;
564+ }
565+ }
566+
567 // store when the drag has happened at the beginning of the Flickable's content
568 property bool wasAtYBeginning: false
569 // initial contentY value when pull started
570 property real initialContentY: 0.0
571 // drives the refreshing state
572 property bool refreshing: false
573- // point of release used in rebind animation between the ready-to-refresh and refreshing states
574- property real pointOfRelease
575 // specifies the component completion
576 property bool ready: false
577 // root item
578@@ -130,6 +136,17 @@
579 anchors.centerIn: parent
580 }
581
582+ onVisibleChanged: {
583+ // Updates to contentY may be interrupted if the flickable becomes
584+ // invisible (for example when a new Page is pushed on a stack
585+ // while PullToRefresh is in refreshing state. See bug #1578619.
586+ if (visible) {
587+ // Make sure the flickable is back inside its bounds when
588+ // the Page becomes visible again:
589+ control.target.returnToBounds();
590+ }
591+ }
592+
593 // state and content controlling
594 Connections {
595 target: control
596@@ -138,8 +155,7 @@
597 return;
598 }
599 if (!style.releaseToRefresh && target.refreshing) {
600- // not a manual refresh, update flickable's starting topMargin
601- style.flickableTopMargin = control.target.topMargin;
602+ // not a manual refresh
603 style.wasAtYBeginning = control.target.atYBeginning;
604 }
605 /*
606@@ -162,13 +178,13 @@
607 style.refreshing = false;
608 style.releaseToRefresh = false;
609 }
610- onMovementEnded: style.wasAtYBeginning = control.target.atYBeginning
611+ onMovementEnded: {
612+ style.wasAtYBeginning = control.target.atYBeginning;
613+ }
614
615 // catch when to initiate refresh
616 onDraggingChanged: {
617 if (!control.parent.dragging && style.releaseToRefresh) {
618- pointOfRelease = -(control.target.contentY - control.target.originY)
619- style.flickableTopMargin = control.target.topMargin;
620 style.refreshing = true;
621 style.releaseToRefresh = false;
622 }
623@@ -213,8 +229,8 @@
624 running: true
625 }
626 PropertyChanges {
627- target: control.target
628- topMargin: style.flickableTopMargin + control.height
629+ target: style
630+ extendTopMargin: true
631 }
632 }
633 ]
634@@ -226,9 +242,8 @@
635 SequentialAnimation {
636 UbuntuNumberAnimation {
637 target: control.target
638- property: "topMargin"
639- from: style.pointOfRelease
640- to: style.flickableTopMargin + control.height
641+ property: "contentY"
642+ to: style.initialContentY - control.height
643 }
644 ScriptAction {
645 script: control.refresh()
646@@ -242,8 +257,7 @@
647 UbuntuNumberAnimation {
648 target: control.target
649 property: "contentY"
650- from: -style.flickableTopMargin
651- to: -style.flickableTopMargin - control.height
652+ to: style.initialContentY - control.height
653 }
654 },
655 Transition {
656@@ -253,6 +267,11 @@
657 target: control.target
658 property: "topMargin"
659 }
660+ UbuntuNumberAnimation {
661+ target: control.target
662+ property: "contentY"
663+ to: style.initialContentY
664+ }
665 }
666 ]
667 }
668
669=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsForPageHeadStyle.qml'
670--- src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsForPageHeadStyle.qml 2016-02-19 11:18:51 +0000
671+++ src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsForPageHeadStyle.qml 2016-05-18 10:22:28 +0000
672@@ -35,8 +35,8 @@
673 The foreground color of the selected section.
674 */
675 property color selectedSectionColor: enabled
676- ? theme.palette.selected.backgroundTertiaryText
677- : theme.palette.selectedDisabled.backgroundTertiaryText
678+ ? theme.palette.selected.positionText
679+ : theme.palette.selectedDisabled.positionText
680
681 /*!
682 The background color for the pressed section button.
683
684=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml'
685--- src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2016-04-25 18:58:29 +0000
686+++ src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2016-05-18 10:22:28 +0000
687@@ -41,8 +41,8 @@
688 The foreground color of the selected section.
689 */
690 property color selectedSectionColor: enabled
691- ? theme.palette.selected.backgroundTertiaryText
692- : theme.palette.selectedDisabled.backgroundTertiaryText
693+ ? theme.palette.selected.positionText
694+ : theme.palette.selectedDisabled.positionText
695
696 /*!
697 The background color for the pressed section button.
698
699=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/TextCursorStyle.qml'
700--- src/Ubuntu/Components/Themes/Ambiance/1.3/TextCursorStyle.qml 2016-01-26 19:27:50 +0000
701+++ src/Ubuntu/Components/Themes/Ambiance/1.3/TextCursorStyle.qml 2016-05-18 10:22:28 +0000
702@@ -55,8 +55,8 @@
703 Rectangle {
704 objectName: "text_cursor_style_" + styledItem.positionProperty
705 width: cursorWidth
706- // FIXME: check with design whether should it be activity or something else
707- color: theme.palette.normal.activity
708+
709+ color: theme.palette.normal.positionText
710 visible: blinkTimer.timerShowCursor || !blinkTimer.running
711 Timer {
712 id: blinkTimer
713
714=== modified file 'src/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml'
715--- src/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml 2016-03-10 08:46:03 +0000
716+++ src/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml 2016-05-18 10:22:28 +0000
717@@ -22,14 +22,23 @@
718 Palette {
719 normal: SuruDarkNormal {}
720 disabled: SuruDarkNormal {
721- field: UbuntuColors.inkstone
722- // inactive is 30% transparent normal
723 Component.onCompleted: {
724+ // specific disabled colors
725+ var diff = {
726+ foreground: UbuntuColors.inkstone,
727+ field: UbuntuColors.inkstone,
728+ positiveText: UbuntuColors.porcelain,
729+ negativeText: UbuntuColors.porcelain,
730+ activityText: UbuntuColors.porcelain,
731+ focusText: UbuntuColors.porcelain
732+ };
733 for (var p in normal) {
734 // skip objectName and all change signals
735- if (p == "objectName"|| p.indexOf("Changed") > 0
736- || p == "field" || p == "foreground" ) continue;
737- disabled[p] = Qt.rgba(normal[p].r, normal[p].g, normal[p].b, 0.3);
738+ if (p == "objectName"|| p.indexOf("Changed") > 0) continue;
739+ disabled[p] = diff[p] || (
740+ // if not specific, colors are 30% opaque normal
741+ Qt.rgba(normal[p].r, normal[p].g, normal[p].b, normal[p].a * 0.5)
742+ );
743 }
744 }
745 }
746@@ -39,24 +48,39 @@
747
748 // selected differs from normal in background, base, foreground
749 selectedDisabled: SuruDarkSelected {
750- background: UbuntuColors.inkstone
751- base: UbuntuColors.inkstone
752- foreground: UbuntuColors.inkstone
753- // inactive is 30% transparent normal
754 Component.onCompleted: {
755+ var diff = {
756+ background: UbuntuColors.inkstone,
757+ base: UbuntuColors.inkstone,
758+ foreground: UbuntuColors.inkstone,
759+ positiveText: UbuntuColors.porcelain,
760+ negativeText: UbuntuColors.porcelain,
761+ activityText: UbuntuColors.porcelain,
762+ focusText: UbuntuColors.porcelain
763+ };
764 for (var p in selected) {
765 // skip objectName and all change signals
766- if (p == "objectName"|| p.indexOf("Changed") > 0
767- || p == "field" || p == "foreground" ) continue;
768- selectedDisabled[p] = Qt.rgba(selected[p].r, selected[p].g, selected[p].b, 0.3);
769+ if (p == "objectName"|| p.indexOf("Changed") > 0) continue;
770+ selectedDisabled[p] = diff[p] || (
771+ // if not specific, colors are 30% opaque normal
772+ Qt.rgba(selected[p].r, selected[p].g, selected[p].b, normal[p].a * 0.5)
773+ );
774 }
775 }
776 }
777
778 highlighted: SuruDarkNormal {
779 background: UbuntuColors.slate
780- base: UbuntuColors.graphite
781+ base: UbuntuColors.slate
782+ baseText: UbuntuColors.silk
783 foreground: UbuntuColors.slate
784+ raised: UbuntuColors.silk
785+ raisedText: UbuntuColors.inkstone
786+ raisedSecondaryText: UbuntuColors.ash
787+ }
788+
789+ focused: SuruDarkNormal {
790+ background: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.4)
791 }
792 }
793 //![0]
794
795=== modified file 'src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkNormal.qml'
796--- src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkNormal.qml 2016-04-26 05:33:41 +0000
797+++ src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkNormal.qml 2016-05-18 10:22:28 +0000
798@@ -24,7 +24,7 @@
799 backgroundSecondaryText: UbuntuColors.silk
800 backgroundTertiaryText: UbuntuColors.ash
801 base: UbuntuColors.graphite
802- baseText: UbuntuColors.ash
803+ baseText: UbuntuColors.silk
804 foreground: UbuntuColors.inkstone
805 foregroundText: "#FFFFFF"
806 raised: "#FFFFFF"
807@@ -45,4 +45,6 @@
808 negativeText: "#FFFFFF"
809 activity: UbuntuColors.blue
810 activityText: "#FFFFFF"
811+ position: "#00000000"
812+ positionText: UbuntuColors.blue
813 }
814
815=== modified file 'src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkSelected.qml'
816--- src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkSelected.qml 2016-03-01 15:06:38 +0000
817+++ src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkSelected.qml 2016-05-18 10:22:28 +0000
818@@ -20,10 +20,8 @@
819
820 SuruDarkNormal {
821 background: UbuntuColors.inkstone
822- backgroundText: UbuntuColors.blue
823- backgroundTertiaryText: UbuntuColors.blue
824- base: UbuntuColors.ash
825- baseText:UbuntuColors.blue
826+ base: UbuntuColors.inkstone
827+ baseText: UbuntuColors.ash
828 foreground: UbuntuColors.slate
829+ overlay: UbuntuColors.slate
830 }
831-
832
833=== modified file 'src/Ubuntu/Components/plugin/ucheader.cpp'
834--- src/Ubuntu/Components/plugin/ucheader.cpp 2016-04-20 15:26:25 +0000
835+++ src/Ubuntu/Components/plugin/ucheader.cpp 2016-05-18 10:22:28 +0000
836@@ -40,7 +40,7 @@
837 import QtQuick 2.4
838 import Ubuntu.Components 1.3
839
840- Item {
841+ Page {
842 width: units.gu(50)
843 height: units.gu(70)
844
845
846=== modified file 'src/Ubuntu/Components/plugin/uclistitem.cpp'
847--- src/Ubuntu/Components/plugin/uclistitem.cpp 2016-04-26 10:21:32 +0000
848+++ src/Ubuntu/Components/plugin/uclistitem.cpp 2016-05-18 10:22:28 +0000
849@@ -1140,9 +1140,6 @@
850 updateNode = true;
851 }
852 QRectF rect(boundingRect());
853- // FIXME: The 1dp margin is here so that part of the focus frame
854- // is not hidden by the APL divider. See bug #1575060.
855- rect -= QMarginsF(0, 0, UCUnits::instance()->dp(1), 0);
856 d->divider->setOpacity(paintFocus ? 0.0 : 1.0);
857 rectNode->setRect(rect);
858
859
860=== modified file 'src/Ubuntu/Components/plugin/ucmainviewbase.cpp'
861--- src/Ubuntu/Components/plugin/ucmainviewbase.cpp 2016-04-04 04:47:11 +0000
862+++ src/Ubuntu/Components/plugin/ucmainviewbase.cpp 2016-05-18 10:22:28 +0000
863@@ -53,7 +53,9 @@
864
865 m_actionContext->setObjectName(QStringLiteral("RootContext"));
866 m_actionContext->setActive(true);
867- q->setActive(true);
868+ // setActive(true) is called in componentComplete to wait
869+ // until the MainView (and all its children) are complete
870+ // to prevent bug #1570886.
871
872 QObject::connect(m_actionManager,&UCActionManager::quit, [](){
873 // FIXME Wire this up to the application lifecycle management API instead of quit().
874@@ -307,6 +309,9 @@
875 {
876 Q_D(UCMainViewBase);
877 UCPageTreeNode::componentComplete();
878+ // Do not call setActive() in d->init() but postpone until the
879+ // component is complete to avoid bug #1570886.
880+ this->setActive(true);
881 d->doAutoTheme();
882
883 if (d->m_actionContext)
884
885=== modified file 'src/Ubuntu/Components/plugin/ucstyleditembase.cpp'
886--- src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2016-04-25 10:45:41 +0000
887+++ src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2016-05-18 10:22:28 +0000
888@@ -37,6 +37,32 @@
889 {
890 }
891
892+/*!
893+ * \qmlproperty string StyledItem::keyNavigationFocus
894+ * If \l activeFocusOnTab is true and Tab or Shift+Tab is used to focus
895+ * the item this property will be true - unlike \l activeFocus which is also
896+ * true if the item gained focus by click, tap or programmatically.
897+ * Note that only one component at a time has \b keyNavigationFocus. The
898+ * parent will have \l activeFocus and usually won't draw a focus ring.
899+ *
900+ * In case of complex components arrow keys may be the preferred way to move
901+ * between children that can take focus. Examples of that are ListView and
902+ * ListItem. This currently requires overriding \b keyNavigationFocus in C++.
903+ *
904+ * The implementation of focus rings as provided by the default Ambiance theme
905+ * sets \l activeFocusOnTab in the style of each component and only indicates
906+ * focus as long as \b keyNavigationFocus is true, similar to the below example.
907+ * \qml
908+ * StyledItem {
909+ * id: myItem
910+ * activeFocusOnTab: true
911+ * Rectangle {
912+ * anchors.fill: parent
913+ * color: keyNavigationFocus ? UbuntuColors.orange : UbuntuColors.blue
914+ * }
915+ * }
916+ * \endqml
917+ */
918 bool UCStyledItemBase::keyNavigationFocus() const
919 {
920 Q_D(const UCStyledItemBase);
921@@ -44,6 +70,9 @@
922 }
923 void UCStyledItemBase::setKeyNavigationFocus(bool v)
924 {
925+ // FIXME: Behavior of nested StyledItem is currently undefined
926+ // Docs should be updated once the behavior is sorted out
927+ // See https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1575257
928 Q_D(UCStyledItemBase);
929 if (d->keyNavigationFocus == v)
930 return;
931
932=== modified file 'tests/packaging-sorting.sh'
933--- tests/packaging-sorting.sh 2016-03-07 14:21:53 +0000
934+++ tests/packaging-sorting.sh 2016-05-18 10:22:28 +0000
935@@ -27,6 +27,8 @@
936 cp -a ../debian $tmpdir
937
938 wrap-and-sort -a -t -d $tmpdir/debian/
939+# Verify control.gles which otherwise isn't picked up
940+wrap-and-sort -a -t -d $tmpdir/debian/ -f $tmpdir/debian/control.gles
941
942 diff -urN ../debian $tmpdir/debian
943
944
945=== added file 'tests/unit_x11/tst_components/logo.png'
946Binary files tests/unit_x11/tst_components/logo.png 1970-01-01 00:00:00 +0000 and tests/unit_x11/tst_components/logo.png 2016-05-18 10:22:28 +0000 differ
947=== modified file 'tests/unit_x11/tst_components/tst_pulltorefresh_listview.qml'
948--- tests/unit_x11/tst_components/tst_pulltorefresh_listview.qml 2015-03-03 13:20:06 +0000
949+++ tests/unit_x11/tst_components/tst_pulltorefresh_listview.qml 2016-05-18 10:22:28 +0000
950@@ -1,5 +1,5 @@
951 /*
952- * Copyright 2014 Canonical Ltd.
953+ * Copyright 2016 Canonical Ltd.
954 *
955 * This program is free software; you can redistribute it and/or modify
956 * it under the terms of the GNU Lesser General Public License as published by
957
958=== added file 'tests/unit_x11/tst_components/tst_pulltorefresh_pagestack_topmargin.qml'
959--- tests/unit_x11/tst_components/tst_pulltorefresh_pagestack_topmargin.qml 1970-01-01 00:00:00 +0000
960+++ tests/unit_x11/tst_components/tst_pulltorefresh_pagestack_topmargin.qml 2016-05-18 10:22:28 +0000
961@@ -0,0 +1,86 @@
962+/*
963+ * Copyright 2016 Canonical Ltd.
964+ *
965+ * This program is free software; you can redistribute it and/or modify
966+ * it under the terms of the GNU Lesser General Public License as published by
967+ * the Free Software Foundation; version 3.
968+ *
969+ * This program is distributed in the hope that it will be useful,
970+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
971+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
972+ * GNU Lesser General Public License for more details.
973+ *
974+ * You should have received a copy of the GNU Lesser General Public License
975+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
976+ */
977+
978+import QtQuick 2.4
979+import Ubuntu.Components 1.3
980+import Ubuntu.Components.ListItems 1.3
981+import QtTest 1.0
982+import Ubuntu.Test 1.3
983+
984+Item {
985+ width: units.gu(40)
986+ height: units.gu(71)
987+
988+ MainView {
989+ anchors.fill: parent
990+ PageStack {
991+ id: pageStack
992+ Page {
993+ id: page0
994+ title: "One"
995+ visible: false
996+
997+ ListView {
998+ id: view
999+ anchors.fill: parent
1000+ model: 15
1001+ delegate: Standard {
1002+ width: ListView.view.width
1003+ height: units.gu(5)
1004+ text: index
1005+ }
1006+ PullToRefresh {
1007+ id: pullMe
1008+ onRefresh: {
1009+ refreshing = true;
1010+ refreshing = false;
1011+ pageStack.push(page1)
1012+ }
1013+ }
1014+ }
1015+ }
1016+ Page {
1017+ id: page1
1018+ title: "Two"
1019+ visible: false
1020+ Button {
1021+ anchors.centerIn: parent
1022+ onClicked: pageStack.pop()
1023+ text: "back"
1024+ }
1025+ }
1026+ Component.onCompleted: pageStack.push(page0)
1027+ }
1028+ }
1029+
1030+ UbuntuTestCase {
1031+ name: "PullToRefreshPageStackPushWhileRefreshing"
1032+ when: windowShown
1033+
1034+ function test_push_while_refreshing_bug1578619() {
1035+ var initialTopMargin = view.topMargin;
1036+ var initialContentY = view.contentY;
1037+ flick(view, view.width/2, units.gu(10), 0, units.gu(40));
1038+ wait(1000);
1039+ pageStack.pop();
1040+ tryCompare(view, "moving", false);
1041+ tryCompare(view, "topMargin", initialTopMargin, 500,
1042+ "Initial topMargin of flickable is not restored after refreshing.");
1043+ tryCompare(view, "contentY", initialContentY, 500,
1044+ "Initial contentY of flickable is not restored after refreshing.")
1045+ }
1046+ }
1047+}
1048
1049=== added file 'tests/unit_x11/tst_components/tst_pulltorefresh_topmargin.qml'
1050--- tests/unit_x11/tst_components/tst_pulltorefresh_topmargin.qml 1970-01-01 00:00:00 +0000
1051+++ tests/unit_x11/tst_components/tst_pulltorefresh_topmargin.qml 2016-05-18 10:22:28 +0000
1052@@ -0,0 +1,59 @@
1053+/*
1054+ * Copyright 2016 Canonical Ltd.
1055+ *
1056+ * This program is free software; you can redistribute it and/or modify
1057+ * it under the terms of the GNU Lesser General Public License as published by
1058+ * the Free Software Foundation; version 3.
1059+ *
1060+ * This program is distributed in the hope that it will be useful,
1061+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1062+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1063+ * GNU Lesser General Public License for more details.
1064+ *
1065+ * You should have received a copy of the GNU Lesser General Public License
1066+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1067+ */
1068+
1069+import QtQuick 2.4
1070+import Ubuntu.Components 1.3
1071+import QtTest 1.0
1072+import Ubuntu.Test 1.3
1073+
1074+Item {
1075+ width: units.gu(40)
1076+ height: units.gu(71)
1077+ id: root
1078+ Flickable {
1079+ id: view
1080+ anchors.fill: parent
1081+ contentHeight: 1.6*view.height
1082+ Label {
1083+ anchors.centerIn: parent
1084+ text: "void"
1085+ }
1086+ PullToRefresh {
1087+ id: pullToRefresh
1088+ parent: view
1089+ onRefresh: {
1090+ refreshing = true;
1091+ refreshing = false;
1092+ }
1093+ }
1094+ }
1095+
1096+ UbuntuTestCase {
1097+ name: "PullToRefreshTopMargin"
1098+ when: windowShown
1099+
1100+ function test_reposition_after_refresh_bug1578619() {
1101+ var initialTopMargin = view.topMargin;
1102+ var initialContentY = view.contentY;
1103+ flick(view, view.width/2, units.gu(10), 0, units.gu(40));
1104+ tryCompare(view, "moving", false);
1105+ tryCompare(view, "topMargin", initialTopMargin, 500,
1106+ "Initial topMargin of flickable is not restored after refreshing.");
1107+ tryCompare(view, "contentY", initialContentY, 500,
1108+ "Initial contentY of flickable is not restored after refreshing.")
1109+ }
1110+ }
1111+}
1112
1113=== added file 'tests/unit_x11/tst_components/tst_tabs11.qml'
1114--- tests/unit_x11/tst_components/tst_tabs11.qml 1970-01-01 00:00:00 +0000
1115+++ tests/unit_x11/tst_components/tst_tabs11.qml 2016-05-18 10:22:28 +0000
1116@@ -0,0 +1,198 @@
1117+/*
1118+ * Copyright 2012-2016 Canonical Ltd.
1119+ *
1120+ * This program is free software; you can redistribute it and/or modify
1121+ * it under the terms of the GNU Lesser General Public License as published by
1122+ * the Free Software Foundation; version 3.
1123+ *
1124+ * This program is distributed in the hope that it will be useful,
1125+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1126+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1127+ * GNU Lesser General Public License for more details.
1128+ *
1129+ * You should have received a copy of the GNU Lesser General Public License
1130+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1131+ */
1132+
1133+import QtQuick 2.2
1134+import Ubuntu.Test 1.0
1135+import Ubuntu.Components 1.1
1136+
1137+MainView {
1138+ id: mainView
1139+ width: units.gu(50)
1140+ height: units.gu(80)
1141+ useDeprecatedToolbar: false
1142+
1143+ Tabs {
1144+ id: tabs
1145+ Tab {
1146+ id: tab1
1147+ title: "tab 1"
1148+ page: Page {
1149+ id: page1
1150+ Button {
1151+ id: button
1152+ anchors.centerIn: parent
1153+ text: "click"
1154+ }
1155+ }
1156+ }
1157+ Tab {
1158+ id: tab2
1159+ title: "tab 2"
1160+ page: Page {
1161+ id: page2
1162+ }
1163+ }
1164+ Tab {
1165+ id: tab3
1166+ title: "tab 3"
1167+ page: Page {
1168+ id: page3
1169+ }
1170+ }
1171+ Tab {
1172+ id: tabFlick1
1173+ title: "flick"
1174+ page: Page {
1175+ Flickable {
1176+ id: flickable1
1177+ anchors.fill: parent
1178+ }
1179+ }
1180+ }
1181+ Tab {
1182+ id: tabFlick2
1183+ title: "flick 2"
1184+ page: Page {
1185+ Flickable {
1186+ id: flickable2
1187+ anchors.fill: parent
1188+ }
1189+ }
1190+ }
1191+ Tab {
1192+ id: tabFlickLoader
1193+ title: "load"
1194+ page: Loader {
1195+ id: loader
1196+ sourceComponent: tabs.selectedTabIndex != 5 ? null : pageComponent
1197+ }
1198+ }
1199+ Tab {
1200+ id: tabNoFlickLoader
1201+ title: "loadNoFlick"
1202+ page: Loader {
1203+ id: loaderNoFlick
1204+ anchors {
1205+ left: parent.left
1206+ right: parent.right
1207+ bottom: parent.bottom
1208+ }
1209+ // height compes from the loaded Page
1210+ sourceComponent: tabs.selectedTabIndex === 6 ? pageComponentNoFlick : null
1211+ }
1212+ }
1213+ Tab {
1214+ // Test for bug #1570886, see initTestCase().
1215+ id: tabWithTitleFromPage
1216+ page: Page {
1217+ title: "Title from Page"
1218+ }
1219+ }
1220+ }
1221+ Component {
1222+ id: pageComponent
1223+ Page {
1224+ title: "Loaded page"
1225+ property Flickable flick: loadedFlickable
1226+ Flickable {
1227+ id: loadedFlickable
1228+ anchors.fill: parent
1229+ contentHeight: 1000
1230+ }
1231+ }
1232+ }
1233+ Component {
1234+ id: pageComponentNoFlick
1235+ Page {
1236+ title: "Loaded page without flickable"
1237+ }
1238+ }
1239+
1240+ UbuntuTestCase {
1241+ name: "TabsAPINewHeader"
1242+ when: windowShown
1243+
1244+ function initTestCase() {
1245+ // Test for bug #1570886.
1246+ compare(mainView.__propagated.header.title, tab1.title,
1247+ "Incorrect initial header title.");
1248+ }
1249+
1250+ function test_tabsDefaults() {
1251+ compare(tabs.selectedTabIndex, 0, "The default selectedTabIndex is 0 when Tabs has contents");
1252+ compare(tabs.selectedTab, tab1, "The default selectedTab is the first tab");
1253+ compare(tabs.currentPage, page1, "The default currentPage is the page of the first tab");
1254+ }
1255+
1256+ function test_tabsSetSelectedTab() {
1257+ var tabArray = [tab1, tab2, tab3];
1258+ var pageArray = [page1, page2, page3];
1259+ for (var i=0; i < 3; i++) {
1260+ tabs.selectedTabIndex = i;
1261+ compare(tabs.selectedTabIndex, i, "Can set selectedTabIndex");
1262+ compare(tabs.selectedTab, tabArray[i], "Can update selectedTab by setting selectedTabIndex");
1263+ compare(tabs.currentPage, pageArray[i], "Can update currentPage by setting selectedTabIndex");
1264+ for (var j=0; j < 3; j++) {
1265+ compare(pageArray[j].active, j===i, "Only the page of the selected tab is active");
1266+ }
1267+ }
1268+ }
1269+
1270+ function test_flickable() {
1271+ // ensure that the flickable of the header is set to the flickable of the selected tab.
1272+ tabs.selectedTabIndex = 3;
1273+ compare(mainView.__propagated.header.flickable, flickable1, "Header flickable correctly initialized");
1274+ tabs.selectedTabIndex = 4;
1275+ compare(mainView.__propagated.header.flickable, flickable2, "Header flickable correctly updated");
1276+ tabs.selectedTabIndex = 0;
1277+ }
1278+
1279+ function test_pageLoader() {
1280+ tabs.selectedTabIndex = 0;
1281+ compare(loader.item, null, "Page not loaded when tab is not selected");
1282+ tabs.selectedTabIndex = 5;
1283+ compare(tabs.currentPage, loader, "Selected loader for current page");
1284+ compare(loader.item.title, "Loaded page", "Loaded item is a page");
1285+ tabs.selectedTabIndex = 0;
1286+ compare(loader.item, null, "Loaded page was properly unloaded");
1287+ }
1288+
1289+ function test_bug1088740() {
1290+ tabs.selectedTabIndex = 5;
1291+ compare(mainView.__propagated.header.flickable, loader.item.flick, "Header flickable correctly updated with Loader");
1292+ compare(loader.item.flick.contentHeight, 1000, "Header flickable is correct flickable");
1293+ tabs.selectedTabIndex = 0;
1294+ }
1295+
1296+ function test_pageHeightLoaderNoFlick_bug1259917() {
1297+ tabs.selectedTabIndex = 6;
1298+ compare(tabs.selectedTab, tabNoFlickLoader, "Tab 6 was selected.");
1299+ compare(mainView.__propagated.header.flickable, null, "Loaded page without flickable.");
1300+ compare(loaderNoFlick.item.height, mainView.height - mainView.__propagated.header.height,
1301+ "Correct height for loaded Page without flickable.");
1302+ }
1303+
1304+ function test_index() {
1305+ compare(tab1.index, 0, "tab1 is at 0");
1306+ compare(tab2.index, 1, "tab2 is at 1");
1307+ compare(tab3.index, 2, "tab3 is at 2");
1308+ compare(tabFlick1.index, 3, "tabFlick1 is at 3");
1309+ compare(tabFlick2.index, 4, "tabFlick2 is at 4");
1310+ compare(tabFlickLoader.index, 5, "tabFlickLoader is at 5");
1311+ compare(tabNoFlickLoader.index, 6, "tabNoFlickLoader is at 6");
1312+ }
1313+ }
1314+}
1315
1316=== renamed file 'tests/unit_x11/tst_components/tst_tabs.qml' => 'tests/unit_x11/tst_components/tst_tabs13.qml'
1317--- tests/unit_x11/tst_components/tst_tabs.qml 2015-09-03 11:44:38 +0000
1318+++ tests/unit_x11/tst_components/tst_tabs13.qml 2016-05-18 10:22:28 +0000
1319@@ -1,5 +1,5 @@
1320 /*
1321- * Copyright 2012-2014 Canonical Ltd.
1322+ * Copyright 2016 Canonical Ltd.
1323 *
1324 * This program is free software; you can redistribute it and/or modify
1325 * it under the terms of the GNU Lesser General Public License as published by
1326@@ -14,15 +14,14 @@
1327 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1328 */
1329
1330-import QtQuick 2.2
1331+import QtQuick 2.4
1332 import Ubuntu.Test 1.0
1333-import Ubuntu.Components 1.1
1334+import Ubuntu.Components 1.3
1335
1336 MainView {
1337 id: mainView
1338 width: units.gu(50)
1339 height: units.gu(80)
1340- useDeprecatedToolbar: false
1341
1342 Tabs {
1343 id: tabs
1344@@ -94,6 +93,13 @@
1345 sourceComponent: tabs.selectedTabIndex === 6 ? pageComponentNoFlick : null
1346 }
1347 }
1348+ Tab {
1349+ // Test for bug #1570886, see initTestCase().
1350+ id: tabWithTitleFromPage
1351+ page: Page {
1352+ title: "Title from Page"
1353+ }
1354+ }
1355 }
1356 Component {
1357 id: pageComponent
1358@@ -118,6 +124,12 @@
1359 name: "TabsAPINewHeader"
1360 when: windowShown
1361
1362+ function initTestCase() {
1363+ // Test for bug #1570886.
1364+ compare(mainView.__propagated.header.title, tab1.title,
1365+ "Incorrect initial header title.");
1366+ }
1367+
1368 function test_tabsDefaults() {
1369 compare(tabs.selectedTabIndex, 0, "The default selectedTabIndex is 0 when Tabs has contents");
1370 compare(tabs.selectedTab, tab1, "The default selectedTab is the first tab");

Subscribers

People subscribed via source and target branches

to status/vote changes: