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
=== modified file 'modules/Ubuntu/Components/PageWrapperUtils.js'
--- modules/Ubuntu/Components/PageWrapperUtils.js 2013-03-08 10:51:17 +0000
+++ modules/Ubuntu/Components/PageWrapperUtils.js 2013-05-20 05:07:27 +0000
@@ -14,7 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17//.pragma library // FIXME: cannot refer to Component.Error if I use this.17.pragma library // FIXME: cannot refer to Component.Error if I use this.
1818
19/*!19/*!
20 \internal20 \internal
@@ -34,7 +34,8 @@
3434
35 var pageObject;35 var pageObject;
36 if (pageComponent) {36 if (pageComponent) {
37 if (pageComponent.status === Component.Error) {37 // FIXME: Component.Error is the last in the enum, number 3
38 if (pageComponent.status === 3) {
38 throw new Error("Error while loading page: " + pageComponent.errorString());39 throw new Error("Error while loading page: " + pageComponent.errorString());
39 } else {40 } else {
40 // create the object41 // create the object
4142
=== modified file 'modules/Ubuntu/Components/Popups/Popover.qml'
--- modules/Ubuntu/Components/Popups/Popover.qml 2013-05-09 15:05:55 +0000
+++ modules/Ubuntu/Components/Popups/Popover.qml 2013-05-20 05:07:27 +0000
@@ -152,7 +152,7 @@
152152
153 // private153 // private
154 function updatePosition() {154 function updatePosition() {
155 var pos = new InternalPopupUtils.CallerPositioning(foreground, pointer, dismissArea, caller, pointerTarget, edgeMargins, callerMargin);155 var pos = new InternalPopupUtils.CallerPositioning(foreground, pointer, dismissArea, caller, pointerTarget, edgeMargins, callerMargin, units.dp(2));
156 pos.auto();156 pos.auto();
157 }157 }
158 }158 }
159159
=== modified file 'modules/Ubuntu/Components/Popups/internalPopupUtils.js'
--- modules/Ubuntu/Components/Popups/internalPopupUtils.js 2013-02-21 15:29:49 +0000
+++ modules/Ubuntu/Components/Popups/internalPopupUtils.js 2013-05-20 05:07:27 +0000
@@ -14,6 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17.pragma library
18
17.import "../mathUtils.js" as MathUtils19.import "../mathUtils.js" as MathUtils
1820
19// Simple positioning on the screen, not relative to a caller Item.21// Simple positioning on the screen, not relative to a caller Item.
@@ -69,7 +71,7 @@
69 }71 }
7072
71 // automatically position foreground on the screen73 // automatically position foreground on the screen
72 this.auto = function() {74 this.auto = function(margin) {
73 if (foreground.width >= area.width - 2*edgeMargins) {75 if (foreground.width >= area.width - 2*edgeMargins) {
74 // the popover uses (almost) the full width of the screen76 // the popover uses (almost) the full width of the screen
75 this.autoSmallScreenPortrait();77 this.autoSmallScreenPortrait();
@@ -86,7 +88,7 @@
8688
87// caller is optional.89// caller is optional.
88// if caller is given, pointer and callerMargins must be specified, otherwise they are ignored.90// if caller is given, pointer and callerMargins must be specified, otherwise they are ignored.
89function CallerPositioning(foreground, pointer, area, caller, pointerTarget, edgeMargins, callerMargins) {91function CallerPositioning(foreground, pointer, area, caller, pointerTarget, edgeMargins, callerMargins, pointerMargin) {
90 var simplePos = new SimplePositioning(foreground, area, edgeMargins);92 var simplePos = new SimplePositioning(foreground, area, edgeMargins);
91 // -1 values are not relevant.93 // -1 values are not relevant.
9294
@@ -187,7 +189,7 @@
187 foreground.y = coord;189 foreground.y = coord;
188 foreground.x = this.horizontalAlign(foreground, caller);190 foreground.x = this.horizontalAlign(foreground, caller);
189 pointer.direction = "down";191 pointer.direction = "down";
190 pointer.y = this.above(pointer, callerMargins - pointer.height, caller) - units.dp(2);192 pointer.y = this.above(pointer, callerMargins - pointer.height, caller) - pointerMargin;
191 pointer.x = this.horizontalAlign(pointer, pointerTarget);193 pointer.x = this.horizontalAlign(pointer, pointerTarget);
192 return true;194 return true;
193 }195 }
194196
=== modified file 'modules/Ubuntu/Components/scrollbarUtils.js'
--- modules/Ubuntu/Components/scrollbarUtils.js 2013-01-09 13:58:22 +0000
+++ modules/Ubuntu/Components/scrollbarUtils.js 2013-05-20 05:07:27 +0000
@@ -14,6 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17.pragma library
18
17Qt.include("mathUtils.js")19Qt.include("mathUtils.js")
1820
19/*!21/*!
2022
=== modified file 'modules/Ubuntu/Components/stack.js'
--- modules/Ubuntu/Components/stack.js 2012-10-10 15:13:44 +0000
+++ modules/Ubuntu/Components/stack.js 2013-05-20 05:07:27 +0000
@@ -14,6 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17.pragma library
17// By defining Stack as a function, we can make its variables private,18// By defining Stack as a function, we can make its variables private,
18// and force calls to Stack to make use of the functions we define.19// and force calls to Stack to make use of the functions we define.
19function Stack() {20function Stack() {
2021
=== added file 'tests/unit/tst_performance/TextWithImport.qml'
--- tests/unit/tst_performance/TextWithImport.qml 1970-01-01 00:00:00 +0000
+++ tests/unit/tst_performance/TextWithImport.qml 2013-05-20 05:07:27 +0000
@@ -0,0 +1,21 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20Text {
21}
022
=== added file 'tests/unit/tst_performance/TextWithImportGrid.qml'
--- tests/unit/tst_performance/TextWithImportGrid.qml 1970-01-01 00:00:00 +0000
+++ tests/unit/tst_performance/TextWithImportGrid.qml 2013-05-20 05:07:27 +0000
@@ -0,0 +1,28 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19Grid {
20 width: 800
21 height: 600
22 rows: 16
23 columns: 160
24 Repeater {
25 model: 16*160
26 TextWithImport {}
27 }
28}
029
=== added file 'tests/unit/tst_performance/TextWithImportPopups.qml'
--- tests/unit/tst_performance/TextWithImportPopups.qml 1970-01-01 00:00:00 +0000
+++ tests/unit/tst_performance/TextWithImportPopups.qml 2013-05-20 05:07:27 +0000
@@ -0,0 +1,20 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16import QtQuick 2.0
17import Ubuntu.Components.Popups 0.1
18
19Text {
20}
021
=== added file 'tests/unit/tst_performance/TextWithImportPopupsGrid.qml'
--- tests/unit/tst_performance/TextWithImportPopupsGrid.qml 1970-01-01 00:00:00 +0000
+++ tests/unit/tst_performance/TextWithImportPopupsGrid.qml 2013-05-20 05:07:27 +0000
@@ -0,0 +1,28 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19Grid {
20 width: 800
21 height: 600
22 rows: 16
23 columns: 160
24 Repeater {
25 model: 16*160
26 TextWithImportPopups {}
27 }
28}
029
=== modified file 'tests/unit/tst_performance/tst_performance.cpp'
--- tests/unit/tst_performance/tst_performance.cpp 2013-04-25 11:54:28 +0000
+++ tests/unit/tst_performance/tst_performance.cpp 2013-05-20 05:07:27 +0000
@@ -46,18 +46,6 @@
46 return quickView->rootObject();46 return quickView->rootObject();
47 }47 }
4848
49 QQuickItem *loadTest(const QString &document, const QUrl &theme = QUrl())
50 {
51 ThemeEngine::initializeEngine(quickEngine);
52 ThemeEngine::instance()->loadTheme(theme);
53 if (!ThemeEngine::instance()->error().isEmpty()) {
54 QWARN("Theme loading failed");
55 return 0;
56 }
57 return loadDocument(document);
58 }
59
60
61private Q_SLOTS:49private Q_SLOTS:
6250
63 void initTestCase()51 void initTestCase()
@@ -74,13 +62,9 @@
74 quickView->setGeometry(0,0, 240, 320);62 quickView->setGeometry(0,0, 240, 320);
75 //add modules folder so we have access to the plugin from QML63 //add modules folder so we have access to the plugin from QML
76 QStringList imports = quickEngine->importPathList();64 QStringList imports = quickEngine->importPathList();
77 imports << QDir(modules).absolutePath() << QDir(themes).absolutePath();65 imports.prepend(QDir(modules).absolutePath());
66 imports.prepend(QDir(themes).absolutePath());
78 quickEngine->setImportPathList(imports);67 quickEngine->setImportPathList(imports);
79
80 bool result = (ThemeEngine::initializeEngine(quickEngine) != 0);
81 QVERIFY(result);
82 // check if theme gets loaded
83 QCOMPARE(ThemeEngine::instance()->error(), QString(""));
84 }68 }
8569
86 void cleanupTestCase()70 void cleanupTestCase()
@@ -126,6 +110,22 @@
126 delete root;110 delete root;
127 }111 }
128112
113 void benchmark_import_data()
114 {
115 QTest::addColumn<QString>("document");
116
117 QTest::newRow("importing Ubuntu.Components") << "TextWithImportGrid.qml";
118 QTest::newRow("importing Ubuntu.Components.Popups") << "TextWithImportGrid.qml";
119 }
120
121 void benchmark_import()
122 {
123 QFETCH(QString, document);
124 QBENCHMARK {
125 loadDocument(document);
126 }
127 }
128
129};129};
130130
131QTEST_MAIN(tst_Performance)131QTEST_MAIN(tst_Performance)
132132
=== modified file 'tests/unit/tst_performance/tst_performance.pro'
--- tests/unit/tst_performance/tst_performance.pro 2013-04-25 05:48:03 +0000
+++ tests/unit/tst_performance/tst_performance.pro 2013-05-20 05:07:27 +0000
@@ -17,4 +17,8 @@
17 TextGrid.qml \17 TextGrid.qml \
18 RectangleGrid.qml \18 RectangleGrid.qml \
19 CustomTheme.qmltheme \19 CustomTheme.qmltheme \
20 ButtonsWithStyledGrid.qml20 ButtonsWithStyledGrid.qml \
21 TextWithImport.qml \
22 TextWithImportGrid.qml \
23 TextWithImportPopupsGrid.qml \
24 TextWithImportPopups.qml

Subscribers

People subscribed via source and target branches

to status/vote changes: