Merge lp:~unity-team/unity/phablet.test_LensView into lp:unity/phablet

Proposed by Andrea Cimitan
Status: Rejected
Rejected by: Andrea Cimitan
Proposed branch: lp:~unity-team/unity/phablet.test_LensView
Merge into: lp:unity/phablet
Diff against target: 879 lines (+776/-0)
20 files modified
tests/qmluitests/Dash/CMakeLists.txt (+3/-0)
tests/qmluitests/Dash/qml/CMakeLists.txt (+1/-0)
tests/qmluitests/Dash/qml/FakeLensView.qml (+87/-0)
tests/qmluitests/Dash/qml/Unity/CMakeLists.txt (+36/-0)
tests/qmluitests/Dash/qml/Unity/fake_lens.cpp (+62/-0)
tests/qmluitests/Dash/qml/Unity/fake_lens.h (+56/-0)
tests/qmluitests/Dash/qml/Unity/fake_lenses.cpp (+101/-0)
tests/qmluitests/Dash/qml/Unity/fake_lenses.h (+69/-0)
tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.cpp (+34/-0)
tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.h (+34/-0)
tests/qmluitests/Dash/qml/Unity/qmldir (+2/-0)
tests/qmluitests/Dash/qml/Unity/test_unity_object.cpp (+25/-0)
tests/qmluitests/Dash/qml/Unity/test_unity_object.h (+34/-0)
tests/qmluitests/Dash/qml/fake_generic_lensView.qml (+24/-0)
tests/qmluitests/Dash/qml/fake_lensView1.qml (+24/-0)
tests/qmluitests/Dash/qml/fake_lensView2.qml (+24/-0)
tests/qmluitests/Dash/qml/fake_lensView3.qml (+24/-0)
tests/qmluitests/Dash/qml/fake_lensView4.qml (+24/-0)
tests/qmluitests/Dash/tst_DashContent.qml (+60/-0)
tests/qmluitests/Dash/tst_LensView.qml (+52/-0)
To merge this branch: bzr merge lp:~unity-team/unity/phablet.test_LensView
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+159134@code.launchpad.net

Commit message

Adds fake Unity plugin (mostly done by dednick), and tests searchQuery for LensView

Description of the change

