Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-shape-texture-ref-counting into lp:ubuntu-ui-toolkit

Proposed by Michał Sawicz
Status: Merged
Merged at revision: 1342
Proposed branch: lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-shape-texture-ref-counting
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 1250 lines (+404/-190)
41 files modified
components.api (+6/-0)
export_qml_dir.sh (+2/-0)
src/Ubuntu/Components/1.3/AdaptivePageLayout.qml (+3/-0)
src/Ubuntu/Components/1.3/PageHeader.qml (+2/-1)
src/Ubuntu/Components/1.3/TextArea.qml (+3/-4)
src/Ubuntu/Components/Styles/1.3/PageHeadStyle.qml (+1/-0)
src/Ubuntu/Components/Styles/1.3/SectionsStyle.qml (+50/-0)
src/Ubuntu/Components/Styles/Styles.pro (+1/-3)
src/Ubuntu/Components/Styles/qmldir (+1/-0)
src/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadButton.qml (+1/-1)
src/Ubuntu/Components/Themes/Ambiance/1.2/ProgressionVisualStyle.qml (+2/-2)
src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadButton.qml (+1/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml (+10/-0)
src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml (+1/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressionVisualStyle.qml (+1/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml (+2/-2)
src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml (+16/-30)
src/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml (+6/-0)
src/Ubuntu/Components/Themes/ThemesModule.pro (+0/-3)
src/Ubuntu/Components/plugin/plugin.pri (+2/-1)
src/Ubuntu/Components/plugin/ucabstractbutton.cpp (+0/-3)
src/Ubuntu/Components/plugin/ucperformancemonitor.cpp (+24/-6)
src/Ubuntu/Components/plugin/ucubuntushape.cpp (+77/-90)
src/Ubuntu/Components/plugin/ucubuntushape.h (+7/-2)
src/Ubuntu/Components/plugin/ucubuntushapetextures.cpp (+5/-11)
src/Ubuntu/Components/plugin/ucubuntushapetextures.h (+17/-0)
tests/unit/add_qmlmakecheck.pri (+1/-1)
tests/unit/add_qmlmakecheck_x11.pri (+1/-1)
tests/unit/i18n/LocalizedApp/LocalizedApp.pro (+0/-1)
tests/unit/i18n/RelativeTime/RelativeTime.pro (+0/-1)
tests/unit/mainview/mainview.pro (+0/-2)
tests/unit/page/page.pro (+0/-2)
tests/unit/performance/TextArea13Grid.qml (+33/-0)
tests/unit/performance/tst_performance.cpp (+1/-0)
tests/unit/runtest.sh (+20/-15)
tests/unit/visual/gallery.qml (+78/-0)
tests/unit/visual/gallery.sh (+6/-0)
tests/unit/visual/tst_pageheader.qml (+2/-1)
tests/unit/visual/tst_picker13.qml (+1/-0)
tests/unit/visual/tst_popups_dialog13.qml (+13/-0)
tests/xvfb.sh (+7/-4)
To merge this branch: bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-shape-texture-ref-counting
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu SDK team Pending
Review via email: mp+292397@code.launchpad.net

Commit message

[UbuntuShape] Use reference counting to handle shape textures.

The current shape textures handling system requires to search for the textures associated to the current graphics context by doing a search in an array for each item at each updatePaintNode() call. It also deletes the textures on OpenGLContext::aboutToBeDestroyed() signal emission, which appears in some cases to not have any OpenGL context bound.

We propose an alternative to create and destroy shape textures per material creation and destruction with a reference counting mechanism to minimise costly calls. We search for the shape textures (hash lookup with an OpenGL context pointer as the key) only when a texture material is created or deleted, which is much more occasional compared to updatePaintNode() calls. That also ensures textures are deleted with the proper OpenGL context bound.

The only drawback is that shape textures are deleted when there is no shape items anymore in a scene and recreated when there is a new one appearing. These operations being quite uncommon and relatively fast, the advantages seem to be higher than the drawbacks.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1846. By Loïc Molinari

Merged lp:ubuntu-ui-toolkit/staging.

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-05-20 17:33:56 +0000
3+++ components.api 2016-06-16 09:57:10 +0000
4@@ -1076,6 +1076,12 @@
5 property list<Action> actions
6 property var model
7 property int selectedIndex
8+Ubuntu.Components.Styles.SectionsStyle 1.3: Item
9+ property color pressedBackgroundColor
10+ property color sectionColor
11+ property color selectedSectionColor
12+ property int textSize
13+ property color underlineColor
14 Ubuntu.Components.ServiceProperties 1.1 UCServiceProperties: QtObject
15 property string adaptorInterface 1.1
16 readonly property string error 1.1
17
18=== modified file 'export_qml_dir.sh'
19--- export_qml_dir.sh 2016-04-05 16:14:13 +0000
20+++ export_qml_dir.sh 2016-06-16 09:57:10 +0000
21@@ -28,6 +28,8 @@
22 export LD_LIBRARY_PATH=$BUILD_DIR/lib:$UBUNTU_QML_DIRS$LD_LIBRARY_PATH
23 # Build machines may not have initctl and don't need it
24 test -f /sbin/initctl || return 0
25+# initctl may be available but not working (for example in a lxd container without upstart)
26+/sbin/initctl list > /dev/null || return 0
27 /sbin/initctl set-env --global QML_IMPORT_PATH=$BUILD_DIR/qml
28 /sbin/initctl set-env --global QML2_IMPORT_PATH=$BUILD_DIR/qml
29 /sbin/initctl set-env --global UBUNTU_UI_TOOLKIT_THEMES_PATH=$BUILD_DIR/qml
30
31=== modified file 'src/Ubuntu/Components/1.3/AdaptivePageLayout.qml'
32--- src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2016-05-25 12:48:10 +0000
33+++ src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2016-06-16 09:57:10 +0000
34@@ -827,6 +827,9 @@
35 property color panelColor: layout.__propagated.header.panelColor
36 property color backgroundColor: layout.__propagated.header.backgroundColor
37
38+ // Enable red outline in the PageHeadStyle. See bug #1583636.
39+ property bool showDeprecatedWarning: true
40+
41 visible: !customHeader && holder.pageWrapper && holder.pageWrapper.active
42
43 // The multiColumn, page and showBackButton properties are used in
44
45=== modified file 'src/Ubuntu/Components/1.3/PageHeader.qml'
46--- src/Ubuntu/Components/1.3/PageHeader.qml 2016-05-25 12:48:10 +0000
47+++ src/Ubuntu/Components/1.3/PageHeader.qml 2016-06-16 09:57:10 +0000
48@@ -1,5 +1,5 @@
49 /*
50- * Copyright 2015 Canonical Ltd.
51+ * Copyright 2016 Canonical Ltd.
52 *
53 * This program is free software; you can redistribute it and/or modify
54 * it under the terms of the GNU Lesser General Public License as published by
55@@ -109,6 +109,7 @@
56 property Item previousContentsParent: null
57
58 function updateContents() {
59+ if (!__styleInstance) return; // the style needs to be loaded first
60 if (previousContents) {
61 previousContents.parent = previousContentsParent;
62 }
63
64=== modified file 'src/Ubuntu/Components/1.3/TextArea.qml'
65--- src/Ubuntu/Components/1.3/TextArea.qml 2016-05-25 12:48:10 +0000
66+++ src/Ubuntu/Components/1.3/TextArea.qml 2016-06-16 09:57:10 +0000
67@@ -875,6 +875,9 @@
68 }
69 }
70 }
71+
72+ /*! \internal */
73+ property Item __rightScrollbar: rightScrollbar
74 Scrollbar {
75 id: rightScrollbar
76 flickableItem: flicker
77@@ -884,10 +887,6 @@
78 anchors.topMargin: -internal.frameSpacing
79 anchors.rightMargin: -internal.frameSpacing
80 anchors.bottomMargin: -internal.frameSpacing
81- Ubuntu.StyleHints {
82- // No background color
83- troughColorSteppersStyle: Qt.rgba(0, 0, 0, 0)
84- }
85 }
86
87 styleName: "TextAreaStyle"
88
89=== modified file 'src/Ubuntu/Components/Styles/1.3/PageHeadStyle.qml'
90--- src/Ubuntu/Components/Styles/1.3/PageHeadStyle.qml 2015-09-22 14:39:47 +0000
91+++ src/Ubuntu/Components/Styles/1.3/PageHeadStyle.qml 2016-06-16 09:57:10 +0000
92@@ -17,6 +17,7 @@
93
94 /*!
95 \qmltype PageHeadStyle
96+ \deprecated
97 \inqmlmodule Ubuntu.Components.Styles 1.1
98 \ingroup style-api
99 \brief Style API for page header.
100
101=== added file 'src/Ubuntu/Components/Styles/1.3/SectionsStyle.qml'
102--- src/Ubuntu/Components/Styles/1.3/SectionsStyle.qml 1970-01-01 00:00:00 +0000
103+++ src/Ubuntu/Components/Styles/1.3/SectionsStyle.qml 2016-06-16 09:57:10 +0000
104@@ -0,0 +1,50 @@
105+/*
106+ * Copyright 2016 Canonical Ltd.
107+ *
108+ * This program is free software; you can redistribute it and/or modify
109+ * it under the terms of the GNU Lesser General Public License as published by
110+ * the Free Software Foundation; version 3.
111+ *
112+ * This program is distributed in the hope that it will be useful,
113+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
114+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
115+ * GNU Lesser General Public License for more details.
116+ *
117+ * You should have received a copy of the GNU Lesser General Public License
118+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
119+ */
120+import QtQuick 2.4
121+/*!
122+ \qmltype SectionsStyle
123+ \inqmlmodule Ubuntu.Components.Styles 1.3
124+ \ingroup style-api
125+ \brief Style API for Sections.
126+
127+ The component defines the style API for the \l Sections component.
128+ */
129+Item {
130+ /*!
131+ The foreground color of unselected sections.
132+ */
133+ property color sectionColor
134+
135+ /*!
136+ The foreground color of underline of unselected sections.
137+ */
138+ property color underlineColor
139+
140+ /*!
141+ The foreground color of the selected section.
142+ */
143+ property color selectedSectionColor
144+
145+ /*!
146+ The background color for the pressed section button.
147+ */
148+ property color pressedBackgroundColor
149+
150+ /*!
151+ The size of text in the buttons.
152+ */
153+ property int textSize
154+}
155
156=== modified file 'src/Ubuntu/Components/Styles/Styles.pro'
157--- src/Ubuntu/Components/Styles/Styles.pro 2015-11-24 20:49:07 +0000
158+++ src/Ubuntu/Components/Styles/Styles.pro 2016-06-16 09:57:10 +0000
159@@ -1,7 +1,5 @@
160 TARGETPATH = Ubuntu/Components/Styles
161
162-ARTWORK_FILES = $$system(find artwork -type f)
163-
164 QML_FILES += 1.2/ComboButtonStyle.qml \
165 1.2/PageHeadStyle.qml \
166 1.2/PullToRefreshStyle.qml \
167@@ -9,7 +7,7 @@
168 1.3/ActionBarStyle.qml \
169 1.3/PageHeaderStyle.qml \
170 1.3/ToolbarStyle.qml \
171- $$ARTWORK_FILES
172+ 1.3/SectionsStyle.qml \
173
174 load(ubuntu_qml_module)
175
176
177=== modified file 'src/Ubuntu/Components/Styles/qmldir'
178--- src/Ubuntu/Components/Styles/qmldir 2015-11-24 20:49:07 +0000
179+++ src/Ubuntu/Components/Styles/qmldir 2016-06-16 09:57:10 +0000
180@@ -9,3 +9,4 @@
181 ActionBarStyle 1.3 1.3/ActionBarStyle.qml
182 PageHeaderStyle 1.3 1.3/PageHeaderStyle.qml
183 ToolbarStyle 1.3 1.3/ToolbarStyle.qml
184+SectionsStyle 1.3 1.3/SectionsStyle.qml
185
186=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadButton.qml'
187--- src/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadButton.qml 2015-04-24 14:43:08 +0000
188+++ src/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadButton.qml 2016-06-16 09:57:10 +0000
189@@ -43,7 +43,7 @@
190 // when the button is invisible by setting width and height to 0
191 width: visible ? button.iconWidth : 0
192 height: visible ? button.iconHeight : 0
193- source: button.iconSource
194+ source: visible ? button.iconSource : ""
195 color: Qt.rgba(0, 0, 0, 0)
196 opacity: button.enabled ? 1.0 : 0.3
197 }
198
199=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.2/ProgressionVisualStyle.qml'
200--- src/Ubuntu/Components/Themes/Ambiance/1.2/ProgressionVisualStyle.qml 2015-04-24 14:52:19 +0000
201+++ src/Ubuntu/Components/Themes/Ambiance/1.2/ProgressionVisualStyle.qml 2016-06-16 09:57:10 +0000
202@@ -27,7 +27,7 @@
203
204 Image {
205 id: progressIcon
206- source: progressionIconSource
207+ source: visible ? progressionIconSource : ""
208 anchors {
209 verticalCenter: parent.verticalCenter
210 right: parent.right
211@@ -46,7 +46,7 @@
212 right: progressIcon.left
213 rightMargin: styledItem.splitMargin
214 }
215- source: progressionDividerSource
216+ source: visible ? progressionDividerSource : ""
217 opacity: enabled ? 1.0 : 0.5
218 }
219 }
220
221=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadButton.qml'
222--- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadButton.qml 2015-09-21 14:44:13 +0000
223+++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadButton.qml 2016-06-16 09:57:10 +0000
224@@ -44,7 +44,7 @@
225 // when the button is invisible by setting width and height to 0
226 width: visible ? button.iconWidth : 0
227 height: visible ? button.iconHeight : 0
228- source: button.iconSource
229+ source: visible ? button.iconSource : ""
230 color: Qt.rgba(0, 0, 0, 0)
231 opacity: button.enabled ? 1.0 : 0.3
232 }
233
234=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml'
235--- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml 2016-02-29 16:02:50 +0000
236+++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml 2016-06-16 09:57:10 +0000
237@@ -50,8 +50,18 @@
238 */
239 property color backgroundColor: styledItem.backgroundColor
240 Rectangle {
241+ id: background
242 anchors.fill: parent
243 color: headerStyle.backgroundColor
244+
245+ // The border is shown to warn the developer that the AppHeader
246+ // is deprecated. See bug #1583636
247+ property bool showBorder: styledItem.hasOwnProperty("showDeprecatedWarning") &&
248+ styledItem.showDeprecatedWarning
249+ border {
250+ width: background.showBorder ? units.gu(0.5) : 0
251+ color: background.showBorder ? UbuntuColors.red : "transparent"
252+ }
253 }
254
255 // FIXME: When the three panel color properties below are removed,
256
257=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml'
258--- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2016-05-06 08:53:16 +0000
259+++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2016-06-16 09:57:10 +0000
260@@ -1,5 +1,5 @@
261 /*
262- * Copyright 2015 Canonical Ltd.
263+ * Copyright 2016 Canonical Ltd.
264 *
265 * This program is free software; you can redistribute it and/or modify
266 * it under the terms of the GNU Lesser General Public License as published by
267
268=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressionVisualStyle.qml'
269--- src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressionVisualStyle.qml 2015-04-25 07:36:13 +0000
270+++ src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressionVisualStyle.qml 2016-06-16 09:57:10 +0000
271@@ -46,7 +46,7 @@
272 right: progressIcon.left
273 rightMargin: styledItem.splitMargin
274 }
275- source: progressionDividerSource
276+ source: visible ? progressionDividerSource : ""
277 opacity: enabled ? 1.0 : 0.5
278 }
279 }
280
281=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml'
282--- src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml 2016-04-22 03:43:33 +0000
283+++ src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml 2016-06-16 09:57:10 +0000
284@@ -939,7 +939,7 @@
285 anchors.centerIn: parent
286 width: __stepperAssetWidth
287 rotation: isVertical ? 180 : 90
288- source: Qt.resolvedUrl("../artwork/toolkit_scrollbar-stepper.svg")
289+ source: visible ? Qt.resolvedUrl("../artwork/toolkit_scrollbar-stepper.svg") : ""
290 color: Qt.rgba(sliderColor.r, sliderColor.g, sliderColor.b,
291 sliderColor.a * ((flickableItem && flickableItem[scrollbarUtils.propAtBeginning])
292 ? __stepperImgOpacityDisabled
293@@ -982,7 +982,7 @@
294 anchors.centerIn: parent
295 width: __stepperAssetWidth
296 rotation: isVertical ? 0 : -90
297- source: Qt.resolvedUrl("../artwork/toolkit_scrollbar-stepper.svg")
298+ source: visible ? Qt.resolvedUrl("../artwork/toolkit_scrollbar-stepper.svg") : ""
299 color: Qt.rgba(sliderColor.r, sliderColor.g, sliderColor.b,
300 sliderColor.a * ((flickableItem && flickableItem[scrollbarUtils.propAtEnd])
301 ? __stepperImgOpacityDisabled
302
303=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml'
304--- src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2016-05-17 13:00:51 +0000
305+++ src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2016-06-16 09:57:10 +0000
306@@ -15,44 +15,30 @@
307 */
308 import QtQuick 2.4
309 import QtQuick.Window 2.2
310+import QtGraphicalEffects 1.0
311 import Ubuntu.Components 1.3
312-import QtGraphicalEffects 1.0
313 import Ubuntu.Components.Private 1.3
314+import Ubuntu.Components.Styles 1.3 as Style
315
316-Item {
317+Style.SectionsStyle {
318 id: sectionsStyle
319
320 implicitWidth: sectionsListView.contentWidth + 2 * listViewContainer.listViewMargins
321 implicitHeight: Screen.height > units.gu(50) ? units.gu(4) : units.gu(3)
322
323- /*!
324- The foreground color of unselected sections.
325- */
326- property color sectionColor: enabled
327- ? theme.palette.normal.backgroundTertiaryText
328- : theme.palette.disabled.backgroundTertiaryText
329-
330- /*!
331- The foreground color of underline rectangle of unselected sections.
332- */
333- property color underlineColor: theme.palette.normal.base
334-
335- /*!
336- The foreground color of the selected section.
337- */
338- property color selectedSectionColor: enabled
339- ? theme.palette.selected.positionText
340- : theme.palette.selectedDisabled.positionText
341-
342- /*!
343- The background color for the pressed section button.
344- */
345- property color pressedBackgroundColor: theme.palette.highlighted.background
346-
347- /*!
348- The size of text in the buttons.
349- */
350- property int textSize: Label.Medium
351+ sectionColor: enabled
352+ ? theme.palette.normal.backgroundTertiaryText
353+ : theme.palette.disabled.backgroundTertiaryText
354+
355+ underlineColor: theme.palette.normal.base
356+
357+ selectedSectionColor: enabled
358+ ? theme.palette.selected.positionText
359+ : theme.palette.selectedDisabled.positionText
360+
361+ pressedBackgroundColor: theme.palette.highlighted.background
362+
363+ textSize: Label.Medium
364
365 /*!
366 The spacing on the left and right sides of the label
367
368=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml'
369--- src/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml 2016-05-10 12:08:32 +0000
370+++ src/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml 2016-06-16 09:57:10 +0000
371@@ -76,6 +76,12 @@
372 radius: units.gu(1.7)
373 backgroundColor: visuals.backgroundColor
374 aspect: UbuntuShape.Flat
375+ source: ShaderEffectSource {
376+ sourceItem: styledItem.__rightScrollbar ? styledItem.__rightScrollbar : null
377+ hideSource: true
378+ }
379+ sourceFillMode: UbuntuShape.Pad
380+ sourceHorizontalAlignment: UbuntuShape.AlignRight
381 }
382 }
383
384
385=== modified file 'src/Ubuntu/Components/Themes/ThemesModule.pro'
386--- src/Ubuntu/Components/Themes/ThemesModule.pro 2015-05-19 09:23:01 +0000
387+++ src/Ubuntu/Components/Themes/ThemesModule.pro 2016-06-16 09:57:10 +0000
388@@ -1,12 +1,9 @@
389 TARGETPATH = Ubuntu/Components/Themes
390
391
392-ARTWORK_FILES = $$system(find artwork -type f)
393-
394 QML_FILES += 1.2/Palette.qml \
395 1.2/PaletteValues.qml \
396 1.3/Palette.qml \
397 1.3/PaletteValues.qml \
398- $$ARTWORK_FILES
399
400 load(ubuntu_qml_module)
401
402=== modified file 'src/Ubuntu/Components/plugin/plugin.pri'
403--- src/Ubuntu/Components/plugin/plugin.pri 2016-06-02 12:50:02 +0000
404+++ src/Ubuntu/Components/plugin/plugin.pri 2016-06-16 09:57:10 +0000
405@@ -28,7 +28,7 @@
406 $$PWD/ucunits.h \
407 $$PWD/ucqquickimageextension.h \
408 $$PWD/quickutils.h \
409- $$PWD/ucubuntushapetexture.h \
410+ $$PWD/ucubuntushapetextures.h \
411 $$PWD/ucubuntushape.h \
412 $$PWD/ucubuntushapeoverlay.h \
413 $$PWD/ucproportionalshape.h \
414@@ -126,6 +126,7 @@
415 $$PWD/ucunits.cpp \
416 $$PWD/ucqquickimageextension.cpp \
417 $$PWD/quickutils.cpp \
418+ $$PWD/ucubuntushapetextures.cpp \
419 $$PWD/ucubuntushape.cpp \
420 $$PWD/ucubuntushapeoverlay.cpp \
421 $$PWD/ucproportionalshape.cpp \
422
423=== modified file 'src/Ubuntu/Components/plugin/ucabstractbutton.cpp'
424--- src/Ubuntu/Components/plugin/ucabstractbutton.cpp 2016-05-30 09:48:54 +0000
425+++ src/Ubuntu/Components/plugin/ucabstractbutton.cpp 2016-06-16 09:57:10 +0000
426@@ -129,9 +129,6 @@
427 {
428 UCActionItem::classBegin();
429
430- // make sure we have the haptics set up!
431- HapticsProxy::instance()->initialize();
432-
433 // set up mouse area
434 Q_D(UCAbstractButton);
435 QQml_setParent_noEvent(d->mouseArea, this);
436
437=== modified file 'src/Ubuntu/Components/plugin/ucperformancemonitor.cpp'
438--- src/Ubuntu/Components/plugin/ucperformancemonitor.cpp 2016-03-15 13:46:27 +0000
439+++ src/Ubuntu/Components/plugin/ucperformancemonitor.cpp 2016-06-16 09:57:10 +0000
440@@ -21,10 +21,23 @@
441
442 Q_LOGGING_CATEGORY(ucPerformance, "[PERFORMANCE]")
443
444-const int singleFrameThreshold = 32;
445-const int multipleFrameThreshold = 17;
446-const int framesCountThreshold = 10;
447-const int warningCountThreshold = 30;
448+static int singleFrameThreshold = 32;
449+static int multipleFrameThreshold = 17;
450+static int framesCountThreshold = 10;
451+static int warningCountThreshold = 30;
452+
453+// TODO Qt 5.5. switch to qEnvironmentVariableIntValue
454+static int getenvInt(const char* name, int defaultValue)
455+{
456+ if (qEnvironmentVariableIsSet(name)) {
457+ QByteArray stringValue = qgetenv(name);
458+ bool ok;
459+ int value = stringValue.toFloat(&ok);
460+ return ok ? value : defaultValue;
461+ } else {
462+ return defaultValue;
463+ }
464+}
465
466 UCPerformanceMonitor::UCPerformanceMonitor(QObject* parent) :
467 QObject(parent),
468@@ -34,6 +47,11 @@
469 {
470 QObject::connect((QGuiApplication*)QGuiApplication::instance(), &QGuiApplication::applicationStateChanged,
471 this, &UCPerformanceMonitor::onApplicationStateChanged);
472+
473+ singleFrameThreshold = getenvInt("UC_PERFORMANCE_MONITOR_SINGLE_FRAME_THRESHOLD", singleFrameThreshold);
474+ multipleFrameThreshold = getenvInt("UC_PERFORMANCE_MONITOR_MULTIPLE_FRAME_THRESHOLD", multipleFrameThreshold);
475+ framesCountThreshold = getenvInt("UC_PERFORMANCE_MONITOR_FRAMES_COUNT_THRESHOLD", framesCountThreshold);
476+ warningCountThreshold = getenvInt("UC_PERFORMANCE_MONITOR_WARNING_COUNT_THRESHOLD", warningCountThreshold);
477 }
478
479 UCPerformanceMonitor::~UCPerformanceMonitor()
480@@ -53,7 +71,7 @@
481
482 void UCPerformanceMonitor::onApplicationStateChanged(Qt::ApplicationState state)
483 {
484- if (m_warningCount >= warningCountThreshold) {
485+ if (m_warningCount >= warningCountThreshold && warningCountThreshold != -1) {
486 // do not monitor performance if the warning count threshold was reached
487 return;
488 }
489@@ -124,7 +142,7 @@
490 m_framesAboveThreshold = 0;
491 }
492
493- if (m_warningCount >= warningCountThreshold) {
494+ if (m_warningCount >= warningCountThreshold && warningCountThreshold != -1) {
495 qCWarning(ucPerformance, "Too many warnings were given. Performance monitoring stops.");
496 connectToWindow(NULL);
497 }
498
499=== modified file 'src/Ubuntu/Components/plugin/ucubuntushape.cpp'
500--- src/Ubuntu/Components/plugin/ucubuntushape.cpp 2016-05-25 12:48:10 +0000
501+++ src/Ubuntu/Components/plugin/ucubuntushape.cpp 2016-06-16 09:57:10 +0000
502@@ -26,7 +26,6 @@
503 // evaluated.
504
505 #include "ucubuntushape.h"
506-#include "ucubuntushapetexture.h"
507 #include "ucunits.h"
508 #include "ucnamespace.h"
509 #include <QtCore/QPointer>
510@@ -90,10 +89,11 @@
511 {
512 Q_UNUSED(oldEffect);
513
514- const ShapeMaterial::Data* data = static_cast<ShapeMaterial*>(newEffect)->constData();
515+ ShapeMaterial* material = static_cast<ShapeMaterial*>(newEffect);
516+ const ShapeMaterial::Data* data = material->constData();
517
518 // Bind shape texture.
519- glBindTexture(GL_TEXTURE_2D, data->shapeTextureId);
520+ glBindTexture(GL_TEXTURE_2D, material->textureIds()[data->shapeTextureIndex]);
521
522 // Bind source texture on the 2nd texture unit and update uniforms.
523 bool textured = false;
524@@ -151,12 +151,82 @@
525
526 // --- Scene graph material ---
527
528+// Create and setup shape textures.
529+static void createShapeTextures(QOpenGLContext* openglContext, quint32* ids)
530+{
531+ glGenTextures(shapeTextureCount, ids);
532+
533+ if (UCUbuntuShape::useDistanceFields(openglContext)) {
534+ // Create distance field textures.
535+ for (int i = 0; i < shapeTextureCount; i++) {
536+ glBindTexture(GL_TEXTURE_2D, ids[i]);
537+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
538+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
539+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
540+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
541+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, shapeTextureWidth, shapeTextureHeight, 0,
542+ GL_RGBA, GL_UNSIGNED_BYTE, shapeTextureData[i]);
543+ }
544+ } else {
545+ // Create mipmap textures.
546+ for (int i = 0; i < shapeTextureCount; i++) {
547+ glBindTexture(GL_TEXTURE_2D, ids[i]);
548+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
549+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
550+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
551+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
552+ for (int j = 0; j < shapeTextureMipmapCount; j++) {
553+ glTexImage2D(GL_TEXTURE_2D, j, GL_RGBA, shapeTextureMipmapWidth >> j,
554+ shapeTextureMipmapHeight >> j, 0, GL_RGBA, GL_UNSIGNED_BYTE,
555+ &shapeTextureMipmapData[i][shapeTextureMipmapOffset[j]]);
556+ }
557+ }
558+ }
559+}
560+
561+class ShapeTextures {
562+public:
563+ ShapeTextures() : m_refCount(0) {}
564+ quint32* ids() { return m_ids; }
565+ quint32 ref() { Q_ASSERT(m_refCount < UINT_MAX); return ++m_refCount; }
566+ quint32 unref() { Q_ASSERT(m_refCount > 0); return --m_refCount; }
567+private:
568+ quint32 m_refCount;
569+ quint32 m_ids[shapeTextureCount];
570+};
571+
572+static QHash<QOpenGLContext*, ShapeTextures> shapeTexturesHash;
573+static QMutex shapeTexturesHashMutex;
574+
575 ShapeMaterial::ShapeMaterial()
576 {
577 // The whole struct (with the padding bytes) must be initialized for memcmp() to work as
578 // expected in ShapeMaterial::compare().
579 memset(&m_data, 0x00, sizeof(Data));
580 setFlag(Blending);
581+
582+ // Get or create the set of textures associated with the current context. We assume that QtQuick
583+ // associates the same graphics context to a material for its entire lifetime.
584+ QOpenGLContext* context = QOpenGLContext::currentContext();
585+ shapeTexturesHashMutex.lock();
586+ ShapeTextures& textures = shapeTexturesHash[context];
587+ if (textures.ref() == 1) {
588+ createShapeTextures(context, textures.ids());
589+ }
590+ memcpy(m_shapeTexturesId, textures.ids(), shapeTextureCount * sizeof(quint32));
591+ shapeTexturesHashMutex.unlock();
592+}
593+
594+ShapeMaterial::~ShapeMaterial()
595+{
596+ shapeTexturesHashMutex.lock();
597+ auto it = shapeTexturesHash.find(QOpenGLContext::currentContext());
598+ Q_ASSERT(it != shapeTexturesHash.end());
599+ if (it.value().unref() == 0) {
600+ glDeleteTextures(shapeTextureCount, it.value().ids());
601+ shapeTexturesHash.erase(it);
602+ }
603+ shapeTexturesHashMutex.unlock();
604 }
605
606 QSGMaterialType* ShapeMaterial::type() const
607@@ -246,12 +316,6 @@
608 const float implicitWidthGU = 8.0f;
609 const float implicitHeightGU = 8.0f;
610 const float radiusGuMap[3] = { 1.45f, 2.55f, 3.65f };
611-const int maxShapeTextures = 16;
612-
613-static struct { QOpenGLContext* openglContext; quint32 textureId[shapeTextureCount]; }
614- shapeTextures[maxShapeTextures];
615-
616-static int getShapeTexturesIndex(const QOpenGLContext* openglContext);
617
618 /*! \qmltype UbuntuShape
619 \instantiates UCUbuntuShape
620@@ -1041,67 +1105,6 @@
621 m_flags |= DirtySourceTransform;
622 }
623
624-// Gets the shapeTextures' slot used by the given context, or -1 if not stored.
625-static int getShapeTexturesIndex(const QOpenGLContext* openglContext)
626-{
627- int index = 0;
628- while (shapeTextures[index].openglContext != openglContext) {
629- index++;
630- if (index == maxShapeTextures) {
631- return -1;
632- }
633- }
634- return index;
635-}
636-
637-// Gets an empty shapeTextures' slot.
638-static int getEmptyShapeTexturesIndex()
639-{
640- int index = 0;
641- while (shapeTextures[index].openglContext) {
642- index++;
643- if (index == maxShapeTextures) {
644- // Don't bother with a dynamic array, let's just set a high enough maxShapeTextures and
645- // increase the static array size if ever needed.
646- qFatal("reached maximum number of OpenGL contexts supported by UbuntuShape");
647- }
648- }
649- return index;
650-}
651-
652-// Create and setup shape textures.
653-static void createShapeTextures(QOpenGLContext* openglContext, int index)
654-{
655- glGenTextures(shapeTextureCount, shapeTextures[index].textureId);
656-
657- if (UCUbuntuShape::useDistanceFields(openglContext)) {
658- // Create distance field textures.
659- for (int i = 0; i < shapeTextureCount; i++) {
660- glBindTexture(GL_TEXTURE_2D, shapeTextures[index].textureId[i]);
661- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
662- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
663- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
664- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
665- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, shapeTextureWidth, shapeTextureHeight, 0,
666- GL_RGBA, GL_UNSIGNED_BYTE, shapeTextureData[i]);
667- }
668- } else {
669- // Create mipmap textures.
670- for (int i = 0; i < shapeTextureCount; i++) {
671- glBindTexture(GL_TEXTURE_2D, shapeTextures[index].textureId[i]);
672- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
673- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
674- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
675- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
676- for (int j = 0; j < shapeTextureMipmapCount; j++) {
677- glTexImage2D(GL_TEXTURE_2D, j, GL_RGBA, shapeTextureMipmapWidth >> j,
678- shapeTextureMipmapHeight >> j, 0, GL_RGBA, GL_UNSIGNED_BYTE,
679- &shapeTextureMipmapData[i][shapeTextureMipmapOffset[j]]);
680- }
681- }
682- }
683-}
684-
685 // Gets the nearest boundary to coord in the texel grid of the given size.
686 static Q_DECL_CONSTEXPR float roundTextureCoord(float coord, float size)
687 {
688@@ -1182,22 +1185,6 @@
689 QSGNode* node = oldNode ? oldNode : createSceneGraphNode();
690 Q_ASSERT(node);
691
692- // Get or create the shape texture that's stored per context and shared by all the shape items.
693- Q_ASSERT(window());
694- QOpenGLContext* openglContext = window()->openglContext();
695- Q_ASSERT(openglContext);
696- int index = getShapeTexturesIndex(openglContext);
697- if (index < 0) {
698- index = getEmptyShapeTexturesIndex();
699- shapeTextures[index].openglContext = openglContext;
700- createShapeTextures(openglContext, index);
701- connect(openglContext, &QOpenGLContext::aboutToBeDestroyed, [index] {
702- shapeTextures[index].openglContext = NULL;
703- glDeleteTextures(shapeTextureCount, shapeTextures[index].textureId);
704- } );
705- }
706- const quint32 shapeTextureId = shapeTextures[index].textureId[m_aspect != DropShadow ? 0 : 1];
707-
708 // Get the source texture info and update the source transform if needed.
709 QSGTextureProvider* provider = m_source ? m_source->textureProvider() : NULL;
710 QSGTexture* sourceTexture = provider ? provider->texture() : NULL;
711@@ -1256,7 +1243,7 @@
712 / qGuiApp->devicePixelRatio();
713 }
714
715- updateMaterial(node, radius, shapeTextureId, sourceTexture && m_sourceOpacity);
716+ updateMaterial(node, radius, m_aspect != DropShadow ? 0 : 1, sourceTexture && m_sourceOpacity);
717
718 // Get the affine transformation for the source texture coordinates.
719 const QVector4D sourceCoordTransform(
720@@ -1312,12 +1299,12 @@
721 }
722
723 void UCUbuntuShape::updateMaterial(
724- QSGNode* node, float radius, quint32 shapeTextureId, bool textured)
725+ QSGNode* node, float radius, quint8 shapeTextureIndex, bool textured)
726 {
727 ShapeMaterial::Data* materialData = static_cast<ShapeNode*>(node)->material()->data();
728 quint8 flags = 0;
729
730- materialData->shapeTextureId = shapeTextureId;
731+ materialData->shapeTextureIndex = shapeTextureIndex;
732 if (textured) {
733 materialData->sourceTextureProvider = m_sourceTextureProvider;
734 materialData->sourceOpacity = m_sourceOpacity;
735@@ -1364,7 +1351,7 @@
736 const QVector4D& sourceCoordTransform, const QVector4D& sourceMaskTransform,
737 const quint32 backgroundColor[3])
738 {
739- // Used by subclasses, using the shapeTextureInfo.offset constant directly allows slightly
740+ // Used by subclasses, using the shapeTextureOffset constant directly allows slightly
741 // better optimization here.
742 Q_UNUSED(shapeOffset);
743
744
745=== modified file 'src/Ubuntu/Components/plugin/ucubuntushape.h'
746--- src/Ubuntu/Components/plugin/ucubuntushape.h 2016-04-28 11:19:46 +0000
747+++ src/Ubuntu/Components/plugin/ucubuntushape.h 2016-06-16 09:57:10 +0000
748@@ -23,6 +23,7 @@
749 #include <QtQuick/QSGNode>
750 #include <QtQuick/qsgmaterial.h>
751 #include <QtGui/QOpenGLFunctions>
752+#include "ucubuntushapetextures.h"
753 #include "ucimportversionchecker_p.h"
754
755 // --- Scene graph shader ---
756@@ -66,22 +67,25 @@
757 Pressed = (1 << 6)
758 };
759 QSGTextureProvider* sourceTextureProvider;
760- quint32 shapeTextureId;
761+ quint8 shapeTextureIndex;
762 quint8 distanceAAFactor;
763 quint8 sourceOpacity;
764 quint8 flags;
765 };
766
767 ShapeMaterial();
768+ ~ShapeMaterial();
769 QSGMaterialType* type() const override;
770 QSGMaterialShader* createShader() const override;
771 int compare(const QSGMaterial* other) const override;
772 virtual void updateTextures();
773 const Data* constData() const { return &m_data; }
774 Data* data() { return &m_data; }
775+ quint32* textureIds() { return m_shapeTexturesId; }
776
777 private:
778 Data m_data;
779+ quint32 m_shapeTexturesId[shapeTextureCount];
780 };
781
782 // --- Scene graph node ---
783@@ -293,7 +297,8 @@
784
785 // Virtual functions for extended shapes.
786 virtual QSGNode* createSceneGraphNode() const;
787- virtual void updateMaterial(QSGNode* node, float radius, quint32 shapeTextureId, bool textured);
788+ virtual void updateMaterial(
789+ QSGNode* node, float radius, quint8 shapeTextureIndex, bool textured);
790 virtual void updateGeometry(
791 QSGNode* node, const QSizeF& itemSize, float radius, float shapeOffset,
792 const QVector4D& sourceCoordTransform, const QVector4D& sourceMaskTransform,
793
794=== renamed file 'src/Ubuntu/Components/plugin/ucubuntushapetexture.h' => 'src/Ubuntu/Components/plugin/ucubuntushapetextures.cpp'
795--- src/Ubuntu/Components/plugin/ucubuntushapetexture.h 2015-10-12 17:20:30 +0000
796+++ src/Ubuntu/Components/plugin/ucubuntushapetextures.cpp 2016-06-16 09:57:10 +0000
797@@ -1,12 +1,9 @@
798 // Copyright 2015 Canonical Ltd.
799 // Automatically generated by the createshapetextures tool.
800
801-const int shapeTextureCount = 2;
802-const int shapeTextureWidth = 32;
803-const int shapeTextureHeight = 32;
804-const float shapeTextureOffset = 0.0625;
805-const int shapeTextureDistanceAA = 4;
806-static const unsigned char shapeTextureData[2][4097] = {
807+#include "ucubuntushapetextures.h"
808+
809+const unsigned char shapeTextureData[2][4097] = {
810 "\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00"
811 "\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00"
812 "\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x06\x00"
813@@ -522,13 +519,10 @@
814 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
815 };
816
817-const int shapeTextureMipmapWidth = 256;
818-const int shapeTextureMipmapHeight = 256;
819-const int shapeTextureMipmapCount = 9;
820-static const int shapeTextureMipmapOffset[9] = {
821+const int shapeTextureMipmapOffset[9] = {
822 0, 262144, 327680, 344064, 348160, 349184, 349440, 349504, 349520
823 };
824-static const unsigned char shapeTextureMipmapData[2][349525] = {
825+const unsigned char shapeTextureMipmapData[2][349525] = {
826 // Mipmap level 0.
827 "\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00"
828 "\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00"
829
830=== added file 'src/Ubuntu/Components/plugin/ucubuntushapetextures.h'
831--- src/Ubuntu/Components/plugin/ucubuntushapetextures.h 1970-01-01 00:00:00 +0000
832+++ src/Ubuntu/Components/plugin/ucubuntushapetextures.h 2016-06-16 09:57:10 +0000
833@@ -0,0 +1,17 @@
834+// Copyright 2015 Canonical Ltd.
835+// Automatically generated by the createshapetextures tool.
836+
837+const int shapeTextureCount = 2;
838+const int shapeTextureWidth = 32;
839+const int shapeTextureHeight = 32;
840+const float shapeTextureOffset = 0.0625;
841+const int shapeTextureDistanceAA = 4;
842+
843+extern const unsigned char shapeTextureData[2][4097];
844+
845+const int shapeTextureMipmapWidth = 256;
846+const int shapeTextureMipmapHeight = 256;
847+const int shapeTextureMipmapCount = 9;
848+
849+extern const int shapeTextureMipmapOffset[9];
850+extern const unsigned char shapeTextureMipmapData[2][349525];
851
852=== modified file 'tests/unit/add_qmlmakecheck.pri'
853--- tests/unit/add_qmlmakecheck.pri 2016-02-08 09:33:08 +0000
854+++ tests/unit/add_qmlmakecheck.pri 2016-06-16 09:57:10 +0000
855@@ -7,7 +7,7 @@
856 for(TEST, TESTS) {
857 _uitk_command = cd $$_PRO_FILE_PWD_;
858 _uitk_command += env UITK_TEST_KEEP_RUNNING=1
859- _uitk_command += '$${ROOT_SOURCE_DIR}/tests/unit/runtest.sh "$$shadowed($$_PRO_FILE_PWD_)/$${TARGET}" "$${TEST}" minimal';
860+ _uitk_command += '$${ROOT_SOURCE_DIR}/tests/unit/runtest.sh "$$shadowed($$_PRO_FILE_PWD_)/$${TARGET}" "$${_PRO_FILE_PWD_}/$${TEST}" minimal';
861
862 check.commands += $${_uitk_command}
863
864
865=== modified file 'tests/unit/add_qmlmakecheck_x11.pri'
866--- tests/unit/add_qmlmakecheck_x11.pri 2016-05-30 15:14:42 +0000
867+++ tests/unit/add_qmlmakecheck_x11.pri 2016-06-16 09:57:10 +0000
868@@ -10,7 +10,7 @@
869 for(TEST, TESTS) {
870 _uitk_command = cd $$_PRO_FILE_PWD_;
871 _uitk_command += env UITK_TEST_KEEP_RUNNING=1
872- _uitk_command += '$${ROOT_SOURCE_DIR}/tests/unit/runtest.sh "$$shadowed($$_PRO_FILE_PWD_)/$${TARGET}" "$${TEST}"';
873+ _uitk_command += '$${ROOT_SOURCE_DIR}/tests/unit/runtest.sh "$$shadowed($$_PRO_FILE_PWD_)/$${TARGET}" "$${_PRO_FILE_PWD_}/$${TEST}"';
874
875 check.commands += $${_uitk_command}
876
877
878=== modified file 'tests/unit/i18n/LocalizedApp/LocalizedApp.pro'
879--- tests/unit/i18n/LocalizedApp/LocalizedApp.pro 2016-05-31 09:02:35 +0000
880+++ tests/unit/i18n/LocalizedApp/LocalizedApp.pro 2016-06-16 09:57:10 +0000
881@@ -5,7 +5,6 @@
882 DOMAIN = localizedApp
883 mo.target = mo
884 mo.commands = set -e;
885-mo.commands += echo Generating localization;
886 mo.commands += msgfmt $$PWD/po/en_US.po -o $$PWD/$${DOMAIN}/share/locale/en/LC_MESSAGES/$${DOMAIN}.mo;
887 QMAKE_EXTRA_TARGETS += mo
888 PRE_TARGETDEPS += mo
889
890=== modified file 'tests/unit/i18n/RelativeTime/RelativeTime.pro'
891--- tests/unit/i18n/RelativeTime/RelativeTime.pro 2016-05-31 09:02:35 +0000
892+++ tests/unit/i18n/RelativeTime/RelativeTime.pro 2016-06-16 09:57:10 +0000
893@@ -5,7 +5,6 @@
894 DOMAIN = ubuntu-ui-toolkit
895 mo.target = mo
896 mo.commands = set -e;
897-mo.commands += echo Generating localization;
898 mo.commands += msgfmt $${PWD}/po/en_US.po -o $${PWD}/$${DOMAIN}/share/locale/en/LC_MESSAGES/$${DOMAIN}.mo;
899 QMAKE_EXTRA_TARGETS += mo
900 PRE_TARGETDEPS += mo
901
902=== modified file 'tests/unit/mainview/mainview.pro'
903--- tests/unit/mainview/mainview.pro 2016-05-31 09:02:35 +0000
904+++ tests/unit/mainview/mainview.pro 2016-06-16 09:57:10 +0000
905@@ -2,5 +2,3 @@
906
907 QT += gui
908 SOURCES += tst_mainview.cpp
909-
910-OTHER_FILES += $$system(ls tst_*.qml)
911
912=== modified file 'tests/unit/page/page.pro'
913--- tests/unit/page/page.pro 2016-05-31 09:02:35 +0000
914+++ tests/unit/page/page.pro 2016-06-16 09:57:10 +0000
915@@ -2,5 +2,3 @@
916
917 QT += gui
918 SOURCES += tst_page.cpp
919-
920-OTHER_FILES += $$system(ls tst_*.qml)
921
922=== added file 'tests/unit/performance/TextArea13Grid.qml'
923--- tests/unit/performance/TextArea13Grid.qml 1970-01-01 00:00:00 +0000
924+++ tests/unit/performance/TextArea13Grid.qml 2016-06-16 09:57:10 +0000
925@@ -0,0 +1,33 @@
926+/*
927+ * Copyright 2016 Canonical Ltd.
928+ *
929+ * This program is free software; you can redistribute it and/or modify
930+ * it under the terms of the GNU Lesser General Public License as published by
931+ * the Free Software Foundation; version 3.
932+ *
933+ * This program is distributed in the hope that it will be useful,
934+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
935+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
936+ * GNU Lesser General Public License for more details.
937+ *
938+ * You should have received a copy of the GNU Lesser General Public License
939+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
940+ */
941+
942+import QtQuick 2.0
943+import Ubuntu.Components 1.3
944+
945+Grid {
946+ width: units.gu(80)
947+ height: units.gu(60)
948+ rows: 16
949+ columns: 16
950+
951+ Repeater {
952+ model: 16 * 16
953+
954+ TextField {
955+ text: i18n.tr("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.")
956+ }
957+ }
958+}
959
960=== modified file 'tests/unit/performance/tst_performance.cpp'
961--- tests/unit/performance/tst_performance.cpp 2015-12-07 22:16:52 +0000
962+++ tests/unit/performance/tst_performance.cpp 2016-06-16 09:57:10 +0000
963@@ -102,6 +102,7 @@
964 QTest::addColumn<QString>("document");
965 QTest::addColumn<QUrl>("theme");
966
967+ QTest::newRow("TextArea 1.3") << "TextArea13Grid.qml" << QUrl();
968 QTest::newRow("AbstractButton 1.2") << "AbstractButtonGrid.qml" << QUrl();
969 QTest::newRow("AbstractButton 1.3") << "AbstractButton13Grid.qml" << QUrl();
970 QTest::newRow("grid with Rectangle") << "RectangleGrid.qml" << QUrl();
971
972=== modified file 'tests/unit/runtest.sh'
973--- tests/unit/runtest.sh 2016-06-01 09:48:44 +0000
974+++ tests/unit/runtest.sh 2016-06-16 09:57:10 +0000
975@@ -43,14 +43,14 @@
976 echo " $0 TEST_EXECUTABLE [QML_FILE] [QT_QPA_PLATFORM]"
977 echo ''
978 echo 'Examples:'
979- echo " $0 $(relpath ${BUILD_DIR}/tests/unit/components/components) tst_label13.qml minimal"
980+ echo " $0 $(relpath ${BUILD_DIR}/tests/unit/components/components) $(relpath ${SRC_DIR}/tests/unit/components/tst_label13.qml) minimal"
981 echo ''
982 echo " cd $(relpath ${BUILD_DIR}/tests/unit/mainview)"
983 echo " ../$(basename $0) mainview minimal"
984 echo " cd ../../.."
985 echo ''
986 echo " cd $(relpath ${BUILD_DIR}/tests/unit/visual)"
987- echo " ../../xvfb.sh ../../unit/$(basename $0) visual tst_listitem13.qml"
988+ echo " ../../xvfb.sh ../../unit/$(basename $0) visual ../../unit/visual/tst_listitem13.qml"
989 echo " cd ../../.."
990 echo ''
991 echo " $(relpath ${BUILD_DIR}/tests/xvfb.sh) $0 $(relpath ${BUILD_DIR}/tests/unit/bottomedge/bottomedge)"
992@@ -74,20 +74,26 @@
993 EOF
994 }
995
996+function abspath {
997+ if [[ "$1" = /* ]]; then
998+ ABSPATH=$1
999+ else
1000+ ABSPATH=./$1
1001+ fi
1002+ # Note: '|| echo' so we get a sane error message if it doesn't exist
1003+ echo -n $(readlink -f $ABSPATH || echo $ABSPATH)
1004+}
1005+
1006 function create_test_cmd {
1007- if [[ "$_TARGETPATH" = /* ]]; then
1008- EXE=$_TARGETPATH
1009- else
1010- EXE=./$_TARGETPATH
1011- fi
1012+ EXE=$(abspath $_TARGETPATH)
1013 _CMD="-n $_TESTFILE -m 500"
1014
1015 DEB_HOST_ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)
1016 if [[ ${DEB_HOST_ARCH} =~ 'arm' ]]; then
1017- _CMD="dbus-test-runner --task $(readlink -f $EXE) $_CMD"
1018+ _CMD="dbus-test-runner --task $EXE $_CMD"
1019 else
1020 _CMD="dbus-test-runner --task gdb -p --quiet $_CMD"
1021- _CMD="$_CMD -p --batch -p -ex -p 'set print thread-events off' -p -ex -p run -p -ex -p bt -p --return-child-result -p --args -p $(readlink -f $EXE)"
1022+ _CMD="$_CMD -p --batch -p -ex -p 'set print thread-events off' -p -ex -p run -p -ex -p bt -p --return-child-result -p --args -p $EXE"
1023 fi
1024
1025 if [[ 'minimal custom' == *$_MINIMAL* ]]; then
1026@@ -95,27 +101,26 @@
1027 fi
1028
1029 if [[ $_TESTFILEPATH == *\.qml* ]]; then
1030- _CMD="$_CMD -p -input -p $_TESTFILEPATH"
1031+ _CMD="$_CMD -p -input -p $(abspath $_TESTFILEPATH)"
1032 fi
1033 _CMD="$_CMD -p -maxwarnings -p 100"
1034 }
1035
1036 function execute_test_cmd {
1037 echo "Executing $_CMD $_ARGS"
1038- echo "Working directory: $PWD"
1039 if [ ! -x $_TARGETPATH ]; then
1040 echo "Error: $_TARGET wasn't built!"
1041 RESULT=2
1042 elif [ $DISPLAY ]; then
1043- cd $(dirname $_TARGETPATH)
1044+ SRC_TARGETPATH=$(echo $EXE | sed "s@$BUILD_DIR@$SRC_DIR@")
1045+ cd $(dirname $SRC_TARGETPATH)
1046
1047 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999
1048 # https://bugreports.qt-project.org/browse/QTBUG-36243
1049-
1050 # QV4_MM_AGGRESSIVE_GC=1 \
1051 ALARM_BACKEND=memory SUPPRESS_DEPRECATED_NOTE=no \
1052 QT_LOGGING_RULES="[PERFORMANCE].warning=false" \
1053- $_CMD $_ARGS 2>&1 | grep -v 'QFontDatabase: Cannot find font directory'
1054+ $_CMD $_ARGS 2>&1 | sed "s@$_TESTFILE: @@" | grep -v 'QFontDatabase: Cannot find font directory'
1055 if [ ! -s $_XML ]; then
1056 # Write fallback in case it crashed and the file is empty
1057 if [[ $_XML == *".SEGFAULT"* ]]; then
1058@@ -125,7 +130,7 @@
1059 fi
1060 fi
1061 if [ "x$UITK_TEST_KEEP_RUNNING" != "x1" ]; then
1062- ${BUILD_DIR}/tests/checkresults.sh $_XML
1063+ ${SRC_DIR}/tests/checkresults.sh $_XML
1064 RESULT=$?
1065 fi
1066 else
1067
1068=== added file 'tests/unit/visual/gallery.qml'
1069--- tests/unit/visual/gallery.qml 1970-01-01 00:00:00 +0000
1070+++ tests/unit/visual/gallery.qml 2016-06-16 09:57:10 +0000
1071@@ -0,0 +1,78 @@
1072+/*
1073+ * Copyright 2016 Canonical Ltd.
1074+ *
1075+ * This program is free software; you can redistribute it and/or modify
1076+ * it under the terms of the GNU Lesser General Public License as published by
1077+ * the Free Software Foundation; version 3.
1078+ *
1079+ * This program is distributed in the hope that it will be useful,
1080+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1081+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1082+ * GNU Lesser General Public License for more details.
1083+ *
1084+ * You should have received a copy of the GNU Lesser General Public License
1085+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1086+ */
1087+
1088+import QtQuick 2.4
1089+import Ubuntu.Components 1.3
1090+import Qt.labs.folderlistmodel 2.1
1091+
1092+MainView {
1093+ width: units.gu(120)
1094+ height: units.gu(75)
1095+
1096+ AdaptivePageLayout {
1097+ id: pageLayout
1098+ anchors.fill: parent
1099+ primaryPage: Page {
1100+ header: PageHeader {
1101+ flickable: testsListView
1102+ title: 'Unit Tests'
1103+ }
1104+
1105+ UbuntuListView {
1106+ id: testsListView
1107+ anchors.fill: parent
1108+ model: FolderListModel {
1109+ Component.onCompleted: folder += '/tests/unit/visual'
1110+ showDirs: false
1111+ showOnlyReadable: true
1112+ sortField: FolderListModel.Name
1113+ nameFilters: [ "tst_*13.qml" ]
1114+ }
1115+
1116+ delegate: ListItem {
1117+ height: listItemLayout.height
1118+ ListItemLayout {
1119+ id: listItemLayout
1120+ title.text: fileBaseName
1121+ ProgressionSlot {}
1122+ }
1123+ onClicked: {
1124+ testsListView.currentIndex = index
1125+ pageLayout.addPageToNextColumn(pageLayout.primaryPage, testPage, { source: fileURL, title: fileBaseName })
1126+ }
1127+ }
1128+ }
1129+ }
1130+ asynchronous: false
1131+
1132+ Page {
1133+ id: testPage
1134+ property alias source: testLoader.source
1135+ header: PageHeader {
1136+ id: testPageHeader
1137+ title: testPage.title
1138+ }
1139+
1140+ Loader {
1141+ id: testLoader
1142+ anchors.fill: parent
1143+ anchors.topMargin: testPage.header.height
1144+ asynchronous: false
1145+ }
1146+ }
1147+ }
1148+}
1149+
1150
1151=== added file 'tests/unit/visual/gallery.sh'
1152--- tests/unit/visual/gallery.sh 1970-01-01 00:00:00 +0000
1153+++ tests/unit/visual/gallery.sh 2016-06-16 09:57:10 +0000
1154@@ -0,0 +1,6 @@
1155+#!/bin/bash
1156+
1157+. `dirname ${BASH_SOURCE[0]}`/../../../export_qml_dir.sh || exit 1
1158+
1159+SCRIPT_DIRECTORY=`dirname $0`
1160+$BUILD_DIR/ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher $@ $SCRIPT_DIRECTORY/gallery.qml
1161
1162=== modified file 'tests/unit/visual/tst_pageheader.qml'
1163--- tests/unit/visual/tst_pageheader.qml 2016-03-30 15:12:36 +0000
1164+++ tests/unit/visual/tst_pageheader.qml 2016-06-16 09:57:10 +0000
1165@@ -238,7 +238,8 @@
1166
1167 Switch {
1168 id: subtitleSwitch
1169- checked: false
1170+ // Subtitle enabled initially as a regression test for bug #1588837.
1171+ checked: true
1172 }
1173 Label {
1174 text: "subtitle"
1175
1176=== modified file 'tests/unit/visual/tst_picker13.qml'
1177--- tests/unit/visual/tst_picker13.qml 2016-03-15 13:26:55 +0000
1178+++ tests/unit/visual/tst_picker13.qml 2016-06-16 09:57:10 +0000
1179@@ -100,6 +100,7 @@
1180 Loader {
1181 id: pickerLoader
1182 asynchronous: false
1183+ sourceComponent: defaultPicker
1184 }
1185
1186 ListModel {
1187
1188=== modified file 'tests/unit/visual/tst_popups_dialog13.qml'
1189--- tests/unit/visual/tst_popups_dialog13.qml 2016-03-15 13:26:55 +0000
1190+++ tests/unit/visual/tst_popups_dialog13.qml 2016-06-16 09:57:10 +0000
1191@@ -26,6 +26,13 @@
1192 width: units.gu(40)
1193 height: units.gu(71)
1194
1195+ Button {
1196+ id: pressMe
1197+ anchors.top: parent.top
1198+ text: "Open Dialog"
1199+ onClicked: PopupUtils.open(dialog)
1200+ }
1201+
1202 UbuntuTestCase {
1203 id: test
1204 name: "Popups.Dialog"
1205@@ -45,7 +52,13 @@
1206 Component {
1207 id: dialog
1208 Dialog {
1209+ id: ahojDialog
1210 title: "Ahoj"
1211+
1212+ Button {
1213+ text: "Close"
1214+ onClicked: PopupUtils.close(ahojDialog)
1215+ }
1216 }
1217 }
1218 }
1219
1220=== modified file 'tests/xvfb.sh'
1221--- tests/xvfb.sh 2013-12-19 14:46:25 +0000
1222+++ tests/xvfb.sh 2016-06-16 09:57:10 +0000
1223@@ -1,4 +1,4 @@
1224-#!/bin/sh
1225+#!/bin/bash
1226 #
1227 # Copyright 2013 Canonical Ltd.
1228 #
1229@@ -16,15 +16,18 @@
1230 #
1231 # Author: Christian Dywan <christian.dywan@canonical.com>
1232
1233+. `dirname ${BASH_SOURCE[0]}`/../export_qml_dir.sh || exit 1
1234+
1235+LOG=$BUILD_DIR/xvfb.err
1236 echo Running $@ in virtual frame buffer...
1237-xvfb-run -a -s "-screen 0 1280x1024x24" -e xvfb.err "$@" 2>test.err
1238+xvfb-run -a -s "-screen 0 1280x1024x24" -e $LOG "$@" 2>$LOG
1239 RETVAL=$?
1240 if [ $RETVAL -eq 0 ]; then
1241 echo $@ finished successfully...
1242 else
1243 echo $@ in virtual frame buffer failed...
1244- cat test.err >&2
1245+ cat $LOG >&2
1246 echo Tail of xvfb-run output:
1247- tail xvfb.err >&2
1248+ tail $LOG >&2
1249 exit $RETVAL
1250 fi

Subscribers

People subscribed via source and target branches

to status/vote changes: