Merge lp:~tpeeters/ubuntu-ui-toolkit/qt56fixes2sections into lp:ubuntu-ui-toolkit/staging
- qt56fixes2sections
- Merge into staging
Status: | Merged | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Cris Dywan | ||||||||||||
Approved revision: | 2130 | ||||||||||||
Merged at revision: | 2130 | ||||||||||||
Proposed branch: | lp:~tpeeters/ubuntu-ui-toolkit/qt56fixes2sections | ||||||||||||
Merge into: | lp:ubuntu-ui-toolkit/staging | ||||||||||||
Diff against target: |
729 lines (+453/-61) 20 files modified
src/UbuntuToolkit/ubuntutoolkitmodule.cpp (+5/-0) src/imports/Components/1.2/MainView.qml (+9/-9) src/imports/Components/1.2/MainView12.qml (+9/-9) src/imports/Components/1.2/OrientationHelper.qml (+6/-4) src/imports/Components/1.3/MainView.qml (+9/-9) src/imports/Components/1.3/OrientationHelper.qml (+6/-4) tests/unit/mainview11/tst_mainview.cpp (+0/-17) tests/unit/mainview13/AppName.qml (+23/-0) tests/unit/mainview13/LocalStorage.qml (+32/-0) tests/unit/mainview13/PageStack.qml (+38/-0) tests/unit/mainview13/PageTitle.qml (+32/-0) tests/unit/mainview13/Settings.qml (+2/-2) tests/unit/mainview13/mainview13.pro (+4/-0) tests/unit/mainview13/tst_mainview.cpp (+216/-0) tests/unit/orientation/tst_orientation.cpp (+2/-2) tests/unit/runtest.sh (+2/-2) tests/unit/unit.pro (+2/-1) tests/unit/visual/tst_pagehead_sections_bug1511839.13.qml (+0/-1) tests/unit/visual/tst_sections.13.qml (+0/-1) tests/unit/visual/tst_window_context_property_init_bug1621509.13.qml (+56/-0) |
||||||||||||
To merge this branch: | bzr merge lp:~tpeeters/ubuntu-ui-toolkit/qt56fixes2sections | ||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ubuntu-sdk-build-bot | continuous-integration | Approve | |
Cris Dywan | Approve | ||
Review via email: mp+306328@code.launchpad.net |
Commit message
Initialize the 'window' context property with null and add MainView 1.3 unit tests.
Description of the change
Initialize the 'window' context property with null instead of leaving it 'undefined' until the window exists.
Also add tests for MainView 1.3 and add a FIXME to the broken OrientationHelper tests.
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2119
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2119
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2119
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2119
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2119
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2120
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2120
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2120
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2120
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2120
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2120
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2122
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2122
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2122
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2122
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2122
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2122
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2124
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2124
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2124
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2124
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2124
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2124
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2125
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2125
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2125
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2125
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2125
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2125
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2126
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2126
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2126
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2126
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2126
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2126
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2127
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2127
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2127
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2127
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2127
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2127
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2128
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2128
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2128
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2128
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2128
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2128
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Cris Dywan (kalikiana) wrote : | # |
--- src/imports/
+++ src/imports/
@@ -93,17 +93,17 @@
// 'window' is defined by QML between startup and showing on the screen.
// There is no signal for when it becomes available and re-declaring it is not safe.
- property bool windowActive: typeof window != 'undefined'
+ property bool windowActive: window !== null
--- src/imports/
+++ src/imports/
@@ -129,20 +129,22 @@
http://
http://
*/
- property bool windowActive: typeof window != 'undefined'
+ property bool windowActive: typeof window != 'undefined' && window !== null
--- src/imports/
+++ src/imports/
@@ -129,20 +129,22 @@
http://
http://
*/
- property bool windowActive: typeof window != 'undefined'
+ property bool windowActive: typeof window != 'undefined' && window !== null
Why are those above definitions different? I'm guessing by accident?
Otherwise looking good, love the test clean-up.
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2129
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2129
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2129
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2129
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2129
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2129
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Cris Dywan (kalikiana) wrote : | # |
Thanks for the update! Looking great now.
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2129
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2129
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2129
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2129
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2129
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) : | # |
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Autolanding.
Unapproved changes made after approval.
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2130
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2130
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2130
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2130
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2130
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2130
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2130
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2130
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2130
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2130
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2130
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) : | # |
Preview Diff
1 | === modified file 'src/UbuntuToolkit/ubuntutoolkitmodule.cpp' | |||
2 | --- src/UbuntuToolkit/ubuntutoolkitmodule.cpp 2016-09-22 14:58:31 +0000 | |||
3 | +++ src/UbuntuToolkit/ubuntutoolkitmodule.cpp 2016-09-27 10:56:19 +0000 | |||
4 | @@ -190,6 +190,11 @@ | |||
5 | 190 | new ContextPropertyChangeListener(context, QStringLiteral("FontUtils")); | 190 | new ContextPropertyChangeListener(context, QStringLiteral("FontUtils")); |
6 | 191 | QObject::connect(UCUnits::instance(), SIGNAL(gridUnitChanged()), | 191 | QObject::connect(UCUnits::instance(), SIGNAL(gridUnitChanged()), |
7 | 192 | fontUtilsListener, SLOT(updateContextProperty())); | 192 | fontUtilsListener, SLOT(updateContextProperty())); |
8 | 193 | |||
9 | 194 | // Make the context property 'window' available even before there is a window, | ||
10 | 195 | // so that in QML we do not have to check whether 'window' is defined, and no new | ||
11 | 196 | // context property will be added after all components are completed (bug #1621509). | ||
12 | 197 | context->setContextProperty("window", Q_NULLPTR); | ||
13 | 193 | } | 198 | } |
14 | 194 | 199 | ||
15 | 195 | void UbuntuToolkitModule::registerTypesToVersion(const char *uri, int major, int minor) | 200 | void UbuntuToolkitModule::registerTypesToVersion(const char *uri, int major, int minor) |
16 | 196 | 201 | ||
17 | === modified file 'src/imports/Components/1.2/MainView.qml' | |||
18 | --- src/imports/Components/1.2/MainView.qml 2015-12-17 09:13:29 +0000 | |||
19 | +++ src/imports/Components/1.2/MainView.qml 2016-09-27 10:56:19 +0000 | |||
20 | @@ -204,17 +204,17 @@ | |||
21 | 204 | 204 | ||
22 | 205 | // 'window' is defined by QML between startup and showing on the screen. | 205 | // 'window' is defined by QML between startup and showing on the screen. |
23 | 206 | // There is no signal for when it becomes available and re-declaring it is not safe. | 206 | // There is no signal for when it becomes available and re-declaring it is not safe. |
25 | 207 | property bool windowActive: typeof window != 'undefined' | 207 | property bool windowActive: window !== null |
26 | 208 | function updateWindowTitle() { | ||
27 | 209 | if (window) { | ||
28 | 210 | window.title = headerItem.title; | ||
29 | 211 | } | ||
30 | 212 | } | ||
31 | 208 | onWindowActiveChanged: { | 213 | onWindowActiveChanged: { |
33 | 209 | window.title = headerItem.title | 214 | updateWindowTitle(); |
34 | 210 | } | 215 | } |
42 | 211 | 216 | onTitleChanged: { | |
43 | 212 | Connections { | 217 | updateWindowTitle(); |
37 | 213 | target: headerItem | ||
38 | 214 | onTitleChanged: { | ||
39 | 215 | if (headerItem.windowActive) | ||
40 | 216 | window.title = headerItem.title | ||
41 | 217 | } | ||
44 | 218 | } | 218 | } |
45 | 219 | 219 | ||
46 | 220 | useDeprecatedToolbar: mainView.useDeprecatedToolbar | 220 | useDeprecatedToolbar: mainView.useDeprecatedToolbar |
47 | 221 | 221 | ||
48 | === modified file 'src/imports/Components/1.2/MainView12.qml' | |||
49 | --- src/imports/Components/1.2/MainView12.qml 2015-06-10 14:17:25 +0000 | |||
50 | +++ src/imports/Components/1.2/MainView12.qml 2016-09-27 10:56:19 +0000 | |||
51 | @@ -93,17 +93,17 @@ | |||
52 | 93 | 93 | ||
53 | 94 | // 'window' is defined by QML between startup and showing on the screen. | 94 | // 'window' is defined by QML between startup and showing on the screen. |
54 | 95 | // There is no signal for when it becomes available and re-declaring it is not safe. | 95 | // There is no signal for when it becomes available and re-declaring it is not safe. |
56 | 96 | property bool windowActive: typeof window != 'undefined' | 96 | property bool windowActive: window !== null |
57 | 97 | function updateWindowTitle() { | ||
58 | 98 | if (window) { | ||
59 | 99 | window.title = headerItem.title; | ||
60 | 100 | } | ||
61 | 101 | } | ||
62 | 97 | onWindowActiveChanged: { | 102 | onWindowActiveChanged: { |
64 | 98 | window.title = headerItem.title | 103 | updateWindowTitle(); |
65 | 99 | } | 104 | } |
73 | 100 | 105 | onTitleChanged: { | |
74 | 101 | Connections { | 106 | updateWindowTitle(); |
68 | 102 | target: headerItem | ||
69 | 103 | onTitleChanged: { | ||
70 | 104 | if (headerItem.windowActive) | ||
71 | 105 | window.title = headerItem.title | ||
72 | 106 | } | ||
75 | 107 | } | 107 | } |
76 | 108 | 108 | ||
77 | 109 | // Use of the deprecated toolbar is no longer supported in MainView 1.2. | 109 | // Use of the deprecated toolbar is no longer supported in MainView 1.2. |
78 | 110 | 110 | ||
79 | === modified file 'src/imports/Components/1.2/OrientationHelper.qml' | |||
80 | --- src/imports/Components/1.2/OrientationHelper.qml 2016-05-25 12:48:10 +0000 | |||
81 | +++ src/imports/Components/1.2/OrientationHelper.qml 2016-09-27 10:56:19 +0000 | |||
82 | @@ -129,20 +129,22 @@ | |||
83 | 129 | http://qt-project.org/doc/qt-5.1/qtqml/qml-qtqml2-qt.html | 129 | http://qt-project.org/doc/qt-5.1/qtqml/qml-qtqml2-qt.html |
84 | 130 | http://qt-project.org/doc/qt-5.1/qtquick/qmlmodule-qtquick-window2-qtquick-window-2.html | 130 | http://qt-project.org/doc/qt-5.1/qtquick/qmlmodule-qtquick-window2-qtquick-window-2.html |
85 | 131 | */ | 131 | */ |
87 | 132 | property bool windowActive: typeof window != 'undefined' | 132 | property bool windowActive: window !== null |
88 | 133 | 133 | ||
89 | 134 | /*! | 134 | /*! |
90 | 135 | Report the current orientation of the application via QWindow::contentOrientation. | 135 | Report the current orientation of the application via QWindow::contentOrientation. |
91 | 136 | http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop | 136 | http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop |
92 | 137 | */ | 137 | */ |
93 | 138 | function applyOrientation() { | 138 | function applyOrientation() { |
96 | 139 | if (windowActive && window) | 139 | if (window) { |
97 | 140 | window.contentOrientation = Screen.orientation | 140 | window.contentOrientation = Screen.orientation; |
98 | 141 | } | ||
99 | 141 | } | 142 | } |
100 | 142 | 143 | ||
101 | 143 | onWindowActiveChanged: { | 144 | onWindowActiveChanged: { |
103 | 144 | if (automaticOrientation) | 145 | if (automaticOrientation) { |
104 | 145 | applyOrientation(); | 146 | applyOrientation(); |
105 | 147 | } | ||
106 | 146 | } | 148 | } |
107 | 147 | 149 | ||
108 | 148 | Timer { | 150 | Timer { |
109 | 149 | 151 | ||
110 | === modified file 'src/imports/Components/1.3/MainView.qml' | |||
111 | --- src/imports/Components/1.3/MainView.qml 2016-07-27 15:40:52 +0000 | |||
112 | +++ src/imports/Components/1.3/MainView.qml 2016-09-27 10:56:19 +0000 | |||
113 | @@ -167,17 +167,17 @@ | |||
114 | 167 | 167 | ||
115 | 168 | // 'window' is defined by QML between startup and showing on the screen. | 168 | // 'window' is defined by QML between startup and showing on the screen. |
116 | 169 | // There is no signal for when it becomes available and re-declaring it is not safe. | 169 | // There is no signal for when it becomes available and re-declaring it is not safe. |
118 | 170 | property bool windowActive: typeof window != 'undefined' | 170 | property bool windowActive: window !== null |
119 | 171 | function updateWindowTitle() { | ||
120 | 172 | if (window) { | ||
121 | 173 | window.title = headerItem.title; | ||
122 | 174 | } | ||
123 | 175 | } | ||
124 | 171 | onWindowActiveChanged: { | 176 | onWindowActiveChanged: { |
126 | 172 | window.title = headerItem.title | 177 | updateWindowTitle(); |
127 | 173 | } | 178 | } |
135 | 174 | 179 | onTitleChanged: { | |
136 | 175 | Connections { | 180 | updateWindowTitle(); |
130 | 176 | target: headerItem | ||
131 | 177 | onTitleChanged: { | ||
132 | 178 | if (headerItem.windowActive) | ||
133 | 179 | window.title = headerItem.title | ||
134 | 180 | } | ||
137 | 181 | } | 181 | } |
138 | 182 | } | 182 | } |
139 | 183 | 183 | ||
140 | 184 | 184 | ||
141 | === modified file 'src/imports/Components/1.3/OrientationHelper.qml' | |||
142 | --- src/imports/Components/1.3/OrientationHelper.qml 2016-05-25 12:48:10 +0000 | |||
143 | +++ src/imports/Components/1.3/OrientationHelper.qml 2016-09-27 10:56:19 +0000 | |||
144 | @@ -129,20 +129,22 @@ | |||
145 | 129 | http://qt-project.org/doc/qt-5.1/qtqml/qml-qtqml2-qt.html | 129 | http://qt-project.org/doc/qt-5.1/qtqml/qml-qtqml2-qt.html |
146 | 130 | http://qt-project.org/doc/qt-5.1/qtquick/qmlmodule-qtquick-window2-qtquick-window-2.html | 130 | http://qt-project.org/doc/qt-5.1/qtquick/qmlmodule-qtquick-window2-qtquick-window-2.html |
147 | 131 | */ | 131 | */ |
149 | 132 | property bool windowActive: typeof window != 'undefined' | 132 | property bool windowActive: window !== null |
150 | 133 | 133 | ||
151 | 134 | /*! | 134 | /*! |
152 | 135 | Report the current orientation of the application via QWindow::contentOrientation. | 135 | Report the current orientation of the application via QWindow::contentOrientation. |
153 | 136 | http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop | 136 | http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop |
154 | 137 | */ | 137 | */ |
155 | 138 | function applyOrientation() { | 138 | function applyOrientation() { |
158 | 139 | if (windowActive && window) | 139 | if (window) { |
159 | 140 | window.contentOrientation = Screen.orientation | 140 | window.contentOrientation = Screen.orientation; |
160 | 141 | } | ||
161 | 141 | } | 142 | } |
162 | 142 | 143 | ||
163 | 143 | onWindowActiveChanged: { | 144 | onWindowActiveChanged: { |
165 | 144 | if (automaticOrientation) | 145 | if (automaticOrientation) { |
166 | 145 | applyOrientation(); | 146 | applyOrientation(); |
167 | 147 | } | ||
168 | 146 | } | 148 | } |
169 | 147 | 149 | ||
170 | 148 | Timer { | 150 | Timer { |
171 | 149 | 151 | ||
172 | === renamed directory 'tests/unit/mainview' => 'tests/unit/mainview11' | |||
173 | === renamed file 'tests/unit/mainview/mainview.pro' => 'tests/unit/mainview11/mainview11.pro' | |||
174 | === modified file 'tests/unit/mainview11/tst_mainview.cpp' | |||
175 | --- tests/unit/mainview/tst_mainview.cpp 2016-09-09 17:49:07 +0000 | |||
176 | +++ tests/unit/mainview11/tst_mainview.cpp 2016-09-27 10:56:19 +0000 | |||
177 | @@ -156,23 +156,6 @@ | |||
178 | 156 | return filename; | 156 | return filename; |
179 | 157 | } | 157 | } |
180 | 158 | 158 | ||
181 | 159 | void testLabsSettings() { | ||
182 | 160 | QString applicationName("red.riding.hood"); | ||
183 | 161 | // Delete file if it exists to avoid false positives | ||
184 | 162 | QString filename(getConfFile(applicationName)); | ||
185 | 163 | QFile::remove(filename); | ||
186 | 164 | |||
187 | 165 | QQuickItem *root = loadTest("Settings.qml"); | ||
188 | 166 | QVERIFY(root); | ||
189 | 167 | QQuickItem *mainView = root; | ||
190 | 168 | QCOMPARE(applicationName, mainView->property("applicationName").toString()); | ||
191 | 169 | QCOMPARE(QString(applicationName), QCoreApplication::organizationDomain()); | ||
192 | 170 | QQuickItem *textField(testItem(mainView, "textfield")); | ||
193 | 171 | textField->setProperty("text", "Blue"); | ||
194 | 172 | delete root; | ||
195 | 173 | QVERIFY(QFile::exists(filename)); | ||
196 | 174 | } | ||
197 | 175 | |||
198 | 176 | void testQSettings() { | 159 | void testQSettings() { |
199 | 177 | QString applicationName("i.prefer.pi"); | 160 | QString applicationName("i.prefer.pi"); |
200 | 178 | // Delete file if it exists to avoid false positives | 161 | // Delete file if it exists to avoid false positives |
201 | 179 | 162 | ||
202 | === added directory 'tests/unit/mainview13' | |||
203 | === added file 'tests/unit/mainview13/AppName.qml' | |||
204 | --- tests/unit/mainview13/AppName.qml 1970-01-01 00:00:00 +0000 | |||
205 | +++ tests/unit/mainview13/AppName.qml 2016-09-27 10:56:19 +0000 | |||
206 | @@ -0,0 +1,23 @@ | |||
207 | 1 | /* | ||
208 | 2 | * Copyright 2016 Canonical Ltd. | ||
209 | 3 | * | ||
210 | 4 | * This program is free software; you can redistribute it and/or modify | ||
211 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
212 | 6 | * the Free Software Foundation; version 3. | ||
213 | 7 | * | ||
214 | 8 | * This program is distributed in the hope that it will be useful, | ||
215 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
216 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
217 | 11 | * GNU Lesser General Public License for more details. | ||
218 | 12 | * | ||
219 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
220 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
221 | 15 | */ | ||
222 | 16 | |||
223 | 17 | import QtQuick 2.4 | ||
224 | 18 | import Ubuntu.Components 1.3 | ||
225 | 19 | |||
226 | 20 | MainView { | ||
227 | 21 | objectName: "appName" | ||
228 | 22 | applicationName: "org.gnu.wildebeest" | ||
229 | 23 | } | ||
230 | 0 | 24 | ||
231 | === added file 'tests/unit/mainview13/LocalStorage.qml' | |||
232 | --- tests/unit/mainview13/LocalStorage.qml 1970-01-01 00:00:00 +0000 | |||
233 | +++ tests/unit/mainview13/LocalStorage.qml 2016-09-27 10:56:19 +0000 | |||
234 | @@ -0,0 +1,32 @@ | |||
235 | 1 | /* | ||
236 | 2 | * Copyright 2016 Canonical Ltd. | ||
237 | 3 | * | ||
238 | 4 | * This program is free software; you can redistribute it and/or modify | ||
239 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
240 | 6 | * the Free Software Foundation; version 3. | ||
241 | 7 | * | ||
242 | 8 | * This program is distributed in the hope that it will be useful, | ||
243 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
244 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
245 | 11 | * GNU Lesser General Public License for more details. | ||
246 | 12 | * | ||
247 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
248 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
249 | 15 | */ | ||
250 | 16 | |||
251 | 17 | import QtQuick 2.4 | ||
252 | 18 | import Ubuntu.Components 1.3 | ||
253 | 19 | import QtQuick.LocalStorage 2.0 | ||
254 | 20 | |||
255 | 21 | MainView { | ||
256 | 22 | objectName: "localStorage" | ||
257 | 23 | applicationName: "tv.island.pacific" | ||
258 | 24 | |||
259 | 25 | Component.onCompleted: { | ||
260 | 26 | var db = LocalStorage.openDatabaseSync("pacific.island.tv", "1.0", "lorem ipsum", 1000) | ||
261 | 27 | db.transaction(function(tx){ | ||
262 | 28 | tx.executeSql('CREATE TABLE IF NOT EXISTS Island(name TEXT)') | ||
263 | 29 | tx.executeSql('INSERT INTO Island VALUES(?)', ['Tuvalu']) | ||
264 | 30 | }) | ||
265 | 31 | } | ||
266 | 32 | } | ||
267 | 0 | 33 | ||
268 | === added file 'tests/unit/mainview13/PageStack.qml' | |||
269 | --- tests/unit/mainview13/PageStack.qml 1970-01-01 00:00:00 +0000 | |||
270 | +++ tests/unit/mainview13/PageStack.qml 2016-09-27 10:56:19 +0000 | |||
271 | @@ -0,0 +1,38 @@ | |||
272 | 1 | /* | ||
273 | 2 | * Copyright 2016 Canonical Ltd. | ||
274 | 3 | * | ||
275 | 4 | * This program is free software; you can redistribute it and/or modify | ||
276 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
277 | 6 | * the Free Software Foundation; version 3. | ||
278 | 7 | * | ||
279 | 8 | * This program is distributed in the hope that it will be useful, | ||
280 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
281 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
282 | 11 | * GNU Lesser General Public License for more details. | ||
283 | 12 | * | ||
284 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
285 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
286 | 15 | */ | ||
287 | 16 | |||
288 | 17 | import QtQuick 2.4 | ||
289 | 18 | import Ubuntu.Components 1.3 | ||
290 | 19 | |||
291 | 20 | MainView { | ||
292 | 21 | objectName: "pageStack" | ||
293 | 22 | applicationName: "once.upon.a.time" | ||
294 | 23 | |||
295 | 24 | PageStack { | ||
296 | 25 | id: stack | ||
297 | 26 | objectName: "stack" | ||
298 | 27 | Component.onCompleted: stack.push(pageOnStack) | ||
299 | 28 | |||
300 | 29 | Page { | ||
301 | 30 | id: pageOnStack | ||
302 | 31 | objectName: "page" | ||
303 | 32 | title: 'Far far away' // sets the window title. | ||
304 | 33 | header: PageHeader { | ||
305 | 34 | title: pageOnStack.title | ||
306 | 35 | } | ||
307 | 36 | } | ||
308 | 37 | } | ||
309 | 38 | } | ||
310 | 0 | 39 | ||
311 | === added file 'tests/unit/mainview13/PageTitle.qml' | |||
312 | --- tests/unit/mainview13/PageTitle.qml 1970-01-01 00:00:00 +0000 | |||
313 | +++ tests/unit/mainview13/PageTitle.qml 2016-09-27 10:56:19 +0000 | |||
314 | @@ -0,0 +1,32 @@ | |||
315 | 1 | /* | ||
316 | 2 | * Copyright 2016 Canonical Ltd. | ||
317 | 3 | * | ||
318 | 4 | * This program is free software; you can redistribute it and/or modify | ||
319 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
320 | 6 | * the Free Software Foundation; version 3. | ||
321 | 7 | * | ||
322 | 8 | * This program is distributed in the hope that it will be useful, | ||
323 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
324 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
325 | 11 | * GNU Lesser General Public License for more details. | ||
326 | 12 | * | ||
327 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
328 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
329 | 15 | */ | ||
330 | 16 | |||
331 | 17 | import QtQuick 2.4 | ||
332 | 18 | import Ubuntu.Components 1.3 | ||
333 | 19 | |||
334 | 20 | MainView { | ||
335 | 21 | objectName: "pageTitle" | ||
336 | 22 | applicationName: "once.upon.a.time" | ||
337 | 23 | |||
338 | 24 | Page { | ||
339 | 25 | id: page | ||
340 | 26 | objectName: "page" | ||
341 | 27 | title: 'Once upon a time' // sets the window title | ||
342 | 28 | header: PageHeader { | ||
343 | 29 | title: page.title | ||
344 | 30 | } | ||
345 | 31 | } | ||
346 | 32 | } | ||
347 | 0 | 33 | ||
348 | === renamed file 'tests/unit/mainview/Settings.qml' => 'tests/unit/mainview13/Settings.qml' | |||
349 | --- tests/unit/mainview/Settings.qml 2016-01-20 16:42:29 +0000 | |||
350 | +++ tests/unit/mainview13/Settings.qml 2016-09-27 10:56:19 +0000 | |||
351 | @@ -1,5 +1,5 @@ | |||
352 | 1 | /* | 1 | /* |
354 | 2 | * Copyright 2014 Canonical Ltd. | 2 | * Copyright 2016 Canonical Ltd. |
355 | 3 | * | 3 | * |
356 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
357 | 5 | * it under the terms of the GNU Lesser General Public License as published by | 5 | * it under the terms of the GNU Lesser General Public License as published by |
358 | @@ -14,7 +14,7 @@ | |||
359 | 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/>. |
360 | 15 | */ | 15 | */ |
361 | 16 | 16 | ||
363 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.4 |
364 | 18 | import Ubuntu.Components 1.3 | 18 | import Ubuntu.Components 1.3 |
365 | 19 | import Qt.labs.settings 1.0 | 19 | import Qt.labs.settings 1.0 |
366 | 20 | 20 | ||
367 | 21 | 21 | ||
368 | === added file 'tests/unit/mainview13/mainview13.pro' | |||
369 | --- tests/unit/mainview13/mainview13.pro 1970-01-01 00:00:00 +0000 | |||
370 | +++ tests/unit/mainview13/mainview13.pro 2016-09-27 10:56:19 +0000 | |||
371 | @@ -0,0 +1,4 @@ | |||
372 | 1 | include(../test-include.pri) | ||
373 | 2 | |||
374 | 3 | QT += gui | ||
375 | 4 | SOURCES += tst_mainview.cpp | ||
376 | 0 | 5 | ||
377 | === added file 'tests/unit/mainview13/tst_mainview.cpp' | |||
378 | --- tests/unit/mainview13/tst_mainview.cpp 1970-01-01 00:00:00 +0000 | |||
379 | +++ tests/unit/mainview13/tst_mainview.cpp 2016-09-27 10:56:19 +0000 | |||
380 | @@ -0,0 +1,216 @@ | |||
381 | 1 | /* | ||
382 | 2 | * Copyright 2012-2013 Canonical Ltd. | ||
383 | 3 | * | ||
384 | 4 | * This program is free software; you can redistribute it and/or modify | ||
385 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
386 | 6 | * the Free Software Foundation; version 3. | ||
387 | 7 | * | ||
388 | 8 | * This program is distributed in the hope that it will be useful, | ||
389 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
390 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
391 | 11 | * GNU Lesser General Public License for more details. | ||
392 | 12 | * | ||
393 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
394 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
395 | 15 | * | ||
396 | 16 | * Author: Christian Dywan <christian.dywan@canonical.com> | ||
397 | 17 | */ | ||
398 | 18 | |||
399 | 19 | #include <QtCore/QCoreApplication> | ||
400 | 20 | #include <QtCore/QCryptographicHash> | ||
401 | 21 | #include <QtCore/QDebug> | ||
402 | 22 | #include <QtCore/QDir> | ||
403 | 23 | #include <QtCore/QFileInfo> | ||
404 | 24 | #include <QtCore/QProcessEnvironment> | ||
405 | 25 | #include <QtCore/QSettings> | ||
406 | 26 | #include <QtCore/QStandardPaths> | ||
407 | 27 | #include <QtCore/QString> | ||
408 | 28 | #include <QtCore/QTextCodec> | ||
409 | 29 | #include <QtCore/QThread> | ||
410 | 30 | #include <QtQml/QQmlEngine> | ||
411 | 31 | #include <QtQuick/QQuickItem> | ||
412 | 32 | #include <QtQuick/QQuickView> | ||
413 | 33 | #include <QtTest/QSignalSpy> | ||
414 | 34 | #include <QtTest/QTest> | ||
415 | 35 | #include <UbuntuToolkit/ubuntutoolkitmodule.h> | ||
416 | 36 | #include <UbuntuToolkit/private/ucapplication_p.h> | ||
417 | 37 | #include <UbuntuToolkit/private/ucunits_p.h> | ||
418 | 38 | |||
419 | 39 | #include "uctestcase.h" | ||
420 | 40 | |||
421 | 41 | UT_USE_NAMESPACE | ||
422 | 42 | |||
423 | 43 | class tst_MainView : public QObject | ||
424 | 44 | { | ||
425 | 45 | Q_OBJECT | ||
426 | 46 | |||
427 | 47 | private: | ||
428 | 48 | QQuickView *view; | ||
429 | 49 | |||
430 | 50 | public: | ||
431 | 51 | tst_MainView() : | ||
432 | 52 | view(0) | ||
433 | 53 | { | ||
434 | 54 | } | ||
435 | 55 | |||
436 | 56 | QQuickItem *loadTest(const QString &document) | ||
437 | 57 | { | ||
438 | 58 | // load the document | ||
439 | 59 | view->setSource(QUrl::fromLocalFile(document)); | ||
440 | 60 | QTest::waitForEvents(); | ||
441 | 61 | |||
442 | 62 | return view->rootObject(); | ||
443 | 63 | } | ||
444 | 64 | |||
445 | 65 | QQuickItem *testItem(QQuickItem *that, const QString &identifier) | ||
446 | 66 | { | ||
447 | 67 | if (that->property(identifier.toLocal8Bit()).isValid()) | ||
448 | 68 | return that->property(identifier.toLocal8Bit()).value<QQuickItem*>(); | ||
449 | 69 | |||
450 | 70 | QList<QQuickItem*> children = that->findChildren<QQuickItem*>(identifier); | ||
451 | 71 | return (children.count() > 0) ? children[0] : 0; | ||
452 | 72 | } | ||
453 | 73 | |||
454 | 74 | private Q_SLOTS: | ||
455 | 75 | |||
456 | 76 | void initTestCase() | ||
457 | 77 | { | ||
458 | 78 | QString modules(UBUNTU_QML_IMPORT_PATH); | ||
459 | 79 | QVERIFY(QDir(modules).exists()); | ||
460 | 80 | |||
461 | 81 | view = new QQuickView; | ||
462 | 82 | QQmlEngine *quickEngine = view->engine(); | ||
463 | 83 | UbuntuToolkitModule::initializeContextProperties(quickEngine); | ||
464 | 84 | |||
465 | 85 | view->setGeometry(0,0, UCUnits::instance()->gu(40), UCUnits::instance()->gu(30)); | ||
466 | 86 | //add modules folder so we have access to the plugin from QML | ||
467 | 87 | QStringList imports = quickEngine->importPathList(); | ||
468 | 88 | imports.prepend(QDir(modules).absolutePath()); | ||
469 | 89 | quickEngine->setImportPathList(imports); | ||
470 | 90 | } | ||
471 | 91 | |||
472 | 92 | void cleanupTestCase() | ||
473 | 93 | { | ||
474 | 94 | delete view; | ||
475 | 95 | } | ||
476 | 96 | |||
477 | 97 | void testCase_AppName() | ||
478 | 98 | { | ||
479 | 99 | QQuickItem *root = loadTest("AppName.qml"); | ||
480 | 100 | QVERIFY(root); | ||
481 | 101 | QQuickItem *mainView = root; | ||
482 | 102 | QString applicationName(mainView->property("applicationName").toString()); | ||
483 | 103 | QCOMPARE(applicationName, QString("org.gnu.wildebeest")); | ||
484 | 104 | QCOMPARE(applicationName, QCoreApplication::applicationName()); | ||
485 | 105 | QCOMPARE(QString(""), QCoreApplication::organizationName()); | ||
486 | 106 | } | ||
487 | 107 | |||
488 | 108 | void testSetApplicationName() { | ||
489 | 109 | QString appName("com.ubuntu.foo"); | ||
490 | 110 | UCApplication::instance()->setApplicationName(appName); | ||
491 | 111 | QCOMPARE(UCApplication::instance()->applicationName(), appName); | ||
492 | 112 | QCOMPARE(QCoreApplication::applicationName(), appName); | ||
493 | 113 | QCOMPARE(QString(""), QCoreApplication::organizationName()); | ||
494 | 114 | } | ||
495 | 115 | |||
496 | 116 | void testExpectedDataFolder() { | ||
497 | 117 | QString appName("net.weight.gain"); | ||
498 | 118 | UCApplication::instance()->setApplicationName(appName); | ||
499 | 119 | QString dataFolder(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); | ||
500 | 120 | QString xdgDataHome(QProcessEnvironment::systemEnvironment().value("XDG_DATA_HOME", | ||
501 | 121 | QProcessEnvironment::systemEnvironment().value("HOME") + "/.local/share")); | ||
502 | 122 | QString expectedDataFolder(xdgDataHome + "/" + appName); | ||
503 | 123 | QCOMPARE(dataFolder, expectedDataFolder); | ||
504 | 124 | } | ||
505 | 125 | |||
506 | 126 | void testExpectedCacheFolder() { | ||
507 | 127 | QString appName("cat.long.very"); | ||
508 | 128 | UCApplication::instance()->setApplicationName(appName); | ||
509 | 129 | QString cacheFolder(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); | ||
510 | 130 | QString xdgCacheHome(QProcessEnvironment::systemEnvironment().value("XDG_CACHE_HOME", | ||
511 | 131 | QProcessEnvironment::systemEnvironment().value("HOME") + "/.cache")); | ||
512 | 132 | QString expectedCacheFolder(xdgCacheHome + "/" + appName); | ||
513 | 133 | QCOMPARE(cacheFolder, expectedCacheFolder); | ||
514 | 134 | } | ||
515 | 135 | |||
516 | 136 | void testLocalStorage() { | ||
517 | 137 | QQuickItem *root = loadTest("LocalStorage.qml"); | ||
518 | 138 | QVERIFY(root); | ||
519 | 139 | QQuickItem *mainView = root; | ||
520 | 140 | QString applicationName(mainView->property("applicationName").toString()); | ||
521 | 141 | QCOMPARE(applicationName, QString("tv.island.pacific")); | ||
522 | 142 | QCOMPARE(applicationName, QCoreApplication::applicationName()); | ||
523 | 143 | QCOMPARE(QString(""), QCoreApplication::organizationName()); | ||
524 | 144 | QString dataFolder(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); | ||
525 | 145 | QString databaseFolder(dataFolder + "/Databases"); | ||
526 | 146 | QVERIFY(QFile::exists(databaseFolder)); | ||
527 | 147 | QString hash(QCryptographicHash::hash("pacific.island.tv", QCryptographicHash::Md5).toHex()); | ||
528 | 148 | QString database(databaseFolder + "/" + hash + ".sqlite"); | ||
529 | 149 | QVERIFY(QFile::exists(database)); | ||
530 | 150 | } | ||
531 | 151 | |||
532 | 152 | QString getConfFile(QString applicationName) { | ||
533 | 153 | QString configFolder(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)); | ||
534 | 154 | QString subFolder(configFolder + "/" + applicationName); | ||
535 | 155 | QString filename(subFolder + "/" + applicationName + ".conf"); | ||
536 | 156 | return filename; | ||
537 | 157 | } | ||
538 | 158 | |||
539 | 159 | void testLabsSettings() { | ||
540 | 160 | QString applicationName("red.riding.hood"); | ||
541 | 161 | // Delete file if it exists to avoid false positives | ||
542 | 162 | QString filename(getConfFile(applicationName)); | ||
543 | 163 | QFile::remove(filename); | ||
544 | 164 | |||
545 | 165 | QQuickItem *root = loadTest("Settings.qml"); | ||
546 | 166 | QVERIFY(root); | ||
547 | 167 | QQuickItem *mainView = root; | ||
548 | 168 | QCOMPARE(applicationName, mainView->property("applicationName").toString()); | ||
549 | 169 | QCOMPARE(QString(applicationName), QCoreApplication::organizationDomain()); | ||
550 | 170 | QQuickItem *textField(testItem(mainView, "textfield")); | ||
551 | 171 | textField->setProperty("text", "Blue"); | ||
552 | 172 | delete root; | ||
553 | 173 | QVERIFY(QFile::exists(filename)); | ||
554 | 174 | } | ||
555 | 175 | |||
556 | 176 | void testQSettings() { | ||
557 | 177 | QString applicationName("i.prefer.pi"); | ||
558 | 178 | // Delete file if it exists to avoid false positives | ||
559 | 179 | QString filename(getConfFile(applicationName)); | ||
560 | 180 | QFile::remove(filename); | ||
561 | 181 | |||
562 | 182 | UCApplication::instance()->setApplicationName(applicationName); | ||
563 | 183 | // QSettings with defaults | ||
564 | 184 | QSettings mySettings; | ||
565 | 185 | mySettings.setValue("spam", "eggs"); | ||
566 | 186 | // Force writing to disk | ||
567 | 187 | mySettings.sync(); | ||
568 | 188 | QVERIFY(QFile::exists(filename)); | ||
569 | 189 | } | ||
570 | 190 | |||
571 | 191 | void testNoWarnings_bug186065() { | ||
572 | 192 | // An empty MainView would suffice | ||
573 | 193 | QScopedPointer<UbuntuTestCase>testCase (new UbuntuTestCase("AppName.qml")); | ||
574 | 194 | |||
575 | 195 | // No warnings from QML | ||
576 | 196 | QCOMPARE(testCase->warnings(), 0); | ||
577 | 197 | } | ||
578 | 198 | |||
579 | 199 | void testWindowTitleFromPage() { | ||
580 | 200 | QScopedPointer<UbuntuTestCase> testCase(new UbuntuTestCase("PageTitle.qml")); | ||
581 | 201 | QQuickItem *page = testCase->findItem<QQuickItem*>("page"); | ||
582 | 202 | QCOMPARE(QString("Once upon a time"), page->property("title").toString()); | ||
583 | 203 | QCOMPARE(testCase->title(), page->property("title").toString()); | ||
584 | 204 | } | ||
585 | 205 | |||
586 | 206 | void testWindowTitleFromStack() { | ||
587 | 207 | QScopedPointer<UbuntuTestCase> testCase(new UbuntuTestCase("PageStack.qml")); | ||
588 | 208 | QQuickItem *page = testCase->findItem<QQuickItem*>("page"); | ||
589 | 209 | QCOMPARE(QString("Far far away"), page->property("title").toString()); | ||
590 | 210 | QCOMPARE(testCase->title(), page->property("title").toString()); | ||
591 | 211 | } | ||
592 | 212 | }; | ||
593 | 213 | |||
594 | 214 | QTEST_MAIN(tst_MainView) | ||
595 | 215 | |||
596 | 216 | #include "tst_mainview.moc" | ||
597 | 0 | 217 | ||
598 | === modified file 'tests/unit/orientation/tst_orientation.cpp' | |||
599 | --- tests/unit/orientation/tst_orientation.cpp 2016-09-09 17:49:07 +0000 | |||
600 | +++ tests/unit/orientation/tst_orientation.cpp 2016-09-27 10:56:19 +0000 | |||
601 | @@ -52,12 +52,12 @@ | |||
602 | 52 | QScopedPointer<UbuntuTestCase> testCase(new UbuntuTestCase("ManualAngle.qml")); | 52 | QScopedPointer<UbuntuTestCase> testCase(new UbuntuTestCase("ManualAngle.qml")); |
603 | 53 | QQuickItem *helper = testCase->findItem<QQuickItem*>("helper"); | 53 | QQuickItem *helper = testCase->findItem<QQuickItem*>("helper"); |
604 | 54 | // No warning about "window" being undefined must appear | 54 | // No warning about "window" being undefined must appear |
606 | 55 | QSKIP("TypeError: Cannot set property 'contentOrientation' of null"); | 55 | QSKIP("FIXME: We have no valid effectiveness tests for OrientationHelper. See bug #1626063."); |
607 | 56 | QCOMPARE(testCase->warnings(), 0); | 56 | QCOMPARE(testCase->warnings(), 0); |
608 | 57 | QCOMPARE(helper->property("orientationAngle").toInt(), 90); | 57 | QCOMPARE(helper->property("orientationAngle").toInt(), 90); |
609 | 58 | // Verify expected values | 58 | // Verify expected values |
610 | 59 | QQuickItem *checkpoint = testCase->findItem<QQuickItem*>("checkpoint"); | 59 | QQuickItem *checkpoint = testCase->findItem<QQuickItem*>("checkpoint"); |
612 | 60 | // window.contentOrientation | 60 | // window.contentOrientation |
613 | 61 | QCOMPARE(checkpoint->property("contentOrientation").toInt(), helper->property("orientationAngle").toInt()); | 61 | QCOMPARE(checkpoint->property("contentOrientation").toInt(), helper->property("orientationAngle").toInt()); |
614 | 62 | } | 62 | } |
615 | 63 | }; | 63 | }; |
616 | 64 | 64 | ||
617 | === modified file 'tests/unit/runtest.sh' | |||
618 | --- tests/unit/runtest.sh 2016-06-07 12:53:59 +0000 | |||
619 | +++ tests/unit/runtest.sh 2016-09-27 10:56:19 +0000 | |||
620 | @@ -45,8 +45,8 @@ | |||
621 | 45 | echo 'Examples:' | 45 | echo 'Examples:' |
622 | 46 | echo " $0 $(relpath ${BUILD_DIR}/tests/unit/components/components) $(relpath ${SRC_DIR}/tests/unit/components/tst_label13.qml) minimal" | 46 | echo " $0 $(relpath ${BUILD_DIR}/tests/unit/components/components) $(relpath ${SRC_DIR}/tests/unit/components/tst_label13.qml) minimal" |
623 | 47 | echo '' | 47 | echo '' |
626 | 48 | echo " cd $(relpath ${BUILD_DIR}/tests/unit/mainview)" | 48 | echo " cd $(relpath ${BUILD_DIR}/tests/unit/mainview13)" |
627 | 49 | echo " ../$(basename $0) mainview minimal" | 49 | echo " ../$(basename $0) mainview13 minimal" |
628 | 50 | echo " cd ../../.." | 50 | echo " cd ../../.." |
629 | 51 | echo '' | 51 | echo '' |
630 | 52 | echo " cd $(relpath ${BUILD_DIR}/tests/unit/visual)" | 52 | echo " cd $(relpath ${BUILD_DIR}/tests/unit/visual)" |
631 | 53 | 53 | ||
632 | === modified file 'tests/unit/unit.pro' | |||
633 | --- tests/unit/unit.pro 2016-09-23 11:14:46 +0000 | |||
634 | +++ tests/unit/unit.pro 2016-09-27 10:56:19 +0000 | |||
635 | @@ -39,7 +39,8 @@ | |||
636 | 39 | scaling_image_provider \ | 39 | scaling_image_provider \ |
637 | 40 | qquick_image_extension \ | 40 | qquick_image_extension \ |
638 | 41 | performance \ | 41 | performance \ |
640 | 42 | mainview \ | 42 | mainview11 \ |
641 | 43 | mainview13 \ | ||
642 | 43 | i18n \ | 44 | i18n \ |
643 | 44 | arguments \ | 45 | arguments \ |
644 | 45 | argument \ | 46 | argument \ |
645 | 46 | 47 | ||
646 | === renamed file 'tests/unit/visual/FIXME-QT56_pagehead_sections_bug1511839.13.qml' => 'tests/unit/visual/tst_pagehead_sections_bug1511839.13.qml' | |||
647 | --- tests/unit/visual/FIXME-QT56_pagehead_sections_bug1511839.13.qml 2016-09-16 11:13:32 +0000 | |||
648 | +++ tests/unit/visual/tst_pagehead_sections_bug1511839.13.qml 2016-09-27 10:56:19 +0000 | |||
649 | @@ -40,7 +40,6 @@ | |||
650 | 40 | stack.push(pageComponent) | 40 | stack.push(pageComponent) |
651 | 41 | } | 41 | } |
652 | 42 | 42 | ||
653 | 43 | // FIXME: Tests failing with Qt 5.6. See bug #1624337. | ||
654 | 44 | UbuntuTestCase { | 43 | UbuntuTestCase { |
655 | 45 | id: testCase | 44 | id: testCase |
656 | 46 | name: "Page.head.sections" | 45 | name: "Page.head.sections" |
657 | 47 | 46 | ||
658 | === renamed file 'tests/unit/visual/FIXME-QT56_sections.13.qml' => 'tests/unit/visual/tst_sections.13.qml' | |||
659 | --- tests/unit/visual/FIXME-QT56_sections.13.qml 2016-09-16 11:13:32 +0000 | |||
660 | +++ tests/unit/visual/tst_sections.13.qml 2016-09-27 10:56:19 +0000 | |||
661 | @@ -142,7 +142,6 @@ | |||
662 | 142 | name: "SectionsApi" | 142 | name: "SectionsApi" |
663 | 143 | when: windowShown | 143 | when: windowShown |
664 | 144 | 144 | ||
665 | 145 | // FIXME: Fails with Qt 5.6. See bug #1610231. | ||
666 | 146 | function initTestCase() { | 145 | function initTestCase() { |
667 | 147 | // The initially selected actions must be triggered. | 146 | // The initially selected actions must be triggered. |
668 | 148 | compare(label.text, "First action triggered.", | 147 | compare(label.text, "First action triggered.", |
669 | 149 | 148 | ||
670 | === added file 'tests/unit/visual/tst_window_context_property_init_bug1621509.13.qml' | |||
671 | --- tests/unit/visual/tst_window_context_property_init_bug1621509.13.qml 1970-01-01 00:00:00 +0000 | |||
672 | +++ tests/unit/visual/tst_window_context_property_init_bug1621509.13.qml 2016-09-27 10:56:19 +0000 | |||
673 | @@ -0,0 +1,56 @@ | |||
674 | 1 | /* | ||
675 | 2 | * Copyright 2016 Canonical Ltd. | ||
676 | 3 | * | ||
677 | 4 | * This program is free software; you can redistribute it and/or modify | ||
678 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
679 | 6 | * the Free Software Foundation; version 3. | ||
680 | 7 | * | ||
681 | 8 | * This program is distributed in the hope that it will be useful, | ||
682 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
683 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
684 | 11 | * GNU Lesser General Public License for more details. | ||
685 | 12 | * | ||
686 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
687 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
688 | 15 | */ | ||
689 | 16 | |||
690 | 17 | import QtQuick 2.4 | ||
691 | 18 | import QtTest 1.0 | ||
692 | 19 | |||
693 | 20 | // Ubuntu.Components is not explicitly used below, but its import causes bug #1621509. | ||
694 | 21 | import Ubuntu.Components 1.3 | ||
695 | 22 | |||
696 | 23 | TestCase { | ||
697 | 24 | id: testCase | ||
698 | 25 | name: "ContextPropertyInit" | ||
699 | 26 | width: 100 | ||
700 | 27 | height: 100 | ||
701 | 28 | |||
702 | 29 | // Bug #1621509 only occurs when we wait for the window to be visible. | ||
703 | 30 | // Forces the components to be completed before the test functions are executed. | ||
704 | 31 | when: windowShown | ||
705 | 32 | |||
706 | 33 | Item { | ||
707 | 34 | id: testItem | ||
708 | 35 | |||
709 | 36 | // This property changes its value when a new context property is added. | ||
710 | 37 | property var myObject: objectOne | ||
711 | 38 | property int count: 0 | ||
712 | 39 | onMyObjectChanged: { | ||
713 | 40 | count++; | ||
714 | 41 | } | ||
715 | 42 | Component.onCompleted: { | ||
716 | 43 | count = 0; | ||
717 | 44 | print("Component completed."); // must print something to reproduce the bug. | ||
718 | 45 | } | ||
719 | 46 | QtObject { | ||
720 | 47 | objectName: "one" | ||
721 | 48 | id: objectOne | ||
722 | 49 | } | ||
723 | 50 | } | ||
724 | 51 | |||
725 | 52 | function test_no_property_change_after_completed_bug1621509_bug1610231() { | ||
726 | 53 | compare(testItem.count, 0, | ||
727 | 54 | "The property was changed after the component was completed."); | ||
728 | 55 | } | ||
729 | 56 | } |
FAILED: Continuous integration, rev:2119 /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- devel/1252/ /jenkins. ubuntu. com/ubuntu- sdk/job/ generic- update- mp/6626/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- devel/1252/ rebuild
https:/