Adds fake Unity plugin (mostly done by dednick), and tests searchQuery for LensView

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/qmluitests/Dash/CMakeLists.txt'
2--- tests/qmluitests/Dash/CMakeLists.txt 2013-04-11 15:05:45 +0000
3+++ tests/qmluitests/Dash/CMakeLists.txt 2013-04-16 12:13:28 +0000
4@@ -1,2 +1,5 @@
5+add_subdirectory(qml)
6+
7 add_qml_test(DashPreview)
8+add_qml_test(LensView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/qml)
9 add_qml_test(PeoplePreview)
10
11=== added directory 'tests/qmluitests/Dash/qml'
12=== added file 'tests/qmluitests/Dash/qml/CMakeLists.txt'
13--- tests/qmluitests/Dash/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000
14+++ tests/qmluitests/Dash/qml/CMakeLists.txt 2013-04-16 12:13:28 +0000
15@@ -0,0 +1,1 @@
16+add_subdirectory(Unity)
17
18=== added file 'tests/qmluitests/Dash/qml/FakeLensView.qml'
19--- tests/qmluitests/Dash/qml/FakeLensView.qml 1970-01-01 00:00:00 +0000
20+++ tests/qmluitests/Dash/qml/FakeLensView.qml 2013-04-16 12:13:28 +0000
21@@ -0,0 +1,87 @@
22+/*
23+ * Copyright 2013 Canonical Ltd.
24+ *
25+ * This program is free software; you can redistribute it and/or modify
26+ * it under the terms of the GNU General Public License as published by
27+ * the Free Software Foundation; version 3.
28+ *
29+ * This program is distributed in the hope that it will be useful,
30+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
31+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32+ * GNU General Public License for more details.
33+ *
34+ * You should have received a copy of the GNU General Public License
35+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
36+ */
37+
38+import QtQuick 2.0
39+import Unity 0.1
40+import Ubuntu.Components 0.1
41+
42+FocusScope {
43+ property Lens lens
44+ property bool isCurrent : false
45+
46+ property var ball_color
47+
48+ Text {
49+ id: label
50+ anchors {
51+ top: parent.top
52+ left: parent.left
53+ right: parent.right
54+ }
55+ height: units.gu(5)
56+ text: lens.id
57+
58+ verticalAlignment: Text.AlignVCenter
59+ horizontalAlignment: Text.AlignHCenter
60+ }
61+
62+ Rectangle {
63+ id: bounce_area
64+ anchors {
65+ top: label.bottom
66+ left: parent.left
67+ right: parent.right
68+ bottom: parent.bottom
69+ }
70+ clip: true
71+
72+ Rectangle {
73+ id: ball
74+ width: units.gu(5)
75+ height: units.gu(5)
76+ radius: width*0.5
77+
78+ border.width: 1
79+ border.color: "black"
80+ color: ball_color
81+
82+ Component.onCompleted: { x = 100; y = 100; }
83+
84+ Behavior on x {
85+ NumberAnimation {
86+ id: x_animate; duration: 500
87+
88+ onRunningChanged: {
89+ if (!running) {
90+ ball.x = ball.radius + Math.random() * (bounce_area.width - ball.width);
91+ }
92+ }
93+ }
94+ }
95+ Behavior on y {
96+ NumberAnimation {
97+ id: y_animate; duration: 500
98+
99+ onRunningChanged: {
100+ if (!running) {
101+ ball.y = ball.radius + Math.random() * (bounce_area.height - ball.height);
102+ }
103+ }
104+ }
105+ }
106+ }
107+ }
108+}
109
110=== added directory 'tests/qmluitests/Dash/qml/Unity'
111=== added file 'tests/qmluitests/Dash/qml/Unity/CMakeLists.txt'
112--- tests/qmluitests/Dash/qml/Unity/CMakeLists.txt 1970-01-01 00:00:00 +0000
113+++ tests/qmluitests/Dash/qml/Unity/CMakeLists.txt 2013-04-16 12:13:28 +0000
114@@ -0,0 +1,36 @@
115+set(CMAKE_AUTOMOC ON)
116+
117+include(FindPkgConfig)
118+find_package(Qt5Core REQUIRED)
119+find_package(Qt5Quick REQUIRED)
120+
121+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wextra -std=c++11")
122+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
123+
124+include_directories(
125+ ${CMAKE_CURRENT_BINARY_DIR}
126+ ${Qt5Core_INCLUDE_DIRS}
127+ ${Qt5Quick_INCLUDE_DIRS}
128+)
129+
130+add_definitions(-DQT_NO_KEYWORDS)
131+
132+set(UnityQML_SOURCES
133+ fake_lens.cpp
134+ fake_lenses.cpp
135+ fake_unity_plugin.cpp
136+ test_unity_object.cpp
137+)
138+
139+add_library(FakeUnityQml MODULE ${UnityQML_SOURCES})
140+target_link_libraries(FakeUnityQml
141+ ${Qt5Core_LIBRARIES}
142+ ${Qt5Quick_LIBRARIES}
143+)
144+
145+qt5_use_modules(FakeUnityQml Qml)
146+
147+# copy qmldir file into build directory for shadow builds
148+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
149+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
150+ )
151
152=== added file 'tests/qmluitests/Dash/qml/Unity/fake_lens.cpp'
153--- tests/qmluitests/Dash/qml/Unity/fake_lens.cpp 1970-01-01 00:00:00 +0000
154+++ tests/qmluitests/Dash/qml/Unity/fake_lens.cpp 2013-04-16 12:13:28 +0000
155@@ -0,0 +1,62 @@
156+/*
157+ * Copyright (C) 2013 Canonical, Ltd.
158+ *
159+ * This program is free software; you can redistribute it and/or modify
160+ * it under the terms of the GNU General Public License as published by
161+ * the Free Software Foundation; version 3.
162+ *
163+ * This program is distributed in the hope that it will be useful,
164+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
165+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
166+ * GNU General Public License for more details.
167+ *
168+ * You should have received a copy of the GNU General Public License
169+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
170+ */
171+
172+// Self
173+#include "fake_lens.h"
174+
175+// TODO: Implement remaining pieces
176+
177+Lens::Lens()
178+: m_visible(false)
179+{}
180+
181+Lens::Lens(QString const& id,
182+ QString const& name,
183+ bool visible)
184+: m_id(id),
185+ m_name(name),
186+ m_visible(visible)
187+{}
188+
189+QString Lens::id() const {
190+ return m_id;
191+}
192+
193+QString Lens::name() const {
194+ return m_name;
195+}
196+
197+QString Lens::searchQuery() const {
198+ return m_searchQuery;
199+}
200+
201+void Lens::setName(const QString &str) {
202+ if (str != m_name) {
203+ m_name = str;
204+ Q_EMIT nameChanged(m_name);
205+ }
206+}
207+
208+void Lens::setSearchQuery(const QString &str) {
209+ if (str != m_searchQuery) {
210+ m_searchQuery = str;
211+ Q_EMIT searchQueryChanged(m_searchQuery);
212+ }
213+}
214+
215+bool Lens::visible() const {
216+ return m_visible;
217+}
218
219=== added file 'tests/qmluitests/Dash/qml/Unity/fake_lens.h'
220--- tests/qmluitests/Dash/qml/Unity/fake_lens.h 1970-01-01 00:00:00 +0000
221+++ tests/qmluitests/Dash/qml/Unity/fake_lens.h 2013-04-16 12:13:28 +0000
222@@ -0,0 +1,56 @@
223+/*
224+ * Copyright (C) 2013 Canonical, Ltd.
225+ *
226+ * This program is free software; you can redistribute it and/or modify
227+ * it under the terms of the GNU General Public License as published by
228+ * the Free Software Foundation; version 3.
229+ *
230+ * This program is distributed in the hope that it will be useful,
231+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
232+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
233+ * GNU General Public License for more details.
234+ *
235+ * You should have received a copy of the GNU General Public License
236+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
237+ */
238+
239+#ifndef FAKE_LENS_H
240+#define FAKE_LENS_H
241+
242+// Qt
243+#include <QObject>
244+
245+class Lens : public QObject
246+{
247+ Q_OBJECT
248+ Q_PROPERTY(QString id READ id NOTIFY idChanged)
249+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
250+ Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
251+ Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
252+
253+public:
254+ Lens();
255+ Lens(QString const& id, QString const& name, bool visible);
256+
257+ QString id() const;
258+ QString name() const;
259+ QString searchQuery() const;
260+ bool visible() const;
261+
262+ void setName(const QString &str);
263+ void setSearchQuery(const QString &str);
264+
265+Q_SIGNALS:
266+ void idChanged(QString);
267+ void nameChanged(QString);
268+ void searchQueryChanged(QString);
269+ void visibleChanged(bool);
270+
271+private:
272+ QString m_id;
273+ QString m_name;
274+ QString m_searchQuery;
275+ bool m_visible;
276+};
277+
278+#endif // FAKE_LENS_H
279
280=== added file 'tests/qmluitests/Dash/qml/Unity/fake_lenses.cpp'
281--- tests/qmluitests/Dash/qml/Unity/fake_lenses.cpp 1970-01-01 00:00:00 +0000
282+++ tests/qmluitests/Dash/qml/Unity/fake_lenses.cpp 2013-04-16 12:13:28 +0000
283@@ -0,0 +1,101 @@
284+/*
285+ * Copyright (C) 2013 Canonical, Ltd.
286+ *
287+ * This program is free software; you can redistribute it and/or modify
288+ * it under the terms of the GNU General Public License as published by
289+ * the Free Software Foundation; version 3.
290+ *
291+ * This program is distributed in the hope that it will be useful,
292+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
293+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
294+ * GNU General Public License for more details.
295+ *
296+ * You should have received a copy of the GNU General Public License
297+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
298+ *
299+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
300+ */
301+
302+// Self
303+#include "fake_lenses.h"
304+
305+// TODO: Implement remaining pieces, like Categories (i.e. LensView now gives warnings)
306+
307+Lenses::Lenses(QObject *parent)
308+: QAbstractListModel(parent)
309+{
310+ m_roles[Lenses::RoleLens] = "lens";
311+ m_roles[Lenses::RoleId] = "id";
312+ m_roles[Lenses::RoleVisible] = "visible";
313+
314+ m_lenses << (new Lens("MockLens1", "People", true))
315+ << (new Lens("MockLens2", "Music", true))
316+ << (new Lens("MockLens3", "Home", false))
317+ << (new Lens("MockLens4", "Apps", true))
318+ << (new Lens("MockLens5", "Video", true));
319+}
320+
321+Lenses::~Lenses()
322+{
323+ qDeleteAll(m_lenses);
324+ m_lenses.clear();
325+}
326+
327+QHash<int, QByteArray> Lenses::roleNames() const
328+{
329+ return m_roles;
330+}
331+
332+int Lenses::rowCount(const QModelIndex&) const
333+{
334+ return m_lenses.count();
335+}
336+
337+QVariant Lenses::data(const QModelIndex& index, int role) const
338+{
339+ Q_UNUSED(role)
340+
341+ if (!index.isValid() || index.row() >= m_lenses.size()) {
342+ return QVariant();
343+ }
344+
345+ Lens* lens = m_lenses.at(index.row());
346+
347+ if (role == Lenses::RoleLens) {
348+ return QVariant::fromValue(lens);
349+ } else if (role == Lenses::RoleId) {
350+ return QVariant::fromValue(lens->id());
351+ } else if (role == Lenses::RoleVisible) {
352+ return QVariant::fromValue(lens->visible());
353+ } else {
354+ return QVariant();
355+ }
356+}
357+
358+QVariant Lenses::get(int row) const
359+{
360+ return data(QAbstractListModel::index(row), 0);
361+}
362+
363+QVariant Lenses::get(QString const&) const
364+{
365+ return QVariant();
366+}
367+
368+QModelIndex Lenses::parent(const QModelIndex&) const
369+{
370+ return QModelIndex();
371+}
372+
373+bool Lenses::loaded() const
374+{
375+ return true;
376+}
377+
378+void Lenses::addLens(Lens* lens)
379+{
380+ int index = rowCount();
381+ beginInsertRows(QModelIndex(), index, index);
382+ m_lenses.append(lens);
383+ endInsertRows();
384+}
385
386=== added file 'tests/qmluitests/Dash/qml/Unity/fake_lenses.h'
387--- tests/qmluitests/Dash/qml/Unity/fake_lenses.h 1970-01-01 00:00:00 +0000
388+++ tests/qmluitests/Dash/qml/Unity/fake_lenses.h 2013-04-16 12:13:28 +0000
389@@ -0,0 +1,69 @@
390+/*
391+ * Copyright (C) 2013 Canonical, Ltd.
392+ *
393+ * This program is free software; you can redistribute it and/or modify
394+ * it under the terms of the GNU General Public License as published by
395+ * the Free Software Foundation; version 3.
396+ *
397+ * This program is distributed in the hope that it will be useful,
398+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
399+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
400+ * GNU General Public License for more details.
401+ *
402+ * You should have received a copy of the GNU General Public License
403+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
404+ *
405+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
406+ */
407+
408+#ifndef FAKE_LENSES_H
409+#define FAKE_LENSES_H
410+
411+// Local
412+#include "fake_lens.h"
413+
414+// Qt
415+#include <QAbstractListModel>
416+#include <QList>
417+
418+class Lenses : public QAbstractListModel
419+{
420+ Q_OBJECT
421+ Q_ENUMS(Roles)
422+ Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
423+
424+public:
425+ explicit Lenses(QObject *parent = 0);
426+ ~Lenses();
427+
428+ enum Roles {
429+ RoleLens,
430+ RoleId,
431+ RoleVisible
432+ };
433+
434+ Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const;
435+
436+ Q_INVOKABLE QVariant get(int row) const;
437+ Q_INVOKABLE QVariant get(const QString& lens_id) const;
438+
439+ Q_INVOKABLE void addLens(Lens* lens);
440+
441+
442+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
443+ QHash<int, QByteArray> roleNames() const;
444+ QModelIndex parent ( const QModelIndex & index ) const;
445+
446+ bool loaded() const;
447+
448+Q_SIGNALS:
449+ void activateLensRequested(const QString& lens_id);
450+ void loadedChanged(bool);
451+
452+private:
453+ QList<Lens*> m_lenses;
454+ QHash<int, QByteArray> m_roles;
455+ bool m_loaded;
456+};
457+
458+#endif // LENSES_H
459
460=== added file 'tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.cpp'
461--- tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.cpp 1970-01-01 00:00:00 +0000
462+++ tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.cpp 2013-04-16 12:13:28 +0000
463@@ -0,0 +1,34 @@
464+/*
465+ * Copyright (C) 2013 Canonical, Ltd.
466+ *
467+ * This program is free software; you can redistribute it and/or modify
468+ * it under the terms of the GNU General Public License as published by
469+ * the Free Software Foundation; version 3.
470+ *
471+ * This program is distributed in the hope that it will be useful,
472+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
473+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
474+ * GNU General Public License for more details.
475+ *
476+ * You should have received a copy of the GNU General Public License
477+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
478+ *
479+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
480+ */
481+
482+// Self
483+#include "fake_unity_plugin.h"
484+#include "fake_lenses.h"
485+#include "test_unity_object.h"
486+
487+// Qt
488+#include <QtQml>
489+
490+void FakeUnityPlugin::registerTypes(const char *uri)
491+{
492+ Q_ASSERT(uri == QLatin1String("Unity"));
493+
494+ qmlRegisterType<UnityTestObject>(uri, 0, 1, "UnityTestObject");
495+ qmlRegisterType<Lenses>(uri, 0, 1, "Lenses");
496+ qmlRegisterType<Lens>(uri, 0, 1, "Lens");
497+}
498
499=== added file 'tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.h'
500--- tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.h 1970-01-01 00:00:00 +0000
501+++ tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.h 2013-04-16 12:13:28 +0000
502@@ -0,0 +1,34 @@
503+/*
504+ * Copyright (C) 2013 Canonical, Ltd.
505+ *
506+ * This program is free software; you can redistribute it and/or modify
507+ * it under the terms of the GNU General Public License as published by
508+ * the Free Software Foundation; version 3.
509+ *
510+ * This program is distributed in the hope that it will be useful,
511+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
512+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
513+ * GNU General Public License for more details.
514+ *
515+ * You should have received a copy of the GNU General Public License
516+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
517+ *
518+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
519+ */
520+
521+#ifndef FAKE_UNITY_PLUGIN_H
522+#define FAKE_UNITY_PLUGIN_H
523+
524+// Qt
525+#include <QtQml/QQmlExtensionPlugin>
526+
527+class FakeUnityPlugin : public QQmlExtensionPlugin
528+{
529+ Q_OBJECT
530+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
531+
532+public:
533+ void registerTypes(const char *uri);
534+};
535+
536+#endif
537
538=== added file 'tests/qmluitests/Dash/qml/Unity/qmldir'
539--- tests/qmluitests/Dash/qml/Unity/qmldir 1970-01-01 00:00:00 +0000
540+++ tests/qmluitests/Dash/qml/Unity/qmldir 2013-04-16 12:13:28 +0000
541@@ -0,0 +1,2 @@
542+module Unity
543+plugin FakeUnityQml
544
545=== added file 'tests/qmluitests/Dash/qml/Unity/test_unity_object.cpp'
546--- tests/qmluitests/Dash/qml/Unity/test_unity_object.cpp 1970-01-01 00:00:00 +0000
547+++ tests/qmluitests/Dash/qml/Unity/test_unity_object.cpp 2013-04-16 12:13:28 +0000
548@@ -0,0 +1,25 @@
549+/*
550+ * Copyright (C) 2012 Canonical, Ltd.
551+ *
552+ * This program is free software; you can redistribute it and/or modify
553+ * it under the terms of the GNU General Public License as published by
554+ * the Free Software Foundation; version 3.
555+ *
556+ * This program is distributed in the hope that it will be useful,
557+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
558+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
559+ * GNU General Public License for more details.
560+ *
561+ * You should have received a copy of the GNU General Public License
562+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
563+ *
564+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
565+ */
566+
567+// Self
568+#include "test_unity_object.h"
569+
570+QString UnityTestObject::testParameter() const
571+{
572+ return "test_result";
573+}
574
575=== added file 'tests/qmluitests/Dash/qml/Unity/test_unity_object.h'
576--- tests/qmluitests/Dash/qml/Unity/test_unity_object.h 1970-01-01 00:00:00 +0000
577+++ tests/qmluitests/Dash/qml/Unity/test_unity_object.h 2013-04-16 12:13:28 +0000
578@@ -0,0 +1,34 @@
579+/*
580+ * Copyright (C) 2012 Canonical, Ltd.
581+ *
582+ * This program is free software; you can redistribute it and/or modify
583+ * it under the terms of the GNU General Public License as published by
584+ * the Free Software Foundation; version 3.
585+ *
586+ * This program is distributed in the hope that it will be useful,
587+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
588+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
589+ * GNU General Public License for more details.
590+ *
591+ * You should have received a copy of the GNU General Public License
592+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
593+ *
594+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
595+ */
596+
597+#ifndef PLUGIN_H
598+#define PLUGIN_H
599+
600+// Qt
601+#include <QObject>
602+
603+class UnityTestObject : public QObject
604+{
605+ Q_OBJECT
606+ Q_PROPERTY(QString testParameter READ testParameter)
607+
608+public:
609+ QString testParameter() const;
610+};
611+
612+#endif // PLUGIN_H
613
614=== added file 'tests/qmluitests/Dash/qml/fake_generic_lensView.qml'
615--- tests/qmluitests/Dash/qml/fake_generic_lensView.qml 1970-01-01 00:00:00 +0000
616+++ tests/qmluitests/Dash/qml/fake_generic_lensView.qml 2013-04-16 12:13:28 +0000
617@@ -0,0 +1,24 @@
618+/*
619+ * Copyright 2013 Canonical Ltd.
620+ *
621+ * This program is free software; you can redistribute it and/or modify
622+ * it under the terms of the GNU General Public License as published by
623+ * the Free Software Foundation; version 3.
624+ *
625+ * This program is distributed in the hope that it will be useful,
626+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
627+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
628+ * GNU General Public License for more details.
629+ *
630+ * You should have received a copy of the GNU General Public License
631+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
632+ */
633+
634+import QtQuick 2.0
635+
636+FakeLensView {
637+ id: fake_generic_lensView
638+ objectName: "fake_generic_lensView"
639+
640+ ball_color: "orange"
641+}
642
643=== added file 'tests/qmluitests/Dash/qml/fake_lensView1.qml'
644--- tests/qmluitests/Dash/qml/fake_lensView1.qml 1970-01-01 00:00:00 +0000
645+++ tests/qmluitests/Dash/qml/fake_lensView1.qml 2013-04-16 12:13:28 +0000
646@@ -0,0 +1,24 @@
647+/*
648+ * Copyright 2013 Canonical Ltd.
649+ *
650+ * This program is free software; you can redistribute it and/or modify
651+ * it under the terms of the GNU General Public License as published by
652+ * the Free Software Foundation; version 3.
653+ *
654+ * This program is distributed in the hope that it will be useful,
655+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
656+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
657+ * GNU General Public License for more details.
658+ *
659+ * You should have received a copy of the GNU General Public License
660+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
661+ */
662+
663+import QtQuick 2.0
664+
665+FakeLensView {
666+ id: fake_lensView1
667+ objectName: "fake_lensView1"
668+
669+ ball_color: "red"
670+}
671
672=== added file 'tests/qmluitests/Dash/qml/fake_lensView2.qml'
673--- tests/qmluitests/Dash/qml/fake_lensView2.qml 1970-01-01 00:00:00 +0000
674+++ tests/qmluitests/Dash/qml/fake_lensView2.qml 2013-04-16 12:13:28 +0000
675@@ -0,0 +1,24 @@
676+/*
677+ * Copyright 2013 Canonical Ltd.
678+ *
679+ * This program is free software; you can redistribute it and/or modify
680+ * it under the terms of the GNU General Public License as published by
681+ * the Free Software Foundation; version 3.
682+ *
683+ * This program is distributed in the hope that it will be useful,
684+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
685+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
686+ * GNU General Public License for more details.
687+ *
688+ * You should have received a copy of the GNU General Public License
689+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
690+ */
691+
692+import QtQuick 2.0
693+
694+FakeLensView {
695+ id: fake_lensView2
696+ objectName: "fake_lensView2"
697+
698+ ball_color: "blue"
699+}
700
701=== added file 'tests/qmluitests/Dash/qml/fake_lensView3.qml'
702--- tests/qmluitests/Dash/qml/fake_lensView3.qml 1970-01-01 00:00:00 +0000
703+++ tests/qmluitests/Dash/qml/fake_lensView3.qml 2013-04-16 12:13:28 +0000
704@@ -0,0 +1,24 @@
705+/*
706+ * Copyright 2013 Canonical Ltd.
707+ *
708+ * This program is free software; you can redistribute it and/or modify
709+ * it under the terms of the GNU General Public License as published by
710+ * the Free Software Foundation; version 3.
711+ *
712+ * This program is distributed in the hope that it will be useful,
713+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
714+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
715+ * GNU General Public License for more details.
716+ *
717+ * You should have received a copy of the GNU General Public License
718+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
719+ */
720+
721+import QtQuick 2.0
722+
723+FakeLensView {
724+ id: fake_lensView3
725+ objectName: "fake_lensView3"
726+
727+ ball_color: "green"
728+}
729
730=== added file 'tests/qmluitests/Dash/qml/fake_lensView4.qml'
731--- tests/qmluitests/Dash/qml/fake_lensView4.qml 1970-01-01 00:00:00 +0000
732+++ tests/qmluitests/Dash/qml/fake_lensView4.qml 2013-04-16 12:13:28 +0000
733@@ -0,0 +1,24 @@
734+/*
735+ * Copyright 2013 Canonical Ltd.
736+ *
737+ * This program is free software; you can redistribute it and/or modify
738+ * it under the terms of the GNU General Public License as published by
739+ * the Free Software Foundation; version 3.
740+ *
741+ * This program is distributed in the hope that it will be useful,
742+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
743+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
744+ * GNU General Public License for more details.
745+ *
746+ * You should have received a copy of the GNU General Public License
747+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
748+ */
749+
750+import QtQuick 2.0
751+
752+FakeLensView {
753+ id: fake_lensView4
754+ objectName: "fake_lensView4"
755+
756+ ball_color: "grey"
757+}
758
759=== added file 'tests/qmluitests/Dash/tst_DashContent.qml'
760--- tests/qmluitests/Dash/tst_DashContent.qml 1970-01-01 00:00:00 +0000
761+++ tests/qmluitests/Dash/tst_DashContent.qml 2013-04-16 12:13:28 +0000
762@@ -0,0 +1,60 @@
763+/*
764+ * Copyright 2013 Canonical Ltd.
765+ *
766+ * This program is free software; you can redistribute it and/or modify
767+ * it under the terms of the GNU General Public License as published by
768+ * the Free Software Foundation; version 3.
769+ *
770+ * This program is distributed in the hope that it will be useful,
771+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
772+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
773+ * GNU General Public License for more details.
774+ *
775+ * You should have received a copy of the GNU General Public License
776+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
777+ */
778+
779+import QtQuick 2.0
780+import QtTest 1.0
781+import ".."
782+import "../../../Dash"
783+
784+import Unity 0.1
785+
786+Item {
787+ id: shell
788+ width: units.gu(40)
789+ height: units.gu(80)
790+
791+ property ListModel searchHistory: ListModel {}
792+
793+ Lenses {
794+ id: lensesModel
795+ }
796+
797+ DashContent {
798+ id: dash_content
799+ anchors.fill: parent
800+
801+ model: lensesModel
802+ lenses : lensesModel
803+
804+
805+ lensDelegateMapping: { "MockLens1" : "../tests/qmluitests/Dash/qml/fake_lensView1.qml",
806+ "MockLens2" : "../tests/qmluitests/Dash/qml/fake_lensView2.qml",
807+ "MockLens3" : "../tests/qmluitests/Dash/qml/fake_lensView3.qml",
808+ "MockLens4" : "../tests/qmluitests/Dash/qml/fake_lensView4.qml"
809+ }
810+
811+ genericLens: "../tests/qmluitests/Dash/qml/fake_generic_lensView.qml"
812+ }
813+
814+ UnityTestCase {
815+ name: "DashContentTest"
816+ when: windowShown
817+
818+ function test_() {
819+
820+ }
821+ }
822+}
823
824=== added file 'tests/qmluitests/Dash/tst_LensView.qml'
825--- tests/qmluitests/Dash/tst_LensView.qml 1970-01-01 00:00:00 +0000
826+++ tests/qmluitests/Dash/tst_LensView.qml 2013-04-16 12:13:28 +0000
827@@ -0,0 +1,52 @@
828+/*
829+ * Copyright 2013 Canonical Ltd.
830+ *
831+ * This program is free software; you can redistribute it and/or modify
832+ * it under the terms of the GNU General Public License as published by
833+ * the Free Software Foundation; version 3.
834+ *
835+ * This program is distributed in the hope that it will be useful,
836+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
837+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
838+ * GNU General Public License for more details.
839+ *
840+ * You should have received a copy of the GNU General Public License
841+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
842+ */
843+
844+import QtQuick 2.0
845+import QtTest 1.0
846+import Unity 0.1
847+import ".."
848+import "../../../Dash"
849+import Ubuntu.Components 0.1
850+
851+Item {
852+ width: units.gu(120)
853+ height: units.gu(80)
854+
855+ Lenses {
856+ id: lenses
857+ }
858+
859+ LensView {
860+ id: lensView
861+ anchors.fill: parent
862+
863+ Component.onCompleted: lens = lenses.get(0)
864+
865+ TestCase {
866+ name: "LensView"
867+
868+ function init() {
869+ lensView.lens = lenses.get(0)
870+ }
871+
872+ function test_changeLens() {
873+ lensView.lens.searchQuery = "test"
874+ lensView.lens = lenses.get(1)
875+ compare(lensView.lens.searchQuery, "", "searchQuery should be empty")
876+ }
877+ }
878+ }
879+}

Subscribers

People subscribed via source and target branches

to all changes: