Merge lp:~zsombi/ubuntu-ui-toolkit/optimize-import into lp:ubuntu-ui-toolkit

Proposed by Zsombor Egri
Status: Merged
Approved by: Florian Boucault
Approved revision: 502
Merged at revision: 501
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/optimize-import
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 293 lines (+132/-25)
11 files modified
modules/Ubuntu/Components/PageWrapperUtils.js (+3/-2)
modules/Ubuntu/Components/Popups/Popover.qml (+1/-1)
modules/Ubuntu/Components/Popups/internalPopupUtils.js (+5/-3)
modules/Ubuntu/Components/scrollbarUtils.js (+2/-0)
modules/Ubuntu/Components/stack.js (+1/-0)
tests/unit/tst_performance/TextWithImport.qml (+21/-0)
tests/unit/tst_performance/TextWithImportGrid.qml (+28/-0)
tests/unit/tst_performance/TextWithImportPopups.qml (+20/-0)
tests/unit/tst_performance/TextWithImportPopupsGrid.qml (+28/-0)
tests/unit/tst_performance/tst_performance.cpp (+18/-18)
tests/unit/tst_performance/tst_performance.pro (+5/-1)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/optimize-import
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Florian Boucault Pending
Review via email: mp+164348@code.launchpad.net

Commit message

[theming] Changing stateful libraries to stateless to decrease time spent each time Ubuntu.Components module is imported.

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

failed test case on deprecated module

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
501. By Zsombor Egri

trunk merge

502. By Zsombor Egri

