Merge lp:~bzoltan/ubuntu-ui-toolkit/Landing-2017-03-06 into lp:ubuntu-ui-toolkit
- Landing-2017-03-06
- Merge into trunk
Proposed by
Zoltan Balogh
Status: | Merged |
---|---|
Approved by: | Zoltan Balogh |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1389 |
Proposed branch: | lp:~bzoltan/ubuntu-ui-toolkit/Landing-2017-03-06 |
Merge into: | lp:ubuntu-ui-toolkit |
Diff against target: |
1395 lines (+474/-143) 41 files modified
components.api (+1/-0) debian/changelog (+40/-0) examples/ubuntu-ui-toolkit-gallery/Toggles.qml (+43/-0) src/UbuntuToolkit/menu.cpp (+2/-1) src/UbuntuToolkit/menubar.cpp (+2/-1) src/UbuntuToolkit/menugroup.cpp (+2/-1) src/UbuntuToolkit/privates/uccontenthub.cpp (+45/-45) src/UbuntuToolkit/privates/uccontenthub_p.h (+17/-14) src/UbuntuToolkit/sortfiltermodel.cpp (+5/-2) src/UbuntuToolkit/ucapplication.cpp (+0/-3) src/UbuntuToolkit/ucmainwindow.cpp (+9/-7) src/UbuntuToolkit/ucmainwindow_p.h (+2/-0) src/UbuntuToolkit/ucqquickimageextension.cpp (+53/-2) src/UbuntuToolkit/ucqquickimageextension_p.h (+1/-0) src/UbuntuToolkit/ucslotslayout.cpp (+1/-0) src/UbuntuToolkit/ucstylehints.cpp (+1/-0) src/imports/Components/1.3/ListItemPopover.qml (+2/-1) src/imports/Components/1.3/OptionSelector.qml (+6/-0) src/imports/Components/1.3/TextField.qml (+6/-1) src/imports/Components/1.3/UbuntuListView.qml (+1/-0) src/imports/Components/ListItems/1.3/LabelVisual.qml (+2/-1) src/imports/Components/ListItems/1.3/ThinDivider.qml (+2/-2) src/imports/Components/Popups/1.3/popupUtils.js (+1/-1) src/imports/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml (+17/-3) src/imports/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml (+2/-1) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py (+2/-0) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListItemTestCase.qml (+9/-2) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.py (+13/-1) tests/unit/components/tst_sortfiltermodel.qml (+14/-3) tests/unit/contenthub/tst_contenthub.cpp (+17/-22) tests/unit/mainwindow/VisualRoot.qml (+0/-1) tests/unit/mainwindow/tst_mainwindow.cpp (+33/-10) tests/unit/qquick_image_extension/borderInName.sci (+0/-7) tests/unit/qquick_image_extension/data/borderInName.sci (+7/-0) tests/unit/qquick_image_extension/data/hundred_faces.qml (+13/-0) tests/unit/qquick_image_extension/data/test@18.sci (+7/-0) tests/unit/qquick_image_extension/qquick_image_extension.pro (+1/-1) tests/unit/qquick_image_extension/test@18.sci (+0/-7) tests/unit/qquick_image_extension/tst_qquick_image_extension.cpp (+38/-3) tests/unit/visual/tst_optionselector.13.qml (+9/-0) tests/unit/visual/tst_toggles.13.qml (+48/-0) |
To merge this branch: | bzr merge lp:~bzoltan/ubuntu-ui-toolkit/Landing-2017-03-06 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zoltan Balogh | Approve | ||
Review via email: mp+319093@code.launchpad.net |
Commit message
landing
Description of the change
landing
To post a comment you must log in.
Revision history for this message
Zoltan Balogh (bzoltan) : | # |
review:
Approve
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 2017-01-26 11:59:45 +0000 | |||
3 | +++ components.api 2017-03-06 16:02:52 +0000 | |||
4 | @@ -731,6 +731,7 @@ | |||
5 | 731 | Ubuntu.Components.OptionSelector 1.3: Empty | 731 | Ubuntu.Components.OptionSelector 1.3: Empty |
6 | 732 | property bool colourImage | 732 | property bool colourImage |
7 | 733 | property double containerHeight | 733 | property double containerHeight |
8 | 734 | readonly property int count | ||
9 | 734 | property bool currentlyExpanded | 735 | property bool currentlyExpanded |
10 | 735 | property Component delegate | 736 | property Component delegate |
11 | 736 | property bool expanded | 737 | property bool expanded |
12 | 737 | 738 | ||
13 | === modified file 'debian/changelog' | |||
14 | --- debian/changelog 2017-01-30 11:30:04 +0000 | |||
15 | +++ debian/changelog 2017-03-06 16:02:52 +0000 | |||
16 | @@ -1,3 +1,43 @@ | |||
17 | 1 | ubuntu-ui-toolkit (1.3.2184+17.04) UNRELEASED; urgency=medium | ||
18 | 2 | |||
19 | 3 | [ Adnane Belmadiaf ] | ||
20 | 4 | * Add support for CheckBox label when set | ||
21 | 5 | * Add more tests for checkbox. Fixes LP: #1333228, LP: #1442851. | ||
22 | 6 | * Make sure we resets partial text input from the input method. | ||
23 | 7 | Fixes LP: #1630872. | ||
24 | 8 | * Fix ListItem title/subtitle alignment & elide in RTL mode. | ||
25 | 9 | Fixes LP: #1665944. | ||
26 | 10 | * Fix PageHeader title alignment & elide in RTL mode. Fixes LP: #1665942. | ||
27 | 11 | * Fix UbuntuListView docs. Fixes LP: #1486940. | ||
28 | 12 | * Add count prop to OptionSelector. Fixes LP: #1341559. | ||
29 | 13 | * Replace the hardcoded color with a theme color. Fixes LP: #1664758. | ||
30 | 14 | * Fix the import statement for Menu, MenuBar and MenuGroup. | ||
31 | 15 | Fixes LP: #1660604. | ||
32 | 16 | |||
33 | 17 | [ Albert Astals Cid ] | ||
34 | 18 | * Fix memory leak in UCStyleHints | ||
35 | 19 | * ThinDivider: Anchors can't be null, set to undefined | ||
36 | 20 | * No need to call UCUnits::resolveResource to learn we just need to load it | ||
37 | 21 | normally because the fact that we already loaded it normally means we need | ||
38 | 22 | to load it normally. Fixes LP: #1558663. | ||
39 | 23 | * Fix conditional jump or move depends on uninitialised value(s) | ||
40 | 24 | |||
41 | 25 | [ Christian Dywan ] | ||
42 | 26 | * Initialize UCApplication with no side effects. Fixes LP: #1662868. | ||
43 | 27 | * Unit test case insensitive FilterBehavior.pattern. Fixes LP: #1663924. | ||
44 | 28 | * ListItemPopover delegate should (in)visible as per action Bug 1662220: | ||
45 | 29 | [ListItem] Popupmenu shows traces of disabled actions | ||
46 | 30 | |||
47 | 31 | [ Olivier Tilloy ] | ||
48 | 32 | * Check that window is not null before accessing its activeFocusItem property. | ||
49 | 33 | Fixes LP: #1664620. | ||
50 | 34 | |||
51 | 35 | [ Lukáš Tinkl ] | ||
52 | 36 | * Unbreak the startup race between unity8/qtmir and UITK trying talk to | ||
53 | 37 | content-hub. Fixes LP: #1663106. | ||
54 | 38 | |||
55 | 39 | -- Zoltán Balogh <zoltan@bakter.hu> Mon, 06 Mar 2017 17:51:04 +0200 | ||
56 | 40 | |||
57 | 1 | ubuntu-ui-toolkit (1.3.2166+17.04.20170130) zesty; urgency=medium | 41 | ubuntu-ui-toolkit (1.3.2166+17.04.20170130) zesty; urgency=medium |
58 | 2 | 42 | ||
59 | 3 | [ Andrea Bernabei ] | 43 | [ Andrea Bernabei ] |
60 | 4 | 44 | ||
61 | === modified file 'examples/ubuntu-ui-toolkit-gallery/Toggles.qml' | |||
62 | --- examples/ubuntu-ui-toolkit-gallery/Toggles.qml 2015-04-25 08:18:45 +0000 | |||
63 | +++ examples/ubuntu-ui-toolkit-gallery/Toggles.qml 2017-03-06 16:02:52 +0000 | |||
64 | @@ -55,6 +55,49 @@ | |||
65 | 55 | checked: true | 55 | checked: true |
66 | 56 | } | 56 | } |
67 | 57 | } | 57 | } |
68 | 58 | |||
69 | 59 | TemplateRow { | ||
70 | 60 | title: i18n.tr("Checkbox with label") | ||
71 | 61 | |||
72 | 62 | CheckBox { | ||
73 | 63 | objectName: "checkbox_checked_lbl" | ||
74 | 64 | checked: true | ||
75 | 65 | text: "This a checkbox label" | ||
76 | 66 | } | ||
77 | 67 | } | ||
78 | 68 | |||
79 | 69 | TemplateRow { | ||
80 | 70 | title: i18n.tr("Disabled checkbox with label") | ||
81 | 71 | |||
82 | 72 | CheckBox { | ||
83 | 73 | objectName: "checkbox_disabled_checked_lbl" | ||
84 | 74 | checked: true | ||
85 | 75 | enabled: false | ||
86 | 76 | text: "This a checkbox label" | ||
87 | 77 | } | ||
88 | 78 | } | ||
89 | 79 | |||
90 | 80 | TemplateRow { | ||
91 | 81 | title: i18n.tr("Disabled checkbox with label") | ||
92 | 82 | |||
93 | 83 | CheckBox { | ||
94 | 84 | objectName: "checkbox_disabled_checked_lbl" | ||
95 | 85 | checked: false | ||
96 | 86 | enabled: false | ||
97 | 87 | text: "This a checkbox label" | ||
98 | 88 | } | ||
99 | 89 | } | ||
100 | 90 | |||
101 | 91 | TemplateRow { | ||
102 | 92 | title: i18n.tr("Checkbox with multiline label") | ||
103 | 93 | |||
104 | 94 | CheckBox { | ||
105 | 95 | objectName: "checkbox_checked_lbl" | ||
106 | 96 | checked: true | ||
107 | 97 | text: "This is a checkbox with a built-in label spanning several lines that won't be ellipsized but increase in height instead" | ||
108 | 98 | width: parent.width | ||
109 | 99 | } | ||
110 | 100 | } | ||
111 | 58 | } | 101 | } |
112 | 59 | 102 | ||
113 | 60 | 103 | ||
114 | 61 | 104 | ||
115 | === modified file 'src/UbuntuToolkit/menu.cpp' | |||
116 | --- src/UbuntuToolkit/menu.cpp 2016-09-09 18:16:57 +0000 | |||
117 | +++ src/UbuntuToolkit/menu.cpp 2017-03-06 16:02:52 +0000 | |||
118 | @@ -303,7 +303,7 @@ | |||
119 | 303 | 303 | ||
120 | 304 | /*! | 304 | /*! |
121 | 305 | * \qmltype Menu | 305 | * \qmltype Menu |
123 | 306 | * \inqmlmodule Ubuntu.Components | 306 | * \inqmlmodule Ubuntu.Components.Labs |
124 | 307 | * \ingroup ubuntu | 307 | * \ingroup ubuntu |
125 | 308 | * \brief Menu defines a context menu or submenu structure of a MenuBar | 308 | * \brief Menu defines a context menu or submenu structure of a MenuBar |
126 | 309 | * | 309 | * |
127 | @@ -311,6 +311,7 @@ | |||
128 | 311 | * \qml | 311 | * \qml |
129 | 312 | * import QtQuick 2.4 | 312 | * import QtQuick 2.4 |
130 | 313 | * import Ubuntu.Components 1.3 | 313 | * import Ubuntu.Components 1.3 |
131 | 314 | * import Ubuntu.Components.Labs 1.0 | ||
132 | 314 | * Menu { | 315 | * Menu { |
133 | 315 | * text: "&File" | 316 | * text: "&File" |
134 | 316 | * | 317 | * |
135 | 317 | 318 | ||
136 | === modified file 'src/UbuntuToolkit/menubar.cpp' | |||
137 | --- src/UbuntuToolkit/menubar.cpp 2016-09-09 17:49:07 +0000 | |||
138 | +++ src/UbuntuToolkit/menubar.cpp 2017-03-06 16:02:52 +0000 | |||
139 | @@ -104,7 +104,7 @@ | |||
140 | 104 | 104 | ||
141 | 105 | /*! | 105 | /*! |
142 | 106 | * \qmltype MenuBar | 106 | * \qmltype MenuBar |
144 | 107 | * \inqmlmodule Ubuntu.Components 1.3 | 107 | * \inqmlmodule Ubuntu.Components.Labs |
145 | 108 | * \ingroup ubuntu | 108 | * \ingroup ubuntu |
146 | 109 | * \brief MenuBar defines an application menu bar structure | 109 | * \brief MenuBar defines an application menu bar structure |
147 | 110 | * | 110 | * |
148 | @@ -112,6 +112,7 @@ | |||
149 | 112 | * \qml | 112 | * \qml |
150 | 113 | * import QtQuick 2.4 | 113 | * import QtQuick 2.4 |
151 | 114 | * import Ubuntu.Components 1.3 | 114 | * import Ubuntu.Components 1.3 |
152 | 115 | * import Ubuntu.Components.Labs 1.0 | ||
153 | 115 | * MainView { | 116 | * MainView { |
154 | 116 | * MenuBar { | 117 | * MenuBar { |
155 | 117 | * Menu { | 118 | * Menu { |
156 | 118 | 119 | ||
157 | === modified file 'src/UbuntuToolkit/menugroup.cpp' | |||
158 | --- src/UbuntuToolkit/menugroup.cpp 2016-09-09 17:49:07 +0000 | |||
159 | +++ src/UbuntuToolkit/menugroup.cpp 2017-03-06 16:02:52 +0000 | |||
160 | @@ -23,7 +23,7 @@ | |||
161 | 23 | 23 | ||
162 | 24 | /*! | 24 | /*! |
163 | 25 | * \qmltype MenuGroup | 25 | * \qmltype MenuGroup |
165 | 26 | * \inqmlmodule Ubuntu.Components | 26 | * \inqmlmodule Ubuntu.Components.Labs |
166 | 27 | * \ingroup ubuntu | 27 | * \ingroup ubuntu |
167 | 28 | * \brief Logical list of items for a menu. | 28 | * \brief Logical list of items for a menu. |
168 | 29 | * | 29 | * |
169 | @@ -31,6 +31,7 @@ | |||
170 | 31 | * \qml | 31 | * \qml |
171 | 32 | * import QtQuick 2.4 | 32 | * import QtQuick 2.4 |
172 | 33 | * import Ubuntu.Components 1.3 | 33 | * import Ubuntu.Components 1.3 |
173 | 34 | * import Ubuntu.Components.Labs 1.0 | ||
174 | 34 | * Menu { | 35 | * Menu { |
175 | 35 | * text: "Edit" | 36 | * text: "Edit" |
176 | 36 | * | 37 | * |
177 | 37 | 38 | ||
178 | === modified file 'src/UbuntuToolkit/privates/uccontenthub.cpp' | |||
179 | --- src/UbuntuToolkit/privates/uccontenthub.cpp 2017-01-26 14:29:30 +0000 | |||
180 | +++ src/UbuntuToolkit/privates/uccontenthub.cpp 2017-03-06 16:02:52 +0000 | |||
181 | @@ -21,8 +21,10 @@ | |||
182 | 21 | #include <QtCore/QLoggingCategory> | 21 | #include <QtCore/QLoggingCategory> |
183 | 22 | #include <QtCore/QMimeData> | 22 | #include <QtCore/QMimeData> |
184 | 23 | #include <QtDBus/QDBusConnection> | 23 | #include <QtDBus/QDBusConnection> |
185 | 24 | #include <QtDBus/QDBusConnectionInterface> | ||
186 | 24 | #include <QtDBus/QDBusInterface> | 25 | #include <QtDBus/QDBusInterface> |
187 | 25 | #include <QtDBus/QDBusReply> | 26 | #include <QtDBus/QDBusReply> |
188 | 27 | #include <QtDBus/QDBusServiceWatcher> | ||
189 | 26 | #include <QtQuick/QQuickItem> | 28 | #include <QtQuick/QQuickItem> |
190 | 27 | 29 | ||
191 | 28 | Q_LOGGING_CATEGORY(ucContentHub, "ubuntu.components.UCContentHub", QtMsgType::QtWarningMsg) | 30 | Q_LOGGING_CATEGORY(ucContentHub, "ubuntu.components.UCContentHub", QtMsgType::QtWarningMsg) |
192 | @@ -40,11 +42,17 @@ | |||
193 | 40 | UT_NAMESPACE_BEGIN | 42 | UT_NAMESPACE_BEGIN |
194 | 41 | 43 | ||
195 | 42 | UCContentHub::UCContentHub(QObject *parent) | 44 | UCContentHub::UCContentHub(QObject *parent) |
201 | 43 | : QObject(parent), | 45 | : QObject(parent) |
202 | 44 | m_dbusIface(0), | 46 | { |
203 | 45 | m_contentHubIface(0), | 47 | if (QDBusConnection::sessionBus().interface()->isServiceRegistered(contentHubService)) { // content hub already running |
204 | 46 | m_canPaste(false), | 48 | init(); |
205 | 47 | m_targetItem(0) | 49 | } else { |
206 | 50 | m_watcher = new QDBusServiceWatcher(contentHubService, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration, this); | ||
207 | 51 | connect(m_watcher, &QDBusServiceWatcher::serviceRegistered, this, &UCContentHub::init); | ||
208 | 52 | } | ||
209 | 53 | } | ||
210 | 54 | |||
211 | 55 | void UCContentHub::init() | ||
212 | 48 | { | 56 | { |
213 | 49 | m_dbusIface = new QDBusInterface(dbusService, | 57 | m_dbusIface = new QDBusInterface(dbusService, |
214 | 50 | dbusObjectPath, | 58 | dbusObjectPath, |
215 | @@ -76,24 +84,13 @@ | |||
216 | 76 | SLOT(onPasteboardChanged()) | 84 | SLOT(onPasteboardChanged()) |
217 | 77 | ); | 85 | ); |
218 | 78 | 86 | ||
231 | 79 | m_canPaste = checkPasteFormats(); | 87 | onPasteboardChanged(); |
220 | 80 | } | ||
221 | 81 | } | ||
222 | 82 | |||
223 | 83 | UCContentHub::~UCContentHub() | ||
224 | 84 | { | ||
225 | 85 | if (m_dbusIface) { | ||
226 | 86 | delete m_dbusIface; | ||
227 | 87 | } | ||
228 | 88 | |||
229 | 89 | if (m_contentHubIface) { | ||
230 | 90 | delete m_contentHubIface; | ||
232 | 91 | } | 88 | } |
233 | 92 | } | 89 | } |
234 | 93 | 90 | ||
235 | 94 | void UCContentHub::requestPaste(QQuickItem *targetItem) | 91 | void UCContentHub::requestPaste(QQuickItem *targetItem) |
236 | 95 | { | 92 | { |
238 | 96 | if (!m_contentHubIface->isValid()) { | 93 | if (!m_contentHubIface || !m_contentHubIface->isValid()) { |
239 | 97 | CONTENT_HUB_TRACE("Invalid Content Hub DBusInterface"); | 94 | CONTENT_HUB_TRACE("Invalid Content Hub DBusInterface"); |
240 | 98 | return; | 95 | return; |
241 | 99 | } | 96 | } |
242 | @@ -106,12 +103,12 @@ | |||
243 | 106 | m_contentHubIface->call(QStringLiteral("RequestPasteByAppId"), appProfile); | 103 | m_contentHubIface->call(QStringLiteral("RequestPasteByAppId"), appProfile); |
244 | 107 | } | 104 | } |
245 | 108 | 105 | ||
247 | 109 | bool UCContentHub::canPaste() | 106 | bool UCContentHub::canPaste() const |
248 | 110 | { | 107 | { |
249 | 111 | return m_canPaste; | 108 | return m_canPaste; |
250 | 112 | } | 109 | } |
251 | 113 | 110 | ||
253 | 114 | void UCContentHub::onPasteSelected(QString appId, QByteArray mimedata, bool pasteAsRichText) | 111 | void UCContentHub::onPasteSelected(const QString &appId, const QByteArray &mimedata, bool pasteAsRichText) |
254 | 115 | { | 112 | { |
255 | 116 | if (getAppProfile() != appId) { | 113 | if (getAppProfile() != appId) { |
256 | 117 | return; | 114 | return; |
257 | @@ -138,15 +135,39 @@ | |||
258 | 138 | 135 | ||
259 | 139 | void UCContentHub::onPasteboardChanged() | 136 | void UCContentHub::onPasteboardChanged() |
260 | 140 | { | 137 | { |
263 | 141 | if (checkPasteFormats() != m_canPaste) { | 138 | if (!m_contentHubIface || !m_contentHubIface->isValid()) { |
264 | 142 | m_canPaste = !m_canPaste; | 139 | CONTENT_HUB_TRACE("Invalid Content Hub DBusInterface"); |
265 | 140 | return; | ||
266 | 141 | } | ||
267 | 142 | |||
268 | 143 | QDBusPendingCall pcall = m_contentHubIface->asyncCall(QStringLiteral("PasteFormats")); | ||
269 | 144 | QDBusPendingCallWatcher * watcher = new QDBusPendingCallWatcher(pcall, this); | ||
270 | 145 | connect(watcher, &QDBusPendingCallWatcher::finished, [this](QDBusPendingCallWatcher * call) { | ||
271 | 146 | QDBusPendingReply<QStringList> reply = *call; | ||
272 | 147 | call->deleteLater(); | ||
273 | 148 | if (reply.isValid()) { | ||
274 | 149 | // TODO: ContentHub clipboard keeps a list of all available paste formats. | ||
275 | 150 | // Probably apps could make use of this information to check if a specific | ||
276 | 151 | // data type is available, instead of only checking if list is empty or not. | ||
277 | 152 | // (LP: #1657111) | ||
278 | 153 | setCanPaste(!reply.value().isEmpty()); | ||
279 | 154 | } else { | ||
280 | 155 | CONTENT_HUB_TRACE("Invalid return from DBus call PasteFormats"); | ||
281 | 156 | } | ||
282 | 157 | }); | ||
283 | 158 | } | ||
284 | 159 | |||
285 | 160 | void UCContentHub::setCanPaste(bool value) | ||
286 | 161 | { | ||
287 | 162 | if (value != m_canPaste) { | ||
288 | 163 | m_canPaste = value; | ||
289 | 143 | Q_EMIT canPasteChanged(); | 164 | Q_EMIT canPasteChanged(); |
290 | 144 | } | 165 | } |
291 | 145 | } | 166 | } |
292 | 146 | 167 | ||
294 | 147 | QString UCContentHub::getAppProfile() | 168 | QString UCContentHub::getAppProfile() const |
295 | 148 | { | 169 | { |
297 | 149 | if (!m_dbusIface->isValid()) { | 170 | if (!m_dbusIface || !m_dbusIface->isValid()) { |
298 | 150 | CONTENT_HUB_TRACE("Invalid DBus DBusInterface"); | 171 | CONTENT_HUB_TRACE("Invalid DBus DBusInterface"); |
299 | 151 | return QString(); | 172 | return QString(); |
300 | 152 | } | 173 | } |
301 | @@ -194,25 +215,4 @@ | |||
302 | 194 | return mimeData; | 215 | return mimeData; |
303 | 195 | } | 216 | } |
304 | 196 | 217 | ||
305 | 197 | bool UCContentHub::checkPasteFormats() | ||
306 | 198 | { | ||
307 | 199 | if (!m_contentHubIface->isValid()) { | ||
308 | 200 | CONTENT_HUB_TRACE("Invalid Content Hub DBusInterface"); | ||
309 | 201 | return false; | ||
310 | 202 | } | ||
311 | 203 | |||
312 | 204 | QDBusReply<QStringList> reply = m_contentHubIface->call(QStringLiteral("PasteFormats")); | ||
313 | 205 | if (reply.isValid()) { | ||
314 | 206 | // TODO: ContentHub clipboard keeps a list of all available paste formats. | ||
315 | 207 | // Probably apps could make use of this information to check if a specific | ||
316 | 208 | // data type is available, instead of only checking if list is empty or not. | ||
317 | 209 | // (LP: #1657111) | ||
318 | 210 | return !reply.value().isEmpty(); | ||
319 | 211 | } else { | ||
320 | 212 | CONTENT_HUB_TRACE("Invalid return from DBus call PasteFormats"); | ||
321 | 213 | } | ||
322 | 214 | |||
323 | 215 | return false; | ||
324 | 216 | } | ||
325 | 217 | |||
326 | 218 | UT_NAMESPACE_END | 218 | UT_NAMESPACE_END |
327 | 219 | 219 | ||
328 | === modified file 'src/UbuntuToolkit/privates/uccontenthub_p.h' | |||
329 | --- src/UbuntuToolkit/privates/uccontenthub_p.h 2017-01-17 19:30:01 +0000 | |||
330 | +++ src/UbuntuToolkit/privates/uccontenthub_p.h 2017-03-06 16:02:52 +0000 | |||
331 | @@ -25,6 +25,7 @@ | |||
332 | 25 | 25 | ||
333 | 26 | class QMimeData; | 26 | class QMimeData; |
334 | 27 | class QDBusInterface; | 27 | class QDBusInterface; |
335 | 28 | class QDBusServiceWatcher; | ||
336 | 28 | class QQuickItem; | 29 | class QQuickItem; |
337 | 29 | 30 | ||
338 | 30 | UT_NAMESPACE_BEGIN | 31 | UT_NAMESPACE_BEGIN |
339 | @@ -32,35 +33,37 @@ | |||
340 | 32 | class UBUNTUTOOLKIT_EXPORT UCContentHub : public QObject | 33 | class UBUNTUTOOLKIT_EXPORT UCContentHub : public QObject |
341 | 33 | { | 34 | { |
342 | 34 | Q_OBJECT | 35 | Q_OBJECT |
344 | 35 | 36 | friend class tst_UCContentHub; | |
345 | 36 | Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged) | 37 | Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged) |
346 | 37 | 38 | ||
347 | 38 | public: | 39 | public: |
350 | 39 | UCContentHub(QObject* parent = 0); | 40 | UCContentHub(QObject* parent = nullptr); |
351 | 40 | ~UCContentHub(); | 41 | ~UCContentHub() = default; |
352 | 41 | 42 | ||
353 | 42 | Q_INVOKABLE void requestPaste(QQuickItem *targetItem); | 43 | Q_INVOKABLE void requestPaste(QQuickItem *targetItem); |
354 | 43 | 44 | ||
357 | 44 | bool canPaste(); | 45 | bool canPaste() const; |
358 | 45 | QString getAppProfile(); | 46 | QString getAppProfile() const; |
359 | 46 | QMimeData* deserializeMimeData(const QByteArray &serializedMimeData); | 47 | QMimeData* deserializeMimeData(const QByteArray &serializedMimeData); |
360 | 47 | 48 | ||
361 | 48 | Q_SIGNALS: | 49 | Q_SIGNALS: |
362 | 49 | void pasteSelected(QQuickItem *targetItem, const QString &data); | 50 | void pasteSelected(QQuickItem *targetItem, const QString &data); |
363 | 50 | void canPasteChanged(); | 51 | void canPasteChanged(); |
364 | 51 | 52 | ||
367 | 52 | public Q_SLOTS: | 53 | private Q_SLOTS: |
368 | 53 | void onPasteSelected(QString appId, QByteArray mimedata, bool pasteAsRichText); | 54 | void init(); |
369 | 55 | void onPasteSelected(const QString &appId, const QByteArray &mimedata, bool pasteAsRichText); | ||
370 | 54 | void onPasteboardChanged(); | 56 | void onPasteboardChanged(); |
371 | 55 | 57 | ||
372 | 56 | private: | 58 | private: |
380 | 57 | bool checkPasteFormats(); | 59 | void setCanPaste(bool value); |
381 | 58 | 60 | QDBusInterface *m_dbusIface{nullptr}; | |
382 | 59 | QDBusInterface *m_dbusIface; | 61 | QDBusInterface *m_contentHubIface{nullptr}; |
383 | 60 | QDBusInterface *m_contentHubIface; | 62 | |
384 | 61 | 63 | bool m_canPaste{false}; | |
385 | 62 | bool m_canPaste; | 64 | QQuickItem *m_targetItem{nullptr}; |
386 | 63 | QQuickItem *m_targetItem; | 65 | |
387 | 66 | QDBusServiceWatcher * m_watcher{nullptr}; | ||
388 | 64 | }; | 67 | }; |
389 | 65 | 68 | ||
390 | 66 | UT_NAMESPACE_END | 69 | UT_NAMESPACE_END |
391 | 67 | 70 | ||
392 | === modified file 'src/UbuntuToolkit/sortfiltermodel.cpp' | |||
393 | --- src/UbuntuToolkit/sortfiltermodel.cpp 2016-09-12 09:03:50 +0000 | |||
394 | +++ src/UbuntuToolkit/sortfiltermodel.cpp 2017-03-06 16:02:52 +0000 | |||
395 | @@ -52,7 +52,8 @@ | |||
396 | 52 | * } | 52 | * } |
397 | 53 | * ListElement { | 53 | * ListElement { |
398 | 54 | * title: "Elephants Dream" | 54 | * title: "Elephants Dream" |
400 | 55 | * producer: "Blender" | 55 | * // lowercase b |
401 | 56 | * producer: "blender" | ||
402 | 56 | * } | 57 | * } |
403 | 57 | * ListElement { | 58 | * ListElement { |
404 | 58 | * title: "Big Buck Bunny" | 59 | * title: "Big Buck Bunny" |
405 | @@ -69,7 +70,8 @@ | |||
406 | 69 | * sortCaseSensitivity: Qt.CaseInsensitive | 70 | * sortCaseSensitivity: Qt.CaseInsensitive |
407 | 70 | * | 71 | * |
408 | 71 | * filter.property: "producer" | 72 | * filter.property: "producer" |
410 | 72 | * filter.pattern: /blender/ | 73 | * // case insensitive matches |
411 | 74 | * filter.pattern: /blender/i | ||
412 | 73 | * } | 75 | * } |
413 | 74 | * | 76 | * |
414 | 75 | * ListView { | 77 | * ListView { |
415 | @@ -154,6 +156,7 @@ | |||
416 | 154 | * \li /possible/ matches anywhere in a word, so both "impossible" and "possible". | 156 | * \li /possible/ matches anywhere in a word, so both "impossible" and "possible". |
417 | 155 | * \li /^sign/ matches "sign". But not "assignment" because ^ means start. | 157 | * \li /^sign/ matches "sign". But not "assignment" because ^ means start. |
418 | 156 | * \li /vest$/ matches "safety vest" and "vest" but not "vested". | 158 | * \li /vest$/ matches "safety vest" and "vest" but not "vested". |
419 | 159 | * \li /bar/i matches "bar", "Bar" or "BAR" regardless of case. | ||
420 | 157 | * \endlist | 160 | * \endlist |
421 | 158 | * | 161 | * |
422 | 159 | * For more advanced uses it's recommended to read up on Javascript regular expressions. | 162 | * For more advanced uses it's recommended to read up on Javascript regular expressions. |
423 | 160 | 163 | ||
424 | === modified file 'src/UbuntuToolkit/ucapplication.cpp' | |||
425 | --- src/UbuntuToolkit/ucapplication.cpp 2017-01-12 15:20:31 +0000 | |||
426 | +++ src/UbuntuToolkit/ucapplication.cpp 2017-03-06 16:02:52 +0000 | |||
427 | @@ -39,8 +39,6 @@ | |||
428 | 39 | UCApplication::UCApplication(QObject* parent) : QObject(parent), m_context(0) | 39 | UCApplication::UCApplication(QObject* parent) : QObject(parent), m_context(0) |
429 | 40 | , m_inputMethod(QGuiApplication::inputMethod()) | 40 | , m_inputMethod(QGuiApplication::inputMethod()) |
430 | 41 | { | 41 | { |
431 | 42 | // Unset organization by default to skip an extra folder component | ||
432 | 43 | QCoreApplication::setOrganizationName(QStringLiteral("")); | ||
433 | 44 | // Make sure we receive application name changes from C++ modules | 42 | // Make sure we receive application name changes from C++ modules |
434 | 45 | connect(QCoreApplication::instance(), &QCoreApplication::applicationNameChanged, | 43 | connect(QCoreApplication::instance(), &QCoreApplication::applicationNameChanged, |
435 | 46 | this, &UCApplication::applicationNameChanged); | 44 | this, &UCApplication::applicationNameChanged); |
436 | @@ -70,7 +68,6 @@ | |||
437 | 70 | to how Unity uses it to distinguish running applications. | 68 | to how Unity uses it to distinguish running applications. |
438 | 71 | */ | 69 | */ |
439 | 72 | QCoreApplication::setApplicationName(applicationName); | 70 | QCoreApplication::setApplicationName(applicationName); |
440 | 73 | QCoreApplication::setOrganizationName(QCoreApplication::organizationName()); | ||
441 | 74 | /* | 71 | /* |
442 | 75 | Ensure that LocalStorage and WebKit use the same location | 72 | Ensure that LocalStorage and WebKit use the same location |
443 | 76 | Docs are ambiguous: in practise applicationName is ignored by default | 73 | Docs are ambiguous: in practise applicationName is ignored by default |
444 | 77 | 74 | ||
445 | === modified file 'src/UbuntuToolkit/ucmainwindow.cpp' | |||
446 | --- src/UbuntuToolkit/ucmainwindow.cpp 2017-01-18 17:23:48 +0000 | |||
447 | +++ src/UbuntuToolkit/ucmainwindow.cpp 2017-03-06 16:02:52 +0000 | |||
448 | @@ -163,11 +163,7 @@ | |||
449 | 163 | return; | 163 | return; |
450 | 164 | 164 | ||
451 | 165 | d->m_applicationName = applicationName; | 165 | d->m_applicationName = applicationName; |
457 | 166 | 166 | updateApplication(applicationName, d->m_organizationName); | |
453 | 167 | if (applicationName != QStringLiteral("")) { | ||
454 | 168 | UbuntuI18n::instance()->setDomain(applicationName); | ||
455 | 169 | UCApplication::instance()->setApplicationName(applicationName); | ||
456 | 170 | } | ||
458 | 171 | Q_EMIT applicationNameChanged(applicationName); | 167 | Q_EMIT applicationNameChanged(applicationName); |
459 | 172 | } | 168 | } |
460 | 173 | 169 | ||
461 | @@ -192,11 +188,17 @@ | |||
462 | 192 | return; | 188 | return; |
463 | 193 | 189 | ||
464 | 194 | d->m_organizationName = organizationName; | 190 | d->m_organizationName = organizationName; |
465 | 191 | updateApplication(d->m_applicationName, organizationName); | ||
466 | 192 | Q_EMIT organizationNameChanged(organizationName); | ||
467 | 193 | } | ||
468 | 195 | 194 | ||
470 | 196 | if (organizationName != QStringLiteral("")) { | 195 | void UCMainWindow::updateApplication(QString applicationName, QString organizationName) |
471 | 196 | { | ||
472 | 197 | if (applicationName != QStringLiteral("")) { | ||
473 | 198 | UbuntuI18n::instance()->setDomain(applicationName); | ||
474 | 197 | QCoreApplication::setOrganizationName(organizationName); | 199 | QCoreApplication::setOrganizationName(organizationName); |
475 | 200 | UCApplication::instance()->setApplicationName(applicationName); | ||
476 | 198 | } | 201 | } |
477 | 199 | Q_EMIT organizationNameChanged(organizationName); | ||
478 | 200 | } | 202 | } |
479 | 201 | 203 | ||
480 | 202 | /*! | 204 | /*! |
481 | 203 | 205 | ||
482 | === modified file 'src/UbuntuToolkit/ucmainwindow_p.h' | |||
483 | --- src/UbuntuToolkit/ucmainwindow_p.h 2017-01-16 16:52:57 +0000 | |||
484 | +++ src/UbuntuToolkit/ucmainwindow_p.h 2017-03-06 16:02:52 +0000 | |||
485 | @@ -76,6 +76,8 @@ | |||
486 | 76 | #endif | 76 | #endif |
487 | 77 | 77 | ||
488 | 78 | private: | 78 | private: |
489 | 79 | void updateApplication(QString applicationName, QString organizationName); | ||
490 | 80 | |||
491 | 79 | Q_DECLARE_PRIVATE(UCMainWindow) | 81 | Q_DECLARE_PRIVATE(UCMainWindow) |
492 | 80 | }; | 82 | }; |
493 | 81 | 83 | ||
494 | 82 | 84 | ||
495 | === modified file 'src/UbuntuToolkit/ucqquickimageextension.cpp' | |||
496 | --- src/UbuntuToolkit/ucqquickimageextension.cpp 2016-09-12 09:03:50 +0000 | |||
497 | +++ src/UbuntuToolkit/ucqquickimageextension.cpp 2017-03-06 16:02:52 +0000 | |||
498 | @@ -22,7 +22,13 @@ | |||
499 | 22 | #include <QtCore/QFile> | 22 | #include <QtCore/QFile> |
500 | 23 | #include <QtCore/QFileInfo> | 23 | #include <QtCore/QFileInfo> |
501 | 24 | #include <QtGui/QGuiApplication> | 24 | #include <QtGui/QGuiApplication> |
502 | 25 | #include <QtQuick/private/qquickitem_p.h> | ||
503 | 25 | #include <QtQuick/private/qquickimagebase_p.h> | 26 | #include <QtQuick/private/qquickimagebase_p.h> |
504 | 27 | #include <QtQuick/private/qquickpixmapcache_p.h> | ||
505 | 28 | |||
506 | 29 | #define foreach Q_FOREACH | ||
507 | 30 | #include <QtQml/private/qqmlengine_p.h> | ||
508 | 31 | #undef foreach | ||
509 | 26 | 32 | ||
510 | 27 | #include "ucunits_p.h" | 33 | #include "ucunits_p.h" |
511 | 28 | 34 | ||
512 | @@ -61,11 +67,35 @@ | |||
513 | 61 | return m_source; | 67 | return m_source; |
514 | 62 | } | 68 | } |
515 | 63 | 69 | ||
516 | 70 | |||
517 | 64 | void UCQQuickImageExtension::setSource(const QUrl& url) | 71 | void UCQQuickImageExtension::setSource(const QUrl& url) |
518 | 65 | { | 72 | { |
519 | 66 | if (url != m_source) { | 73 | if (url != m_source) { |
520 | 67 | m_source = url; | 74 | m_source = url; |
522 | 68 | reloadSource(); | 75 | // We need to wait until the component is complete |
523 | 76 | // so that m_image->sourceSize() is actually valid | ||
524 | 77 | if (QQuickItemPrivate::get(m_image)->componentComplete) { | ||
525 | 78 | reloadSource(); | ||
526 | 79 | } else { | ||
527 | 80 | // This is a bit convoluted but i couldn't find a better way to get notified of when | ||
528 | 81 | // the image actually finishes constructing. | ||
529 | 82 | // Since what we're interested in reloadSource() is the image having the sourceSize set, | ||
530 | 83 | // what we do is connect to the sourceSizeChanged signal. | ||
531 | 84 | // The problem is that this signal isn't fired if the Image {} doesn't have sourceSize set | ||
532 | 85 | // so we tell the engine to fire the sourceSizeChanged signal when the image finishes constructing | ||
533 | 86 | // This way if the Image {} has a sourceSize set the lambda gets called because of it | ||
534 | 87 | // and if there's no sourceSize set the lambda gets called because we registered the finalize callback | ||
535 | 88 | |||
536 | 89 | connect(m_image, &QQuickImageBase::sourceSizeChanged, | ||
537 | 90 | this, | ||
538 | 91 | [&] { | ||
539 | 92 | QObject::disconnect(m_image, &QQuickImageBase::sourceSizeChanged, this, nullptr); | ||
540 | 93 | reloadSource(); | ||
541 | 94 | }); | ||
542 | 95 | |||
543 | 96 | QQmlEnginePrivate *engPriv = QQmlEnginePrivate::get(qmlEngine(m_image)); | ||
544 | 97 | engPriv->registerFinalizeCallback(m_image, m_image->metaObject()->indexOfSignal("sourceSizeChanged()")); | ||
545 | 98 | } | ||
546 | 69 | } | 99 | } |
547 | 70 | } | 100 | } |
548 | 71 | 101 | ||
549 | @@ -80,6 +110,25 @@ | |||
550 | 80 | return; | 110 | return; |
551 | 81 | } | 111 | } |
552 | 82 | 112 | ||
553 | 113 | // If the url we're trying to load is already in the cache and | ||
554 | 114 | // the devicePixelRatio is 1, we save calling UCUnits::resolveResource | ||
555 | 115 | // and just set that image directly. | ||
556 | 116 | // UCUnits::resolveResource is not cheap (does a stat on disk) | ||
557 | 117 | if (qFuzzyCompare(qGuiApp->devicePixelRatio(), (qreal)1.0)) { | ||
558 | 118 | QSize ss = m_image->sourceSize(); | ||
559 | 119 | if (ss.isNull() && m_image->image().isNull()) { | ||
560 | 120 | // For some reason QQuickImage returns 0x0 as sourceSize | ||
561 | 121 | // when the sourceSize is not set (and the image has not yet been loaded) | ||
562 | 122 | // so set it back to -1x-1 | ||
563 | 123 | ss = QSize(-1, -1); | ||
564 | 124 | } | ||
565 | 125 | |||
566 | 126 | if (QQuickPixmap::isCached(m_source, ss)) { | ||
567 | 127 | m_image->setSource(m_source); | ||
568 | 128 | return; | ||
569 | 129 | } | ||
570 | 130 | } | ||
571 | 131 | |||
572 | 83 | QString resolved = UCUnits::instance()->resolveResource(m_source); | 132 | QString resolved = UCUnits::instance()->resolveResource(m_source); |
573 | 84 | 133 | ||
574 | 85 | if (resolved.isEmpty()) { | 134 | if (resolved.isEmpty()) { |
575 | @@ -98,7 +147,9 @@ | |||
576 | 98 | || selectedFilePath.endsWith(QStringLiteral(".svgz"))) { | 147 | || selectedFilePath.endsWith(QStringLiteral(".svgz"))) { |
577 | 99 | // Take care to pass the original fragment | 148 | // Take care to pass the original fragment |
578 | 100 | QUrl selectedFileUrl(QUrl::fromLocalFile(selectedFilePath)); | 149 | QUrl selectedFileUrl(QUrl::fromLocalFile(selectedFilePath)); |
580 | 101 | selectedFileUrl.setFragment(fragment); | 150 | if (m_source.hasFragment()) { |
581 | 151 | selectedFileUrl.setFragment(fragment); | ||
582 | 152 | } | ||
583 | 102 | m_image->setSource(selectedFileUrl); | 153 | m_image->setSource(selectedFileUrl); |
584 | 103 | } else { | 154 | } else { |
585 | 104 | // Need to scale the pixel-based image to suit the devicePixelRatio setting ourselves. | 155 | // Need to scale the pixel-based image to suit the devicePixelRatio setting ourselves. |
586 | 105 | 156 | ||
587 | === modified file 'src/UbuntuToolkit/ucqquickimageextension_p.h' | |||
588 | --- src/UbuntuToolkit/ucqquickimageextension_p.h 2016-09-09 17:49:07 +0000 | |||
589 | +++ src/UbuntuToolkit/ucqquickimageextension_p.h 2017-03-06 16:02:52 +0000 | |||
590 | @@ -19,6 +19,7 @@ | |||
591 | 19 | #ifndef UCQQUICKIMAGEEXTENSION_P_H | 19 | #ifndef UCQQUICKIMAGEEXTENSION_P_H |
592 | 20 | #define UCQQUICKIMAGEEXTENSION_P_H | 20 | #define UCQQUICKIMAGEEXTENSION_P_H |
593 | 21 | 21 | ||
594 | 22 | #include <QtCore/QEvent> | ||
595 | 22 | #include <QtCore/QByteArray> | 23 | #include <QtCore/QByteArray> |
596 | 23 | #include <QtCore/QObject> | 24 | #include <QtCore/QObject> |
597 | 24 | #include <QtCore/QSharedPointer> | 25 | #include <QtCore/QSharedPointer> |
598 | 25 | 26 | ||
599 | === modified file 'src/UbuntuToolkit/ucslotslayout.cpp' | |||
600 | --- src/UbuntuToolkit/ucslotslayout.cpp 2016-10-07 14:33:47 +0000 | |||
601 | +++ src/UbuntuToolkit/ucslotslayout.cpp 2017-03-06 16:02:52 +0000 | |||
602 | @@ -32,6 +32,7 @@ | |||
603 | 32 | : QQuickItemPrivate() | 32 | : QQuickItemPrivate() |
604 | 33 | , mainSlot(Q_NULLPTR) | 33 | , mainSlot(Q_NULLPTR) |
605 | 34 | , m_parentItem(Q_NULLPTR) | 34 | , m_parentItem(Q_NULLPTR) |
606 | 35 | , mainSlotHeight(0) | ||
607 | 35 | , maxSlotsHeight(0) | 36 | , maxSlotsHeight(0) |
608 | 36 | , _q_cachedHeight(-1) | 37 | , _q_cachedHeight(-1) |
609 | 37 | , maxNumberOfLeadingSlots(1) | 38 | , maxNumberOfLeadingSlots(1) |
610 | 38 | 39 | ||
611 | === modified file 'src/UbuntuToolkit/ucstylehints.cpp' | |||
612 | --- src/UbuntuToolkit/ucstylehints.cpp 2016-09-12 09:03:50 +0000 | |||
613 | +++ src/UbuntuToolkit/ucstylehints.cpp 2017-03-06 16:02:52 +0000 | |||
614 | @@ -273,6 +273,7 @@ | |||
615 | 273 | 273 | ||
616 | 274 | newBinding->setTarget(change->property()); | 274 | newBinding->setTarget(change->property()); |
617 | 275 | PropertyChange::setBinding(change, newBinding); | 275 | PropertyChange::setBinding(change, newBinding); |
618 | 276 | m_propertyBackup << change; | ||
619 | 276 | } | 277 | } |
620 | 277 | } | 278 | } |
621 | 278 | 279 | ||
622 | 279 | 280 | ||
623 | === modified file 'src/imports/Components/1.3/ListItemPopover.qml' | |||
624 | --- src/imports/Components/1.3/ListItemPopover.qml 2015-07-01 12:06:34 +0000 | |||
625 | +++ src/imports/Components/1.3/ListItemPopover.qml 2017-03-06 16:02:52 +0000 | |||
626 | @@ -24,6 +24,7 @@ | |||
627 | 24 | contentWidth: units.gu(25) | 24 | contentWidth: units.gu(25) |
628 | 25 | 25 | ||
629 | 26 | delegate: ListItem { | 26 | delegate: ListItem { |
630 | 27 | visible: action.visible | ||
631 | 27 | contentItem.anchors { | 28 | contentItem.anchors { |
632 | 28 | leftMargin: units.gu(2) | 29 | leftMargin: units.gu(2) |
633 | 29 | rightMargin: units.gu(2) | 30 | rightMargin: units.gu(2) |
634 | @@ -35,7 +36,7 @@ | |||
635 | 35 | Label { | 36 | Label { |
636 | 36 | anchors.verticalCenter: parent.verticalCenter | 37 | anchors.verticalCenter: parent.verticalCenter |
637 | 37 | text: action.text | 38 | text: action.text |
639 | 38 | color: '#5D5D5D' | 39 | color: theme.palette.normal.backgroundText |
640 | 39 | } | 40 | } |
641 | 40 | 41 | ||
642 | 41 | onClicked: popover.hide() | 42 | onClicked: popover.hide() |
643 | 42 | 43 | ||
644 | === modified file 'src/imports/Components/1.3/OptionSelector.qml' | |||
645 | --- src/imports/Components/1.3/OptionSelector.qml 2016-08-22 10:18:57 +0000 | |||
646 | +++ src/imports/Components/1.3/OptionSelector.qml 2017-03-06 16:02:52 +0000 | |||
647 | @@ -155,6 +155,12 @@ | |||
648 | 155 | } | 155 | } |
649 | 156 | 156 | ||
650 | 157 | /*! | 157 | /*! |
651 | 158 | \qmlproperty int count | ||
652 | 159 | This property holds the number of items in the OptionSelector. | ||
653 | 160 | */ | ||
654 | 161 | property alias count: list.count | ||
655 | 162 | |||
656 | 163 | /*! | ||
657 | 158 | \qmlproperty int selectedIndex | 164 | \qmlproperty int selectedIndex |
658 | 159 | The index of the currently selected element in our list. | 165 | The index of the currently selected element in our list. |
659 | 160 | */ | 166 | */ |
660 | 161 | 167 | ||
661 | === modified file 'src/imports/Components/1.3/TextField.qml' | |||
662 | --- src/imports/Components/1.3/TextField.qml 2017-01-18 13:00:07 +0000 | |||
663 | +++ src/imports/Components/1.3/TextField.qml 2017-03-06 16:02:52 +0000 | |||
664 | @@ -988,7 +988,12 @@ | |||
665 | 988 | name: control.hasClearButton && !control.readOnly ? "edit-clear" : "" | 988 | name: control.hasClearButton && !control.readOnly ? "edit-clear" : "" |
666 | 989 | } | 989 | } |
667 | 990 | 990 | ||
669 | 991 | onClicked: editor.text = "" | 991 | onClicked: { |
670 | 992 | //FIXME: Invoke editor.clear() once the SDK moves to Qt 5.7 | ||
671 | 993 | // http://doc.qt.io/qt-5/qml-qtquick-textinput.html#clear-method | ||
672 | 994 | editor.text = ""; | ||
673 | 995 | Qt.inputMethod.reset(); | ||
674 | 996 | } | ||
675 | 992 | } | 997 | } |
676 | 993 | 998 | ||
677 | 994 | // hint text | 999 | // hint text |
678 | 995 | 1000 | ||
679 | === modified file 'src/imports/Components/1.3/UbuntuListView.qml' | |||
680 | --- src/imports/Components/1.3/UbuntuListView.qml 2016-10-06 15:02:31 +0000 | |||
681 | +++ src/imports/Components/1.3/UbuntuListView.qml 2017-03-06 16:02:52 +0000 | |||
682 | @@ -79,6 +79,7 @@ | |||
683 | 79 | 79 | ||
684 | 80 | \qml | 80 | \qml |
685 | 81 | import QtQuick 2.4 | 81 | import QtQuick 2.4 |
686 | 82 | import QtQuick.XmlListModel 2.0 | ||
687 | 82 | import Ubuntu.Components 1.3 | 83 | import Ubuntu.Components 1.3 |
688 | 83 | 84 | ||
689 | 84 | UbuntuListView { | 85 | UbuntuListView { |
690 | 85 | 86 | ||
691 | === modified file 'src/imports/Components/ListItems/1.3/LabelVisual.qml' | |||
692 | --- src/imports/Components/ListItems/1.3/LabelVisual.qml 2016-01-27 13:58:29 +0000 | |||
693 | +++ src/imports/Components/ListItems/1.3/LabelVisual.qml 2017-03-06 16:02:52 +0000 | |||
694 | @@ -30,7 +30,8 @@ | |||
695 | 30 | return item.parent.hasOwnProperty("pointerTarget") || label.isInsideOverlay(item.parent) | 30 | return item.parent.hasOwnProperty("pointerTarget") || label.isInsideOverlay(item.parent) |
696 | 31 | } | 31 | } |
697 | 32 | 32 | ||
699 | 33 | elide: Text.ElideRight | 33 | horizontalAlignment: Qt.application.layoutDirection == Qt.RightToLeft ? Text.AlignRight: Text.AlignLeft |
700 | 34 | elide: Qt.application.layoutDirection == Qt.RightToLeft ? Text.ElideLeft: Text.ElideRight | ||
701 | 34 | color: selected | 35 | color: selected |
702 | 35 | ? theme.palette.selected.backgroundText | 36 | ? theme.palette.selected.backgroundText |
703 | 36 | : (secondary | 37 | : (secondary |
704 | 37 | 38 | ||
705 | === modified file 'src/imports/Components/ListItems/1.3/ThinDivider.qml' | |||
706 | --- src/imports/Components/ListItems/1.3/ThinDivider.qml 2015-07-05 21:04:55 +0000 | |||
707 | +++ src/imports/Components/ListItems/1.3/ThinDivider.qml 2017-03-06 16:02:52 +0000 | |||
708 | @@ -47,8 +47,8 @@ | |||
709 | 47 | */ | 47 | */ |
710 | 48 | Rectangle { | 48 | Rectangle { |
711 | 49 | anchors { | 49 | anchors { |
714 | 50 | left: (parent) ? parent.left : null | 50 | left: (parent) ? parent.left : undefined |
715 | 51 | right: (parent) ? parent.right : null | 51 | right: (parent) ? parent.right : undefined |
716 | 52 | } | 52 | } |
717 | 53 | height: (visible) ? units.dp(2) : 0 | 53 | height: (visible) ? units.dp(2) : 0 |
718 | 54 | // a private property to catch theme background color change | 54 | // a private property to catch theme background color change |
719 | 55 | 55 | ||
720 | === modified file 'src/imports/Components/Popups/1.3/popupUtils.js' | |||
721 | --- src/imports/Components/Popups/1.3/popupUtils.js 2017-01-16 17:03:26 +0000 | |||
722 | +++ src/imports/Components/Popups/1.3/popupUtils.js 2017-03-06 16:02:52 +0000 | |||
723 | @@ -72,7 +72,7 @@ | |||
724 | 72 | 72 | ||
725 | 73 | var popupObject; | 73 | var popupObject; |
726 | 74 | // If there's an active item, save it so we can restore it later | 74 | // If there's an active item, save it so we can restore it later |
728 | 75 | var prevFocusItem = (typeof window !== "undefined") ? window.activeFocusItem : null; | 75 | var prevFocusItem = (typeof window !== "undefined") && window ? window.activeFocusItem : null; |
729 | 76 | if (params !== undefined) { | 76 | if (params !== undefined) { |
730 | 77 | popupObject = popupComponent.createObject(rootObject, params); | 77 | popupObject = popupComponent.createObject(rootObject, params); |
731 | 78 | } else { | 78 | } else { |
732 | 79 | 79 | ||
733 | === modified file 'src/imports/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml' | |||
734 | --- src/imports/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml 2016-01-27 15:17:56 +0000 | |||
735 | +++ src/imports/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml 2017-03-06 16:02:52 +0000 | |||
736 | @@ -57,7 +57,7 @@ | |||
737 | 57 | property real iconPadding: units.gu(0.4) | 57 | property real iconPadding: units.gu(0.4) |
738 | 58 | 58 | ||
739 | 59 | implicitWidth: units.gu(2) | 59 | implicitWidth: units.gu(2) |
741 | 60 | implicitHeight: units.gu(2) | 60 | implicitHeight: Math.max(checkBoxLbl.contentHeight, units.gu(2)) |
742 | 61 | 61 | ||
743 | 62 | FocusShape { | 62 | FocusShape { |
744 | 63 | } | 63 | } |
745 | @@ -65,10 +65,12 @@ | |||
746 | 65 | UbuntuShape { | 65 | UbuntuShape { |
747 | 66 | id: background | 66 | id: background |
748 | 67 | anchors { | 67 | anchors { |
749 | 68 | fill: parent | ||
750 | 69 | margins: checkBoxStyle.backgroundPadding | 68 | margins: checkBoxStyle.backgroundPadding |
751 | 70 | } | 69 | } |
753 | 71 | property real iconSize: Math.min(width, height) - 2*checkBoxStyle.iconPadding | 70 | width: units.gu(2) |
754 | 71 | height: units.gu(2) | ||
755 | 72 | |||
756 | 73 | property real iconSize: units.gu(2) - 2*checkBoxStyle.iconPadding | ||
757 | 72 | 74 | ||
758 | 73 | Icon { | 75 | Icon { |
759 | 74 | color: checkBoxStyle.iconColor | 76 | color: checkBoxStyle.iconColor |
760 | @@ -164,4 +166,16 @@ | |||
761 | 164 | } | 166 | } |
762 | 165 | ] | 167 | ] |
763 | 166 | } | 168 | } |
764 | 169 | |||
765 | 170 | Label { | ||
766 | 171 | id: checkBoxLbl | ||
767 | 172 | text: styledItem.text | ||
768 | 173 | anchors.left: background.right | ||
769 | 174 | anchors.leftMargin: units.gu(1) | ||
770 | 175 | anchors.right: parent.right | ||
771 | 176 | height: parent.height | ||
772 | 177 | enabled: styledItem.enabled | ||
773 | 178 | visible: styledItem.text | ||
774 | 179 | wrapMode: Text.WordWrap | ||
775 | 180 | } | ||
776 | 167 | } | 181 | } |
777 | 168 | 182 | ||
778 | === modified file 'src/imports/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml' | |||
779 | --- src/imports/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2016-09-19 07:24:45 +0000 | |||
780 | +++ src/imports/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2017-03-06 16:02:52 +0000 | |||
781 | @@ -121,6 +121,7 @@ | |||
782 | 121 | id: titleLabel | 121 | id: titleLabel |
783 | 122 | objectName: "header_title_label" | 122 | objectName: "header_title_label" |
784 | 123 | text: styledItem.title | 123 | text: styledItem.title |
785 | 124 | horizontalAlignment: Qt.application.layoutDirection == Qt.RightToLeft ? Text.AlignRight: Text.AlignLeft | ||
786 | 124 | 125 | ||
787 | 125 | anchors { | 126 | anchors { |
788 | 126 | left: parent.left | 127 | left: parent.left |
789 | @@ -131,7 +132,7 @@ | |||
790 | 131 | color: pageHeaderStyle.foregroundColor | 132 | color: pageHeaderStyle.foregroundColor |
791 | 132 | font.weight: pageHeaderStyle.fontWeight | 133 | font.weight: pageHeaderStyle.fontWeight |
792 | 133 | textSize: pageHeaderStyle.textSize | 134 | textSize: pageHeaderStyle.textSize |
794 | 134 | elide: Text.ElideRight | 135 | elide: Qt.application.layoutDirection == Qt.RightToLeft ? Text.ElideLeft: Text.ElideRight |
795 | 135 | } | 136 | } |
796 | 136 | } | 137 | } |
797 | 137 | } | 138 | } |
798 | 138 | 139 | ||
799 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py' | |||
800 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2016-08-12 11:42:43 +0000 | |||
801 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2017-03-06 16:02:52 +0000 | |||
802 | @@ -79,6 +79,8 @@ | |||
803 | 79 | name = introspection.get_classname_from_path(path) | 79 | name = introspection.get_classname_from_path(path) |
804 | 80 | if name == b'OverflowPanel': | 80 | if name == b'OverflowPanel': |
805 | 81 | return True | 81 | return True |
806 | 82 | if name == b'ListItemPopover': | ||
807 | 83 | return True | ||
808 | 82 | 84 | ||
809 | 83 | return False | 85 | return False |
810 | 84 | 86 | ||
811 | 85 | 87 | ||
812 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListItemTestCase.qml' | |||
813 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListItemTestCase.qml 2015-03-03 13:20:06 +0000 | |||
814 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListItemTestCase.qml 2017-03-06 16:02:52 +0000 | |||
815 | @@ -15,7 +15,7 @@ | |||
816 | 15 | */ | 15 | */ |
817 | 16 | 16 | ||
818 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.0 |
820 | 18 | import Ubuntu.Components 1.2 | 18 | import Ubuntu.Components 1.3 |
821 | 19 | 19 | ||
822 | 20 | MainView { | 20 | MainView { |
823 | 21 | width: units.gu(48) | 21 | width: units.gu(48) |
824 | @@ -25,7 +25,10 @@ | |||
825 | 25 | Page { | 25 | Page { |
826 | 26 | id: testPage | 26 | id: testPage |
827 | 27 | objectName: "test_page" | 27 | objectName: "test_page" |
829 | 28 | title: listView.ViewItems.selectMode ? "In selection mode" : "No action triggered" | 28 | header: PageHeader { |
830 | 29 | objectName: 'test_header' | ||
831 | 30 | title: listView.ViewItems.selectMode ? "In selection mode" : "No action triggered" | ||
832 | 31 | } | ||
833 | 29 | ListView { | 32 | ListView { |
834 | 30 | id: listView | 33 | id: listView |
835 | 31 | objectName: "test_view" | 34 | objectName: "test_view" |
836 | @@ -40,6 +43,10 @@ | |||
837 | 40 | iconName: "delete" | 43 | iconName: "delete" |
838 | 41 | objectName: 'delete_action' | 44 | objectName: 'delete_action' |
839 | 42 | onTriggered: testPage.title = objectName + " action triggered"; | 45 | onTriggered: testPage.title = objectName + " action triggered"; |
840 | 46 | }, | ||
841 | 47 | Action { | ||
842 | 48 | visible: false | ||
843 | 49 | objectName: 'invisible_action' | ||
844 | 43 | } | 50 | } |
845 | 44 | ] | 51 | ] |
846 | 45 | } | 52 | } |
847 | 46 | 53 | ||
848 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.py' | |||
849 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.py 2015-09-22 15:56:35 +0000 | |||
850 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.py 2017-03-06 16:02:52 +0000 | |||
851 | @@ -17,6 +17,7 @@ | |||
852 | 17 | import os | 17 | import os |
853 | 18 | 18 | ||
854 | 19 | import ubuntuuitoolkit | 19 | import ubuntuuitoolkit |
855 | 20 | from autopilot.introspection import dbus | ||
856 | 20 | from ubuntuuitoolkit import tests | 21 | from ubuntuuitoolkit import tests |
857 | 21 | 22 | ||
858 | 22 | 23 | ||
859 | @@ -34,7 +35,9 @@ | |||
860 | 34 | 'UCListItem', objectName='listitem0') | 35 | 'UCListItem', objectName='listitem0') |
861 | 35 | self.test_page = self.main_view.select_single( | 36 | self.test_page = self.main_view.select_single( |
862 | 36 | objectName='test_page') | 37 | objectName='test_page') |
864 | 37 | self.assertEqual(self.test_page.title, 'No action triggered') | 38 | header = self.test_page.select_single( |
865 | 39 | 'PageHeader', objectName='test_header') | ||
866 | 40 | self.assertEqual(header.title, 'No action triggered') | ||
867 | 38 | 41 | ||
868 | 39 | def test_trigger_delete(self): | 42 | def test_trigger_delete(self): |
869 | 40 | self.test_listitem.trigger_leading_action('delete_action') | 43 | self.test_listitem.trigger_leading_action('delete_action') |
870 | @@ -96,3 +99,12 @@ | |||
871 | 96 | 'UCListItem', objectName='listitem3') | 99 | 'UCListItem', objectName='listitem3') |
872 | 97 | listItem3.toggle_selected() | 100 | listItem3.toggle_selected() |
873 | 98 | self.assertTrue(listItem3.selected) | 101 | self.assertTrue(listItem3.selected) |
874 | 102 | |||
875 | 103 | def test_popover(self): | ||
876 | 104 | self.pointing_device.click_object(self.test_listitem, button=3) | ||
877 | 105 | popover = self.main_view.wait_select_single( | ||
878 | 106 | 'ListItemPopover', objectName='listItemContextMenu') | ||
879 | 107 | self.assertRaises( | ||
880 | 108 | ubuntuuitoolkit._custom_proxy_objects._common.ToolkitException, | ||
881 | 109 | popover.click_action_button, 'invisible_action') | ||
882 | 110 | popover.click_action_button('delete_action') | ||
883 | 99 | 111 | ||
884 | === modified file 'tests/unit/components/tst_sortfiltermodel.qml' | |||
885 | --- tests/unit/components/tst_sortfiltermodel.qml 2015-03-03 13:20:06 +0000 | |||
886 | +++ tests/unit/components/tst_sortfiltermodel.qml 2017-03-06 16:02:52 +0000 | |||
887 | @@ -25,7 +25,7 @@ | |||
888 | 25 | id: things | 25 | id: things |
889 | 26 | ListElement { foo: "pub"; alpha: "bee"; num: 200 } | 26 | ListElement { foo: "pub"; alpha: "bee"; num: 200 } |
890 | 27 | ListElement { foo: "den"; alpha: "cow"; num: 300 } | 27 | ListElement { foo: "den"; alpha: "cow"; num: 300 } |
892 | 28 | ListElement { foo: "bar"; alpha: "ant"; num: 100 } | 28 | ListElement { foo: "Bar"; alpha: "ant"; num: 100 } |
893 | 29 | } | 29 | } |
894 | 30 | 30 | ||
895 | 31 | SortFilterModel { | 31 | SortFilterModel { |
896 | @@ -72,6 +72,13 @@ | |||
897 | 72 | filter.pattern: /e/ | 72 | filter.pattern: /e/ |
898 | 73 | } | 73 | } |
899 | 74 | 74 | ||
900 | 75 | SortFilterModel { | ||
901 | 76 | id: caseSensitivity | ||
902 | 77 | model: things | ||
903 | 78 | filter.property: "foo" | ||
904 | 79 | filter.pattern: /bar/i | ||
905 | 80 | } | ||
906 | 81 | |||
907 | 75 | function test_passthrough() { | 82 | function test_passthrough() { |
908 | 76 | compare(unmodified.count, things.count) | 83 | compare(unmodified.count, things.count) |
909 | 77 | } | 84 | } |
910 | @@ -84,7 +91,7 @@ | |||
911 | 84 | compare(alphabetic.get(2).alpha, "cow") | 91 | compare(alphabetic.get(2).alpha, "cow") |
912 | 85 | 92 | ||
913 | 86 | // Ensure different columns work also | 93 | // Ensure different columns work also |
915 | 87 | compare(alphaSecond.get(0).foo, "bar") | 94 | compare(alphaSecond.get(0).foo, "Bar") |
916 | 88 | 95 | ||
917 | 89 | // Descending | 96 | // Descending |
918 | 90 | compare(alphabeticRe.sort.order, Qt.DescendingOrder) | 97 | compare(alphabeticRe.sort.order, Qt.DescendingOrder) |
919 | @@ -98,7 +105,7 @@ | |||
920 | 98 | 105 | ||
921 | 99 | // Changing roles | 106 | // Changing roles |
922 | 100 | alphabetic.sort.property = "foo" | 107 | alphabetic.sort.property = "foo" |
924 | 101 | compare(alphabetic.get(0).foo, "bar") | 108 | compare(alphabetic.get(0).foo, "Bar") |
925 | 102 | compare(alphabetic.get(1).foo, "den") | 109 | compare(alphabetic.get(1).foo, "den") |
926 | 103 | compare(alphabetic.get(2).foo, "pub") | 110 | compare(alphabetic.get(2).foo, "pub") |
927 | 104 | // Sanity check | 111 | // Sanity check |
928 | @@ -120,4 +127,8 @@ | |||
929 | 120 | compare(bee.count, 1) | 127 | compare(bee.count, 1) |
930 | 121 | compare(bee.get(0).alpha, "bee") | 128 | compare(bee.get(0).alpha, "bee") |
931 | 122 | } | 129 | } |
932 | 130 | |||
933 | 131 | function test_case_sensitivity() { | ||
934 | 132 | compare(caseSensitivity.get(0).foo, "Bar") | ||
935 | 133 | } | ||
936 | 123 | } | 134 | } |
937 | 124 | 135 | ||
938 | === modified file 'tests/unit/contenthub/tst_contenthub.cpp' | |||
939 | --- tests/unit/contenthub/tst_contenthub.cpp 2017-01-26 16:02:48 +0000 | |||
940 | +++ tests/unit/contenthub/tst_contenthub.cpp 2017-03-06 16:02:52 +0000 | |||
941 | @@ -68,12 +68,10 @@ | |||
942 | 68 | tst_UCContentHub() {} | 68 | tst_UCContentHub() {} |
943 | 69 | 69 | ||
944 | 70 | private: | 70 | private: |
951 | 71 | MockContentService *mockService; | 71 | MockContentService *mockService{nullptr}; |
952 | 72 | UCContentHub *contentHub; | 72 | UCContentHub *contentHub{nullptr}; |
953 | 73 | QSignalSpy *pasteRequestedSpy; | 73 | QSignalSpy *pasteRequestedSpy{nullptr}; |
954 | 74 | QSignalSpy *pasteSelectedSpy; | 74 | QSignalSpy *pasteSelectedSpy{nullptr}; |
949 | 75 | |||
950 | 76 | const int testTimeout = 5000; | ||
955 | 77 | 75 | ||
956 | 78 | const QString dummyAppId = "DummyAppId"; | 76 | const QString dummyAppId = "DummyAppId"; |
957 | 79 | 77 | ||
958 | @@ -143,11 +141,11 @@ | |||
959 | 143 | QDBusConnection connection = QDBusConnection::sessionBus(); | 141 | QDBusConnection connection = QDBusConnection::sessionBus(); |
960 | 144 | connection.registerObject("/", mockService); | 142 | connection.registerObject("/", mockService); |
961 | 145 | connection.registerService("com.ubuntu.content.dbus.Service"); | 143 | connection.registerService("com.ubuntu.content.dbus.Service"); |
963 | 146 | pasteRequestedSpy = new QSignalSpy(mockService, SIGNAL(PasteRequested())); | 144 | pasteRequestedSpy = new QSignalSpy(mockService, &MockContentService::PasteRequested); |
964 | 147 | 145 | ||
965 | 148 | qRegisterMetaType<QQuickItem*>(); | 146 | qRegisterMetaType<QQuickItem*>(); |
966 | 149 | contentHub = new UCContentHub(); | 147 | contentHub = new UCContentHub(); |
968 | 150 | pasteSelectedSpy = new QSignalSpy(contentHub, SIGNAL(pasteSelected(QQuickItem*, const QString&))); | 148 | pasteSelectedSpy = new QSignalSpy(contentHub, &UCContentHub::pasteSelected); |
969 | 151 | } | 149 | } |
970 | 152 | 150 | ||
971 | 153 | void cleanupTestCase() | 151 | void cleanupTestCase() |
972 | @@ -155,6 +153,7 @@ | |||
973 | 155 | delete pasteRequestedSpy; | 153 | delete pasteRequestedSpy; |
974 | 156 | delete pasteSelectedSpy; | 154 | delete pasteSelectedSpy; |
975 | 157 | delete contentHub; | 155 | delete contentHub; |
976 | 156 | delete mockService; | ||
977 | 158 | } | 157 | } |
978 | 159 | 158 | ||
979 | 160 | void cleanup() | 159 | void cleanup() |
980 | @@ -187,8 +186,7 @@ | |||
981 | 187 | QMimeData textPaste; | 186 | QMimeData textPaste; |
982 | 188 | textPaste.setText(sampleHtml); | 187 | textPaste.setText(sampleHtml); |
983 | 189 | contentHub->onPasteSelected(contentHub->getAppProfile(), serializeMimeData(textPaste), false); | 188 | contentHub->onPasteSelected(contentHub->getAppProfile(), serializeMimeData(textPaste), false); |
986 | 190 | pasteSelectedSpy->wait(testTimeout); | 189 | QTRY_COMPARE(pasteSelectedSpy->count(), 1); |
985 | 191 | QCOMPARE(pasteSelectedSpy->count(), 1); | ||
987 | 192 | QList<QVariant> args = pasteSelectedSpy->takeFirst(); | 190 | QList<QVariant> args = pasteSelectedSpy->takeFirst(); |
988 | 193 | QVERIFY(args.at(1).toString() == textPaste.text()); | 191 | QVERIFY(args.at(1).toString() == textPaste.text()); |
989 | 194 | } | 192 | } |
990 | @@ -198,8 +196,7 @@ | |||
991 | 198 | QMimeData htmlPaste; | 196 | QMimeData htmlPaste; |
992 | 199 | htmlPaste.setHtml(sampleHtml); | 197 | htmlPaste.setHtml(sampleHtml); |
993 | 200 | contentHub->onPasteSelected(contentHub->getAppProfile(), serializeMimeData(htmlPaste), false); | 198 | contentHub->onPasteSelected(contentHub->getAppProfile(), serializeMimeData(htmlPaste), false); |
996 | 201 | pasteSelectedSpy->wait(testTimeout); | 199 | QTRY_COMPARE(pasteSelectedSpy->count(), 1); |
995 | 202 | QCOMPARE(pasteSelectedSpy->count(), 1); | ||
997 | 203 | QList<QVariant> args = pasteSelectedSpy->takeFirst(); | 200 | QList<QVariant> args = pasteSelectedSpy->takeFirst(); |
998 | 204 | QVERIFY(args.at(1).toString() == htmlPaste.text()); | 201 | QVERIFY(args.at(1).toString() == htmlPaste.text()); |
999 | 205 | } | 202 | } |
1000 | @@ -209,8 +206,7 @@ | |||
1001 | 209 | QMimeData htmlPaste; | 206 | QMimeData htmlPaste; |
1002 | 210 | htmlPaste.setHtml(sampleHtml); | 207 | htmlPaste.setHtml(sampleHtml); |
1003 | 211 | contentHub->onPasteSelected(contentHub->getAppProfile(), serializeMimeData(htmlPaste), true); | 208 | contentHub->onPasteSelected(contentHub->getAppProfile(), serializeMimeData(htmlPaste), true); |
1006 | 212 | pasteSelectedSpy->wait(testTimeout); | 209 | QTRY_COMPARE(pasteSelectedSpy->count(), 1); |
1005 | 213 | QCOMPARE(pasteSelectedSpy->count(), 1); | ||
1007 | 214 | QList<QVariant> args = pasteSelectedSpy->takeFirst(); | 210 | QList<QVariant> args = pasteSelectedSpy->takeFirst(); |
1008 | 215 | QVERIFY(args.at(1).toString() == htmlPaste.html()); | 211 | QVERIFY(args.at(1).toString() == htmlPaste.html()); |
1009 | 216 | } | 212 | } |
1010 | @@ -220,8 +216,7 @@ | |||
1011 | 220 | QMimeData textPaste; | 216 | QMimeData textPaste; |
1012 | 221 | textPaste.setText(sampleText); | 217 | textPaste.setText(sampleText); |
1013 | 222 | contentHub->onPasteSelected(dummyAppId, serializeMimeData(textPaste), false); | 218 | contentHub->onPasteSelected(dummyAppId, serializeMimeData(textPaste), false); |
1016 | 223 | pasteSelectedSpy->wait(testTimeout); | 219 | QTRY_COMPARE(pasteSelectedSpy->count(), 0); |
1015 | 224 | QCOMPARE(pasteSelectedSpy->count(), 0); | ||
1017 | 225 | } | 220 | } |
1018 | 226 | 221 | ||
1019 | 227 | void test_KeyboardShortcutOnTextField() | 222 | void test_KeyboardShortcutOnTextField() |
1020 | @@ -230,10 +225,10 @@ | |||
1021 | 230 | testCase->rootObject()->forceActiveFocus(); | 225 | testCase->rootObject()->forceActiveFocus(); |
1022 | 231 | QQuickItem *textField = testCase->findItem<QQuickItem*>("textField"); | 226 | QQuickItem *textField = testCase->findItem<QQuickItem*>("textField"); |
1023 | 232 | QTest::keyClick(textField->window(), Qt::Key_Tab); | 227 | QTest::keyClick(textField->window(), Qt::Key_Tab); |
1025 | 233 | QTRY_COMPARE_WITH_TIMEOUT(textField->property("activeFocus").toBool(), true, testTimeout); | 228 | QTRY_COMPARE(textField->property("activeFocus").toBool(), true); |
1026 | 229 | QTRY_COMPARE(contentHub->canPaste(), true); | ||
1027 | 234 | QTest::keyClick(textField->window(), Qt::Key_V, Qt::ControlModifier|Qt::ShiftModifier); | 230 | QTest::keyClick(textField->window(), Qt::Key_V, Qt::ControlModifier|Qt::ShiftModifier); |
1030 | 235 | pasteRequestedSpy->wait(testTimeout); | 231 | QTRY_COMPARE(pasteRequestedSpy->count(), 1); |
1029 | 236 | QCOMPARE(pasteRequestedSpy->count(), 1); | ||
1031 | 237 | } | 232 | } |
1032 | 238 | 233 | ||
1033 | 239 | void test_KeyboardShortcutOnTextArea() | 234 | void test_KeyboardShortcutOnTextArea() |
1034 | @@ -242,10 +237,10 @@ | |||
1035 | 242 | testCase->rootObject()->forceActiveFocus(); | 237 | testCase->rootObject()->forceActiveFocus(); |
1036 | 243 | QQuickItem *textArea = testCase->findItem<QQuickItem*>("textArea"); | 238 | QQuickItem *textArea = testCase->findItem<QQuickItem*>("textArea"); |
1037 | 244 | QTest::keyClick(textArea->window(), Qt::Key_Tab); | 239 | QTest::keyClick(textArea->window(), Qt::Key_Tab); |
1039 | 245 | QTRY_COMPARE_WITH_TIMEOUT(textArea->property("activeFocus").toBool(), true, testTimeout); | 240 | QTRY_COMPARE(textArea->property("activeFocus").toBool(), true); |
1040 | 241 | QTRY_COMPARE(contentHub->canPaste(), true); | ||
1041 | 246 | QTest::keyClick(textArea->window(), Qt::Key_V, Qt::ControlModifier|Qt::ShiftModifier); | 242 | QTest::keyClick(textArea->window(), Qt::Key_V, Qt::ControlModifier|Qt::ShiftModifier); |
1044 | 247 | pasteRequestedSpy->wait(testTimeout); | 243 | QTRY_COMPARE(pasteRequestedSpy->count(), 1); |
1043 | 248 | QCOMPARE(pasteRequestedSpy->count(), 1); | ||
1045 | 249 | } | 244 | } |
1046 | 250 | }; | 245 | }; |
1047 | 251 | 246 | ||
1048 | 252 | 247 | ||
1049 | === modified file 'tests/unit/mainwindow/VisualRoot.qml' | |||
1050 | --- tests/unit/mainwindow/VisualRoot.qml 2017-01-16 14:18:21 +0000 | |||
1051 | +++ tests/unit/mainwindow/VisualRoot.qml 2017-03-06 16:02:52 +0000 | |||
1052 | @@ -20,7 +20,6 @@ | |||
1053 | 20 | 20 | ||
1054 | 21 | MainWindow { | 21 | MainWindow { |
1055 | 22 | objectName: "visualRoot" | 22 | objectName: "visualRoot" |
1056 | 23 | applicationName: "org.gnu.wildebeest" | ||
1057 | 24 | visualRoot: myRoot | 23 | visualRoot: myRoot |
1058 | 25 | 24 | ||
1059 | 26 | Rectangle { | 25 | Rectangle { |
1060 | 27 | 26 | ||
1061 | === modified file 'tests/unit/mainwindow/tst_mainwindow.cpp' | |||
1062 | --- tests/unit/mainwindow/tst_mainwindow.cpp 2017-01-16 17:44:23 +0000 | |||
1063 | +++ tests/unit/mainwindow/tst_mainwindow.cpp 2017-03-06 16:02:52 +0000 | |||
1064 | @@ -33,10 +33,7 @@ | |||
1065 | 33 | #include <QtCore/QCryptographicHash> | 33 | #include <QtCore/QCryptographicHash> |
1066 | 34 | #include <QtCore/QSettings> | 34 | #include <QtCore/QSettings> |
1067 | 35 | 35 | ||
1068 | 36 | #include <QtQuick/QQuickItem> | ||
1069 | 37 | #include <QtQuick/QQuickView> | ||
1070 | 38 | #include <QtGui/QGuiApplication> | 36 | #include <QtGui/QGuiApplication> |
1071 | 39 | #include <QtQml/QQmlEngine> | ||
1072 | 40 | #include <QtQml/QQmlContext> | 37 | #include <QtQml/QQmlContext> |
1073 | 41 | #include <QtQml/QQmlComponent> | 38 | #include <QtQml/QQmlComponent> |
1074 | 42 | 39 | ||
1075 | @@ -103,18 +100,22 @@ | |||
1076 | 103 | 100 | ||
1077 | 104 | private Q_SLOTS: | 101 | private Q_SLOTS: |
1078 | 105 | 102 | ||
1085 | 106 | void initTestCase() | 103 | void cleanup() |
1086 | 107 | { | 104 | { |
1087 | 108 | } | 105 | // Delete engine, and thereby also the UCApplication instance |
1088 | 109 | 106 | QObject* engine(UCApplication::instance()->parent()); | |
1089 | 110 | void cleanupTestCase() | 107 | delete engine; |
1090 | 111 | { | 108 | QCoreApplication::setApplicationName(QStringLiteral("")); |
1091 | 109 | QCoreApplication::setOrganizationName(QStringLiteral("")); | ||
1092 | 112 | } | 110 | } |
1093 | 113 | 111 | ||
1094 | 114 | // Note: tests/unit/mainview13 contains the UCApplication bits | 112 | // Note: tests/unit/mainview13 contains the UCApplication bits |
1095 | 115 | 113 | ||
1096 | 116 | void testCase_AppName() | 114 | void testCase_AppName() |
1097 | 117 | { | 115 | { |
1098 | 116 | // Sanity check: no name set yet | ||
1099 | 117 | QCOMPARE(QStringLiteral("mainwindow"), QCoreApplication::applicationName()); | ||
1100 | 118 | |||
1101 | 118 | QString applicationName("org.gnu.wildebeest"); | 119 | QString applicationName("org.gnu.wildebeest"); |
1102 | 119 | QQuickWindow *mainWindow(loadTest("AppName.qml")); | 120 | QQuickWindow *mainWindow(loadTest("AppName.qml")); |
1103 | 120 | QVERIFY(mainWindow); | 121 | QVERIFY(mainWindow); |
1104 | @@ -125,6 +126,9 @@ | |||
1105 | 125 | 126 | ||
1106 | 126 | void testCase_OrganizationName() | 127 | void testCase_OrganizationName() |
1107 | 127 | { | 128 | { |
1108 | 129 | // Sanity check: no organization set yet | ||
1109 | 130 | QCOMPARE(QStringLiteral(""), QCoreApplication::organizationName()); | ||
1110 | 131 | |||
1111 | 128 | QString applicationName("tv.island.pacific"); | 132 | QString applicationName("tv.island.pacific"); |
1112 | 129 | QString organizationName("pacifist"); | 133 | QString organizationName("pacifist"); |
1113 | 130 | QQuickWindow *mainWindow(loadTest("OrganizationName.qml")); | 134 | QQuickWindow *mainWindow(loadTest("OrganizationName.qml")); |
1114 | @@ -135,9 +139,28 @@ | |||
1115 | 135 | QCOMPARE(organizationName, QCoreApplication::organizationName()); | 139 | QCOMPARE(organizationName, QCoreApplication::organizationName()); |
1116 | 136 | } | 140 | } |
1117 | 137 | 141 | ||
1118 | 142 | void testCase_NoOrganizationName() | ||
1119 | 143 | { | ||
1120 | 144 | // Sanity check: no organization set yet | ||
1121 | 145 | QCOMPARE(QStringLiteral(""), QCoreApplication::organizationName()); | ||
1122 | 146 | |||
1123 | 147 | // Custom values set outside of QML | ||
1124 | 148 | QString applicationName("com.example.random"); | ||
1125 | 149 | QString organizationName(QStringLiteral("Example")); | ||
1126 | 150 | QCoreApplication::setApplicationName(applicationName); | ||
1127 | 151 | QCoreApplication::setOrganizationName(organizationName); | ||
1128 | 152 | |||
1129 | 153 | QQuickWindow *mainWindow(loadTest("VisualRoot.qml")); | ||
1130 | 154 | QVERIFY(mainWindow); | ||
1131 | 155 | // MainView shouldn't interfere as applicationName wasn't set in QML | ||
1132 | 156 | QCOMPARE(QStringLiteral(""), mainWindow->property("applicationName").toString()); | ||
1133 | 157 | QCOMPARE(applicationName, QCoreApplication::applicationName()); | ||
1134 | 158 | QCOMPARE(QStringLiteral(""), mainWindow->property("organizationName").toString()); | ||
1135 | 159 | QCOMPARE(organizationName, QCoreApplication::organizationName()); | ||
1136 | 160 | } | ||
1137 | 161 | |||
1138 | 138 | void testCase_VisualRoot() | 162 | void testCase_VisualRoot() |
1139 | 139 | { | 163 | { |
1140 | 140 | QString applicationName("tv.island.pacific"); | ||
1141 | 141 | QQuickWindow *mainWindow(loadTest("VisualRoot.qml")); | 164 | QQuickWindow *mainWindow(loadTest("VisualRoot.qml")); |
1142 | 142 | QVERIFY(mainWindow); | 165 | QVERIFY(mainWindow); |
1143 | 143 | QQuickItem* myLabel(testItem(mainWindow, "myLabel")); | 166 | QQuickItem* myLabel(testItem(mainWindow, "myLabel")); |
1144 | 144 | 167 | ||
1145 | === removed file 'tests/unit/qquick_image_extension/borderInName.sci' | |||
1146 | --- tests/unit/qquick_image_extension/borderInName.sci 2013-05-06 16:33:54 +0000 | |||
1147 | +++ tests/unit/qquick_image_extension/borderInName.sci 1970-01-01 00:00:00 +0000 | |||
1148 | @@ -1,7 +0,0 @@ | |||
1149 | 1 | source: "borderInName.png" | ||
1150 | 2 | border.left: 9 | ||
1151 | 3 | border.right: 2 | ||
1152 | 4 | border.top: 9 | ||
1153 | 5 | border.bottom: 0 | ||
1154 | 6 | horizontalTileMode: Stretch | ||
1155 | 7 | verticalTileMode: Stretch | ||
1156 | 8 | 0 | ||
1157 | === added directory 'tests/unit/qquick_image_extension/data' | |||
1158 | === added file 'tests/unit/qquick_image_extension/data/borderInName.sci' | |||
1159 | --- tests/unit/qquick_image_extension/data/borderInName.sci 1970-01-01 00:00:00 +0000 | |||
1160 | +++ tests/unit/qquick_image_extension/data/borderInName.sci 2017-03-06 16:02:52 +0000 | |||
1161 | @@ -0,0 +1,7 @@ | |||
1162 | 1 | source: "borderInName.png" | ||
1163 | 2 | border.left: 9 | ||
1164 | 3 | border.right: 2 | ||
1165 | 4 | border.top: 9 | ||
1166 | 5 | border.bottom: 0 | ||
1167 | 6 | horizontalTileMode: Stretch | ||
1168 | 7 | verticalTileMode: Stretch | ||
1169 | 0 | 8 | ||
1170 | === added file 'tests/unit/qquick_image_extension/data/face.png' | |||
1171 | 1 | Binary files tests/unit/qquick_image_extension/data/face.png 1970-01-01 00:00:00 +0000 and tests/unit/qquick_image_extension/data/face.png 2017-03-06 16:02:52 +0000 differ | 9 | Binary files tests/unit/qquick_image_extension/data/face.png 1970-01-01 00:00:00 +0000 and tests/unit/qquick_image_extension/data/face.png 2017-03-06 16:02:52 +0000 differ |
1172 | === added file 'tests/unit/qquick_image_extension/data/hundred_faces.qml' | |||
1173 | --- tests/unit/qquick_image_extension/data/hundred_faces.qml 1970-01-01 00:00:00 +0000 | |||
1174 | +++ tests/unit/qquick_image_extension/data/hundred_faces.qml 2017-03-06 16:02:52 +0000 | |||
1175 | @@ -0,0 +1,13 @@ | |||
1176 | 1 | |||
1177 | 2 | import QtQuick 2.4 | ||
1178 | 3 | import Ubuntu.Components 1.3 | ||
1179 | 4 | |||
1180 | 5 | Repeater { | ||
1181 | 6 | width: 400 | ||
1182 | 7 | height: 600 | ||
1183 | 8 | |||
1184 | 9 | model: 100 | ||
1185 | 10 | delegate: Image { | ||
1186 | 11 | source: "face.png" | ||
1187 | 12 | } | ||
1188 | 13 | } | ||
1189 | 0 | 14 | ||
1190 | === added file 'tests/unit/qquick_image_extension/data/test@18.sci' | |||
1191 | --- tests/unit/qquick_image_extension/data/test@18.sci 1970-01-01 00:00:00 +0000 | |||
1192 | +++ tests/unit/qquick_image_extension/data/test@18.sci 2017-03-06 16:02:52 +0000 | |||
1193 | @@ -0,0 +1,7 @@ | |||
1194 | 1 | source: "test@18.png" | ||
1195 | 2 | border.left: 9 | ||
1196 | 3 | border.right: 2 | ||
1197 | 4 | border.top: 9 | ||
1198 | 5 | border.bottom: 0 | ||
1199 | 6 | horizontalTileMode: Stretch | ||
1200 | 7 | verticalTileMode: Stretch | ||
1201 | 0 | 8 | ||
1202 | === modified file 'tests/unit/qquick_image_extension/qquick_image_extension.pro' | |||
1203 | --- tests/unit/qquick_image_extension/qquick_image_extension.pro 2016-05-31 09:02:35 +0000 | |||
1204 | +++ tests/unit/qquick_image_extension/qquick_image_extension.pro 2017-03-06 16:02:52 +0000 | |||
1205 | @@ -1,3 +1,3 @@ | |||
1206 | 1 | include(../test-include.pri) | 1 | include(../test-include.pri) |
1207 | 2 | SOURCES += tst_qquick_image_extension.cpp | 2 | SOURCES += tst_qquick_image_extension.cpp |
1209 | 3 | QT += quick-private | 3 | QT += core-private quick-private |
1210 | 4 | 4 | ||
1211 | === removed file 'tests/unit/qquick_image_extension/test@18.sci' | |||
1212 | --- tests/unit/qquick_image_extension/test@18.sci 2013-05-06 16:33:54 +0000 | |||
1213 | +++ tests/unit/qquick_image_extension/test@18.sci 1970-01-01 00:00:00 +0000 | |||
1214 | @@ -1,7 +0,0 @@ | |||
1215 | 1 | source: "test@18.png" | ||
1216 | 2 | border.left: 9 | ||
1217 | 3 | border.right: 2 | ||
1218 | 4 | border.top: 9 | ||
1219 | 5 | border.bottom: 0 | ||
1220 | 6 | horizontalTileMode: Stretch | ||
1221 | 7 | verticalTileMode: Stretch | ||
1222 | 8 | 0 | ||
1223 | === modified file 'tests/unit/qquick_image_extension/tst_qquick_image_extension.cpp' | |||
1224 | --- tests/unit/qquick_image_extension/tst_qquick_image_extension.cpp 2016-09-09 17:49:07 +0000 | |||
1225 | +++ tests/unit/qquick_image_extension/tst_qquick_image_extension.cpp 2017-03-06 16:02:52 +0000 | |||
1226 | @@ -23,6 +23,8 @@ | |||
1227 | 23 | #define protected public | 23 | #define protected public |
1228 | 24 | #include <UbuntuToolkit/private/ucqquickimageextension_p.h> | 24 | #include <UbuntuToolkit/private/ucqquickimageextension_p.h> |
1229 | 25 | #undef protected | 25 | #undef protected |
1230 | 26 | #include <QtCore/private/qabstractfileengine_p.h> | ||
1231 | 27 | #include <QQuickView> | ||
1232 | 26 | 28 | ||
1233 | 27 | UT_USE_NAMESPACE | 29 | UT_USE_NAMESPACE |
1234 | 28 | 30 | ||
1235 | @@ -32,6 +34,20 @@ | |||
1236 | 32 | return QDir::temp().entryList(nameFilters, QDir::Files).count(); | 34 | return QDir::temp().entryList(nameFilters, QDir::Files).count(); |
1237 | 33 | } | 35 | } |
1238 | 34 | 36 | ||
1239 | 37 | int nFaces = 0; | ||
1240 | 38 | |||
1241 | 39 | class DummyFileEngineHandler : public QAbstractFileEngineHandler | ||
1242 | 40 | { | ||
1243 | 41 | public: | ||
1244 | 42 | QAbstractFileEngine *create(const QString &fileName) const | ||
1245 | 43 | { | ||
1246 | 44 | if (fileName.endsWith("/face.png")) | ||
1247 | 45 | nFaces++; | ||
1248 | 46 | |||
1249 | 47 | return nullptr; | ||
1250 | 48 | } | ||
1251 | 49 | }; | ||
1252 | 50 | |||
1253 | 35 | class tst_UCQQuickImageExtension : public QObject | 51 | class tst_UCQQuickImageExtension : public QObject |
1254 | 36 | { | 52 | { |
1255 | 37 | Q_OBJECT | 53 | Q_OBJECT |
1256 | @@ -78,7 +94,7 @@ | |||
1257 | 78 | 94 | ||
1258 | 79 | void rewriteContainsBorderInName() { | 95 | void rewriteContainsBorderInName() { |
1259 | 80 | UCQQuickImageExtension image; | 96 | UCQQuickImageExtension image; |
1261 | 81 | QString sciFilePath = "borderInName.sci"; | 97 | QString sciFilePath = "data/borderInName.sci"; |
1262 | 82 | QString result; | 98 | QString result; |
1263 | 83 | 99 | ||
1264 | 84 | QTextStream resultStream(&result); | 100 | QTextStream resultStream(&result); |
1265 | @@ -86,7 +102,7 @@ | |||
1266 | 86 | 102 | ||
1267 | 87 | QString expected; | 103 | QString expected; |
1268 | 88 | QTextStream expectedStream(&expected); | 104 | QTextStream expectedStream(&expected); |
1270 | 89 | expectedStream << "source: \"image://scaling/1/./borderInName.png\"" << endl; | 105 | expectedStream << "source: \"image://scaling/1/data/borderInName.png\"" << endl; |
1271 | 90 | expectedStream << "border.left: 9" << endl; | 106 | expectedStream << "border.left: 9" << endl; |
1272 | 91 | expectedStream << "border.right: 2" << endl; | 107 | expectedStream << "border.right: 2" << endl; |
1273 | 92 | expectedStream << "border.top: 9" << endl; | 108 | expectedStream << "border.top: 9" << endl; |
1274 | @@ -105,7 +121,7 @@ | |||
1275 | 105 | QQuickImageBase baseImage; | 121 | QQuickImageBase baseImage; |
1276 | 106 | UCQQuickImageExtension* image1 = new UCQQuickImageExtension(&baseImage); | 122 | UCQQuickImageExtension* image1 = new UCQQuickImageExtension(&baseImage); |
1277 | 107 | UCQQuickImageExtension* image2 = new UCQQuickImageExtension(&baseImage); | 123 | UCQQuickImageExtension* image2 = new UCQQuickImageExtension(&baseImage); |
1279 | 108 | QUrl sciFileUrl = QUrl::fromLocalFile("./test.sci"); | 124 | QUrl sciFileUrl = QUrl::fromLocalFile("./data/test.sci"); |
1280 | 109 | 125 | ||
1281 | 110 | unsigned int initialNumberOfSciFiles = numberOfTemporarySciFiles(); | 126 | unsigned int initialNumberOfSciFiles = numberOfTemporarySciFiles(); |
1282 | 111 | 127 | ||
1283 | @@ -124,6 +140,25 @@ | |||
1284 | 124 | delete image2; | 140 | delete image2; |
1285 | 125 | QCOMPARE(numberOfTemporarySciFiles(), initialNumberOfSciFiles + 1); | 141 | QCOMPARE(numberOfTemporarySciFiles(), initialNumberOfSciFiles + 1); |
1286 | 126 | } | 142 | } |
1287 | 143 | |||
1288 | 144 | void onlyOneStatRepeatedImage() { | ||
1289 | 145 | DummyFileEngineHandler handler; | ||
1290 | 146 | |||
1291 | 147 | QQuickView view(QUrl::fromLocalFile("./data/hundred_faces.qml")); | ||
1292 | 148 | |||
1293 | 149 | // Wait until the app is idle | ||
1294 | 150 | bool idle = false; | ||
1295 | 151 | while (!idle) { | ||
1296 | 152 | QEventLoop l; | ||
1297 | 153 | idle = !l.processEvents(); | ||
1298 | 154 | } | ||
1299 | 155 | // We have actually loaded the image | ||
1300 | 156 | QVERIFY(nFaces > 0); | ||
1301 | 157 | // The number at the moment of writing this test is 4, but we | ||
1302 | 158 | // can't know what Qt does internally, so i'm going for a relatively safe <10 | ||
1303 | 159 | // the important part is that is not 100 times (i.e. one for every Image item) | ||
1304 | 160 | QVERIFY(nFaces < 10); | ||
1305 | 161 | } | ||
1306 | 127 | }; | 162 | }; |
1307 | 128 | 163 | ||
1308 | 129 | QTEST_MAIN(tst_UCQQuickImageExtension) | 164 | QTEST_MAIN(tst_UCQQuickImageExtension) |
1309 | 130 | 165 | ||
1310 | === modified file 'tests/unit/visual/tst_optionselector.13.qml' | |||
1311 | --- tests/unit/visual/tst_optionselector.13.qml 2016-09-19 11:13:19 +0000 | |||
1312 | +++ tests/unit/visual/tst_optionselector.13.qml 2017-03-06 16:02:52 +0000 | |||
1313 | @@ -183,8 +183,17 @@ | |||
1314 | 183 | function test_custom_data() { | 183 | function test_custom_data() { |
1315 | 184 | return test_arrow_select_data() | 184 | return test_arrow_select_data() |
1316 | 185 | } | 185 | } |
1317 | 186 | |||
1318 | 186 | function test_custom(data) { | 187 | function test_custom(data) { |
1319 | 187 | test_arrow_select(data, customSelector, 2); | 188 | test_arrow_select(data, customSelector, 2); |
1320 | 188 | } | 189 | } |
1321 | 190 | |||
1322 | 191 | function test_count() { | ||
1323 | 192 | var selector = defaultSelector; | ||
1324 | 193 | sections.selectedIndex = 0; | ||
1325 | 194 | selector.forceActiveFocus(); | ||
1326 | 195 | waitForRendering(selector); | ||
1327 | 196 | compare(selector.count, customModel.count); | ||
1328 | 197 | } | ||
1329 | 189 | } | 198 | } |
1330 | 190 | } | 199 | } |
1331 | 191 | 200 | ||
1332 | === modified file 'tests/unit/visual/tst_toggles.13.qml' | |||
1333 | --- tests/unit/visual/tst_toggles.13.qml 2016-06-15 13:46:51 +0000 | |||
1334 | +++ tests/unit/visual/tst_toggles.13.qml 2017-03-06 16:02:52 +0000 | |||
1335 | @@ -39,6 +39,23 @@ | |||
1336 | 39 | property bool checkedNow: true | 39 | property bool checkedNow: true |
1337 | 40 | onClicked: checkedNow = checked | 40 | onClicked: checkedNow = checked |
1338 | 41 | } | 41 | } |
1339 | 42 | |||
1340 | 43 | CheckBox { | ||
1341 | 44 | id: testCheckLbl | ||
1342 | 45 | checked: true | ||
1343 | 46 | text: "This a checkbox label" | ||
1344 | 47 | property bool checkedNow: true | ||
1345 | 48 | onClicked: checkedNow = checked | ||
1346 | 49 | } | ||
1347 | 50 | |||
1348 | 51 | CheckBox { | ||
1349 | 52 | id: testCheckLblDisabled | ||
1350 | 53 | checked: false | ||
1351 | 54 | enabled: false | ||
1352 | 55 | text: "This a checkbox label" | ||
1353 | 56 | property bool checkedNow: false | ||
1354 | 57 | onClicked: checkedNow = checked | ||
1355 | 58 | } | ||
1356 | 42 | } | 59 | } |
1357 | 43 | 60 | ||
1358 | 44 | UbuntuTestCase { | 61 | UbuntuTestCase { |
1359 | @@ -75,6 +92,37 @@ | |||
1360 | 75 | clickedSpy.wait(400); | 92 | clickedSpy.wait(400); |
1361 | 76 | compare(data.testItem.checkedNow, data.testItem.checked); | 93 | compare(data.testItem.checkedNow, data.testItem.checked); |
1362 | 77 | } | 94 | } |
1363 | 95 | |||
1364 | 96 | |||
1365 | 97 | function test_toggle_lbl_checked_data() { | ||
1366 | 98 | return [ | ||
1367 | 99 | {tag: "CheckBox", testItem: testCheckLbl, mouse: true}, | ||
1368 | 100 | ]; | ||
1369 | 101 | } | ||
1370 | 102 | |||
1371 | 103 | function test_toggle_lbl_checked(data) { | ||
1372 | 104 | data.testItem.checkedNow = data.testItem.checked; | ||
1373 | 105 | data.testItem.forceActiveFocus(); | ||
1374 | 106 | clickedSpy.target = data.testItem; | ||
1375 | 107 | mouseClick(data.testItem, centerOf(data.testItem).x, centerOf(data.testItem).y); | ||
1376 | 108 | clickedSpy.wait(400); | ||
1377 | 109 | compare(data.testItem.checkedNow, data.testItem.checked); | ||
1378 | 110 | } | ||
1379 | 111 | |||
1380 | 112 | function test_toggle_lbl_checked_disabled_data() { | ||
1381 | 113 | return [ | ||
1382 | 114 | {tag: "CheckBox", testItem: testCheckLblDisabled, mouse: true}, | ||
1383 | 115 | ]; | ||
1384 | 116 | } | ||
1385 | 117 | |||
1386 | 118 | function test_toggle_lbl_checked_disabled(data) { | ||
1387 | 119 | data.testItem.checkedNow = data.testItem.checked; | ||
1388 | 120 | data.testItem.forceActiveFocus(); | ||
1389 | 121 | clickedSpy.target = data.testItem; | ||
1390 | 122 | mouseClick(data.testItem, centerOf(data.testItem).x, centerOf(data.testItem).y); | ||
1391 | 123 | compare(clickedSpy.count, 0); | ||
1392 | 124 | compare(data.testItem.checkedNow, data.testItem.checked); | ||
1393 | 125 | } | ||
1394 | 78 | } | 126 | } |
1395 | 79 | } | 127 | } |
1396 | 80 | 128 |