componentUtils.js reverted to stateful library as will be removed due to deprecation

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/PageWrapperUtils.js'
2--- modules/Ubuntu/Components/PageWrapperUtils.js 2013-03-08 10:51:17 +0000
3+++ modules/Ubuntu/Components/PageWrapperUtils.js 2013-05-20 05:07:27 +0000
4@@ -14,7 +14,7 @@
5 * along with this program. If not, see <http://www.gnu.org/licenses/>.
6 */
7
8-//.pragma library // FIXME: cannot refer to Component.Error if I use this.
9+.pragma library // FIXME: cannot refer to Component.Error if I use this.
10
11 /*!
12 \internal
13@@ -34,7 +34,8 @@
14
15 var pageObject;
16 if (pageComponent) {
17- if (pageComponent.status === Component.Error) {
18+ // FIXME: Component.Error is the last in the enum, number 3
19+ if (pageComponent.status === 3) {
20 throw new Error("Error while loading page: " + pageComponent.errorString());
21 } else {
22 // create the object
23
24=== modified file 'modules/Ubuntu/Components/Popups/Popover.qml'
25--- modules/Ubuntu/Components/Popups/Popover.qml 2013-05-09 15:05:55 +0000
26+++ modules/Ubuntu/Components/Popups/Popover.qml 2013-05-20 05:07:27 +0000
27@@ -152,7 +152,7 @@
28
29 // private
30 function updatePosition() {
31- var pos = new InternalPopupUtils.CallerPositioning(foreground, pointer, dismissArea, caller, pointerTarget, edgeMargins, callerMargin);
32+ var pos = new InternalPopupUtils.CallerPositioning(foreground, pointer, dismissArea, caller, pointerTarget, edgeMargins, callerMargin, units.dp(2));
33 pos.auto();
34 }
35 }
36
37=== modified file 'modules/Ubuntu/Components/Popups/internalPopupUtils.js'
38--- modules/Ubuntu/Components/Popups/internalPopupUtils.js 2013-02-21 15:29:49 +0000
39+++ modules/Ubuntu/Components/Popups/internalPopupUtils.js 2013-05-20 05:07:27 +0000
40@@ -14,6 +14,8 @@
41 * along with this program. If not, see <http://www.gnu.org/licenses/>.
42 */
43
44+.pragma library
45+
46 .import "../mathUtils.js" as MathUtils
47
48 // Simple positioning on the screen, not relative to a caller Item.
49@@ -69,7 +71,7 @@
50 }
51
52 // automatically position foreground on the screen
53- this.auto = function() {
54+ this.auto = function(margin) {
55 if (foreground.width >= area.width - 2*edgeMargins) {
56 // the popover uses (almost) the full width of the screen
57 this.autoSmallScreenPortrait();
58@@ -86,7 +88,7 @@
59
60 // caller is optional.
61 // if caller is given, pointer and callerMargins must be specified, otherwise they are ignored.
62-function CallerPositioning(foreground, pointer, area, caller, pointerTarget, edgeMargins, callerMargins) {
63+function CallerPositioning(foreground, pointer, area, caller, pointerTarget, edgeMargins, callerMargins, pointerMargin) {
64 var simplePos = new SimplePositioning(foreground, area, edgeMargins);
65 // -1 values are not relevant.
66
67@@ -187,7 +189,7 @@
68 foreground.y = coord;
69 foreground.x = this.horizontalAlign(foreground, caller);
70 pointer.direction = "down";
71- pointer.y = this.above(pointer, callerMargins - pointer.height, caller) - units.dp(2);
72+ pointer.y = this.above(pointer, callerMargins - pointer.height, caller) - pointerMargin;
73 pointer.x = this.horizontalAlign(pointer, pointerTarget);
74 return true;
75 }
76
77=== modified file 'modules/Ubuntu/Components/scrollbarUtils.js'
78--- modules/Ubuntu/Components/scrollbarUtils.js 2013-01-09 13:58:22 +0000
79+++ modules/Ubuntu/Components/scrollbarUtils.js 2013-05-20 05:07:27 +0000
80@@ -14,6 +14,8 @@
81 * along with this program. If not, see <http://www.gnu.org/licenses/>.
82 */
83
84+.pragma library
85+
86 Qt.include("mathUtils.js")
87
88 /*!
89
90=== modified file 'modules/Ubuntu/Components/stack.js'
91--- modules/Ubuntu/Components/stack.js 2012-10-10 15:13:44 +0000
92+++ modules/Ubuntu/Components/stack.js 2013-05-20 05:07:27 +0000
93@@ -14,6 +14,7 @@
94 * along with this program. If not, see <http://www.gnu.org/licenses/>.
95 */
96
97+.pragma library
98 // By defining Stack as a function, we can make its variables private,
99 // and force calls to Stack to make use of the functions we define.
100 function Stack() {
101
102=== added file 'tests/unit/tst_performance/TextWithImport.qml'
103--- tests/unit/tst_performance/TextWithImport.qml 1970-01-01 00:00:00 +0000
104+++ tests/unit/tst_performance/TextWithImport.qml 2013-05-20 05:07:27 +0000
105@@ -0,0 +1,21 @@
106+/*
107+ * Copyright 2012 Canonical Ltd.
108+ *
109+ * This program is free software; you can redistribute it and/or modify
110+ * it under the terms of the GNU Lesser General Public License as published by
111+ * the Free Software Foundation; version 3.
112+ *
113+ * This program is distributed in the hope that it will be useful,
114+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
115+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
116+ * GNU Lesser General Public License for more details.
117+ *
118+ * You should have received a copy of the GNU Lesser General Public License
119+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
120+ */
121+
122+import QtQuick 2.0
123+import Ubuntu.Components 0.1
124+
125+Text {
126+}
127
128=== added file 'tests/unit/tst_performance/TextWithImportGrid.qml'
129--- tests/unit/tst_performance/TextWithImportGrid.qml 1970-01-01 00:00:00 +0000
130+++ tests/unit/tst_performance/TextWithImportGrid.qml 2013-05-20 05:07:27 +0000
131@@ -0,0 +1,28 @@
132+/*
133+ * Copyright 2012 Canonical Ltd.
134+ *
135+ * This program is free software; you can redistribute it and/or modify
136+ * it under the terms of the GNU Lesser General Public License as published by
137+ * the Free Software Foundation; version 3.
138+ *
139+ * This program is distributed in the hope that it will be useful,
140+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
141+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
142+ * GNU Lesser General Public License for more details.
143+ *
144+ * You should have received a copy of the GNU Lesser General Public License
145+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
146+ */
147+
148+import QtQuick 2.0
149+
150+Grid {
151+ width: 800
152+ height: 600
153+ rows: 16
154+ columns: 160
155+ Repeater {
156+ model: 16*160
157+ TextWithImport {}
158+ }
159+}
160
161=== added file 'tests/unit/tst_performance/TextWithImportPopups.qml'
162--- tests/unit/tst_performance/TextWithImportPopups.qml 1970-01-01 00:00:00 +0000
163+++ tests/unit/tst_performance/TextWithImportPopups.qml 2013-05-20 05:07:27 +0000
164@@ -0,0 +1,20 @@
165+/*
166+ * Copyright 2012 Canonical Ltd.
167+ *
168+ * This program is free software; you can redistribute it and/or modify
169+ * it under the terms of the GNU Lesser General Public License as published by
170+ * the Free Software Foundation; version 3.
171+ *
172+ * This program is distributed in the hope that it will be useful,
173+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
174+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
175+ * GNU Lesser General Public License for more details.
176+ *
177+ * You should have received a copy of the GNU Lesser General Public License
178+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
179+ */
180+import QtQuick 2.0
181+import Ubuntu.Components.Popups 0.1
182+
183+Text {
184+}
185
186=== added file 'tests/unit/tst_performance/TextWithImportPopupsGrid.qml'
187--- tests/unit/tst_performance/TextWithImportPopupsGrid.qml 1970-01-01 00:00:00 +0000
188+++ tests/unit/tst_performance/TextWithImportPopupsGrid.qml 2013-05-20 05:07:27 +0000
189@@ -0,0 +1,28 @@
190+/*
191+ * Copyright 2012 Canonical Ltd.
192+ *
193+ * This program is free software; you can redistribute it and/or modify
194+ * it under the terms of the GNU Lesser General Public License as published by
195+ * the Free Software Foundation; version 3.
196+ *
197+ * This program is distributed in the hope that it will be useful,
198+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
199+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
200+ * GNU Lesser General Public License for more details.
201+ *
202+ * You should have received a copy of the GNU Lesser General Public License
203+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
204+ */
205+
206+import QtQuick 2.0
207+
208+Grid {
209+ width: 800
210+ height: 600
211+ rows: 16
212+ columns: 160
213+ Repeater {
214+ model: 16*160
215+ TextWithImportPopups {}
216+ }
217+}
218
219=== modified file 'tests/unit/tst_performance/tst_performance.cpp'
220--- tests/unit/tst_performance/tst_performance.cpp 2013-04-25 11:54:28 +0000
221+++ tests/unit/tst_performance/tst_performance.cpp 2013-05-20 05:07:27 +0000
222@@ -46,18 +46,6 @@
223 return quickView->rootObject();
224 }
225
226- QQuickItem *loadTest(const QString &document, const QUrl &theme = QUrl())
227- {
228- ThemeEngine::initializeEngine(quickEngine);
229- ThemeEngine::instance()->loadTheme(theme);
230- if (!ThemeEngine::instance()->error().isEmpty()) {
231- QWARN("Theme loading failed");
232- return 0;
233- }
234- return loadDocument(document);
235- }
236-
237-
238 private Q_SLOTS:
239
240 void initTestCase()
241@@ -74,13 +62,9 @@
242 quickView->setGeometry(0,0, 240, 320);
243 //add modules folder so we have access to the plugin from QML
244 QStringList imports = quickEngine->importPathList();
245- imports << QDir(modules).absolutePath() << QDir(themes).absolutePath();
246+ imports.prepend(QDir(modules).absolutePath());
247+ imports.prepend(QDir(themes).absolutePath());
248 quickEngine->setImportPathList(imports);
249-
250- bool result = (ThemeEngine::initializeEngine(quickEngine) != 0);
251- QVERIFY(result);
252- // check if theme gets loaded
253- QCOMPARE(ThemeEngine::instance()->error(), QString(""));
254 }
255
256 void cleanupTestCase()
257@@ -126,6 +110,22 @@
258 delete root;
259 }
260
261+ void benchmark_import_data()
262+ {
263+ QTest::addColumn<QString>("document");
264+
265+ QTest::newRow("importing Ubuntu.Components") << "TextWithImportGrid.qml";
266+ QTest::newRow("importing Ubuntu.Components.Popups") << "TextWithImportGrid.qml";
267+ }
268+
269+ void benchmark_import()
270+ {
271+ QFETCH(QString, document);
272+ QBENCHMARK {
273+ loadDocument(document);
274+ }
275+ }
276+
277 };
278
279 QTEST_MAIN(tst_Performance)
280
281=== modified file 'tests/unit/tst_performance/tst_performance.pro'
282--- tests/unit/tst_performance/tst_performance.pro 2013-04-25 05:48:03 +0000
283+++ tests/unit/tst_performance/tst_performance.pro 2013-05-20 05:07:27 +0000
284@@ -17,4 +17,8 @@
285 TextGrid.qml \
286 RectangleGrid.qml \
287 CustomTheme.qmltheme \
288- ButtonsWithStyledGrid.qml
289+ ButtonsWithStyledGrid.qml \
290+ TextWithImport.qml \
291+ TextWithImportGrid.qml \
292+ TextWithImportPopupsGrid.qml \
293+ TextWithImportPopups.qml

Subscribers

People subscribed via source and target branches

to status/vote changes: