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
=== modified file 'tests/qmluitests/Dash/CMakeLists.txt'
--- tests/qmluitests/Dash/CMakeLists.txt 2013-04-11 15:05:45 +0000
+++ tests/qmluitests/Dash/CMakeLists.txt 2013-04-16 12:13:28 +0000
@@ -1,2 +1,5 @@
1add_subdirectory(qml)
2
1add_qml_test(DashPreview)3add_qml_test(DashPreview)
4add_qml_test(LensView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/qml)
2add_qml_test(PeoplePreview)5add_qml_test(PeoplePreview)
36
=== added directory 'tests/qmluitests/Dash/qml'
=== added file 'tests/qmluitests/Dash/qml/CMakeLists.txt'
--- tests/qmluitests/Dash/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/CMakeLists.txt 2013-04-16 12:13:28 +0000
@@ -0,0 +1,1 @@
1add_subdirectory(Unity)
02
=== added file 'tests/qmluitests/Dash/qml/FakeLensView.qml'
--- tests/qmluitests/Dash/qml/FakeLensView.qml 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/FakeLensView.qml 2013-04-16 12:13:28 +0000
@@ -0,0 +1,87 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Unity 0.1
19import Ubuntu.Components 0.1
20
21FocusScope {
22 property Lens lens
23 property bool isCurrent : false
24
25 property var ball_color
26
27 Text {
28 id: label
29 anchors {
30 top: parent.top
31 left: parent.left
32 right: parent.right
33 }
34 height: units.gu(5)
35 text: lens.id
36
37 verticalAlignment: Text.AlignVCenter
38 horizontalAlignment: Text.AlignHCenter
39 }
40
41 Rectangle {
42 id: bounce_area
43 anchors {
44 top: label.bottom
45 left: parent.left
46 right: parent.right
47 bottom: parent.bottom
48 }
49 clip: true
50
51 Rectangle {
52 id: ball
53 width: units.gu(5)
54 height: units.gu(5)
55 radius: width*0.5
56
57 border.width: 1
58 border.color: "black"
59 color: ball_color
60
61 Component.onCompleted: { x = 100; y = 100; }
62
63 Behavior on x {
64 NumberAnimation {
65 id: x_animate; duration: 500
66
67 onRunningChanged: {
68 if (!running) {
69 ball.x = ball.radius + Math.random() * (bounce_area.width - ball.width);
70 }
71 }
72 }
73 }
74 Behavior on y {
75 NumberAnimation {
76 id: y_animate; duration: 500
77
78 onRunningChanged: {
79 if (!running) {
80 ball.y = ball.radius + Math.random() * (bounce_area.height - ball.height);
81 }
82 }
83 }
84 }
85 }
86 }
87}
088
=== added directory 'tests/qmluitests/Dash/qml/Unity'
=== added file 'tests/qmluitests/Dash/qml/Unity/CMakeLists.txt'
--- tests/qmluitests/Dash/qml/Unity/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/Unity/CMakeLists.txt 2013-04-16 12:13:28 +0000
@@ -0,0 +1,36 @@
1set(CMAKE_AUTOMOC ON)
2
3include(FindPkgConfig)
4find_package(Qt5Core REQUIRED)
5find_package(Qt5Quick REQUIRED)
6
7set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wextra -std=c++11")
8set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
9
10include_directories(
11 ${CMAKE_CURRENT_BINARY_DIR}
12 ${Qt5Core_INCLUDE_DIRS}
13 ${Qt5Quick_INCLUDE_DIRS}
14)
15
16add_definitions(-DQT_NO_KEYWORDS)
17
18set(UnityQML_SOURCES
19 fake_lens.cpp
20 fake_lenses.cpp
21 fake_unity_plugin.cpp
22 test_unity_object.cpp
23)
24
25add_library(FakeUnityQml MODULE ${UnityQML_SOURCES})
26target_link_libraries(FakeUnityQml
27 ${Qt5Core_LIBRARIES}
28 ${Qt5Quick_LIBRARIES}
29)
30
31qt5_use_modules(FakeUnityQml Qml)
32
33# copy qmldir file into build directory for shadow builds
34file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
35 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
36 )
037
=== added file 'tests/qmluitests/Dash/qml/Unity/fake_lens.cpp'
--- tests/qmluitests/Dash/qml/Unity/fake_lens.cpp 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/Unity/fake_lens.cpp 2013-04-16 12:13:28 +0000
@@ -0,0 +1,62 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17// Self
18#include "fake_lens.h"
19
20// TODO: Implement remaining pieces
21
22Lens::Lens()
23: m_visible(false)
24{}
25
26Lens::Lens(QString const& id,
27 QString const& name,
28 bool visible)
29: m_id(id),
30 m_name(name),
31 m_visible(visible)
32{}
33
34QString Lens::id() const {
35 return m_id;
36}
37
38QString Lens::name() const {
39 return m_name;
40}
41
42QString Lens::searchQuery() const {
43 return m_searchQuery;
44}
45
46void Lens::setName(const QString &str) {
47 if (str != m_name) {
48 m_name = str;
49 Q_EMIT nameChanged(m_name);
50 }
51}
52
53void Lens::setSearchQuery(const QString &str) {
54 if (str != m_searchQuery) {
55 m_searchQuery = str;
56 Q_EMIT searchQueryChanged(m_searchQuery);
57 }
58}
59
60bool Lens::visible() const {
61 return m_visible;
62}
063
=== added file 'tests/qmluitests/Dash/qml/Unity/fake_lens.h'
--- tests/qmluitests/Dash/qml/Unity/fake_lens.h 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/Unity/fake_lens.h 2013-04-16 12:13:28 +0000
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef FAKE_LENS_H
18#define FAKE_LENS_H
19
20// Qt
21#include <QObject>
22
23class Lens : public QObject
24{
25 Q_OBJECT
26 Q_PROPERTY(QString id READ id NOTIFY idChanged)
27 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
28 Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
29 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
30
31public:
32 Lens();
33 Lens(QString const& id, QString const& name, bool visible);
34
35 QString id() const;
36 QString name() const;
37 QString searchQuery() const;
38 bool visible() const;
39
40 void setName(const QString &str);
41 void setSearchQuery(const QString &str);
42
43Q_SIGNALS:
44 void idChanged(QString);
45 void nameChanged(QString);
46 void searchQueryChanged(QString);
47 void visibleChanged(bool);
48
49private:
50 QString m_id;
51 QString m_name;
52 QString m_searchQuery;
53 bool m_visible;
54};
55
56#endif // FAKE_LENS_H
057
=== added file 'tests/qmluitests/Dash/qml/Unity/fake_lenses.cpp'
--- tests/qmluitests/Dash/qml/Unity/fake_lenses.cpp 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/Unity/fake_lenses.cpp 2013-04-16 12:13:28 +0000
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
17 */
18
19// Self
20#include "fake_lenses.h"
21
22// TODO: Implement remaining pieces, like Categories (i.e. LensView now gives warnings)
23
24Lenses::Lenses(QObject *parent)
25: QAbstractListModel(parent)
26{
27 m_roles[Lenses::RoleLens] = "lens";
28 m_roles[Lenses::RoleId] = "id";
29 m_roles[Lenses::RoleVisible] = "visible";
30
31 m_lenses << (new Lens("MockLens1", "People", true))
32 << (new Lens("MockLens2", "Music", true))
33 << (new Lens("MockLens3", "Home", false))
34 << (new Lens("MockLens4", "Apps", true))
35 << (new Lens("MockLens5", "Video", true));
36}
37
38Lenses::~Lenses()
39{
40 qDeleteAll(m_lenses);
41 m_lenses.clear();
42}
43
44QHash<int, QByteArray> Lenses::roleNames() const
45{
46 return m_roles;
47}
48
49int Lenses::rowCount(const QModelIndex&) const
50{
51 return m_lenses.count();
52}
53
54QVariant Lenses::data(const QModelIndex& index, int role) const
55{
56 Q_UNUSED(role)
57
58 if (!index.isValid() || index.row() >= m_lenses.size()) {
59 return QVariant();
60 }
61
62 Lens* lens = m_lenses.at(index.row());
63
64 if (role == Lenses::RoleLens) {
65 return QVariant::fromValue(lens);
66 } else if (role == Lenses::RoleId) {
67 return QVariant::fromValue(lens->id());
68 } else if (role == Lenses::RoleVisible) {
69 return QVariant::fromValue(lens->visible());
70 } else {
71 return QVariant();
72 }
73}
74
75QVariant Lenses::get(int row) const
76{
77 return data(QAbstractListModel::index(row), 0);
78}
79
80QVariant Lenses::get(QString const&) const
81{
82 return QVariant();
83}
84
85QModelIndex Lenses::parent(const QModelIndex&) const
86{
87 return QModelIndex();
88}
89
90bool Lenses::loaded() const
91{
92 return true;
93}
94
95void Lenses::addLens(Lens* lens)
96{
97 int index = rowCount();
98 beginInsertRows(QModelIndex(), index, index);
99 m_lenses.append(lens);
100 endInsertRows();
101}
0102
=== added file 'tests/qmluitests/Dash/qml/Unity/fake_lenses.h'
--- tests/qmluitests/Dash/qml/Unity/fake_lenses.h 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/Unity/fake_lenses.h 2013-04-16 12:13:28 +0000
@@ -0,0 +1,69 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
17 */
18
19#ifndef FAKE_LENSES_H
20#define FAKE_LENSES_H
21
22// Local
23#include "fake_lens.h"
24
25// Qt
26#include <QAbstractListModel>
27#include <QList>
28
29class Lenses : public QAbstractListModel
30{
31 Q_OBJECT
32 Q_ENUMS(Roles)
33 Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
34
35public:
36 explicit Lenses(QObject *parent = 0);
37 ~Lenses();
38
39 enum Roles {
40 RoleLens,
41 RoleId,
42 RoleVisible
43 };
44
45 Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const;
46
47 Q_INVOKABLE QVariant get(int row) const;
48 Q_INVOKABLE QVariant get(const QString& lens_id) const;
49
50 Q_INVOKABLE void addLens(Lens* lens);
51
52
53 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
54 QHash<int, QByteArray> roleNames() const;
55 QModelIndex parent ( const QModelIndex & index ) const;
56
57 bool loaded() const;
58
59Q_SIGNALS:
60 void activateLensRequested(const QString& lens_id);
61 void loadedChanged(bool);
62
63private:
64 QList<Lens*> m_lenses;
65 QHash<int, QByteArray> m_roles;
66 bool m_loaded;
67};
68
69#endif // LENSES_H
070
=== added file 'tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.cpp'
--- tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.cpp 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.cpp 2013-04-16 12:13:28 +0000
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
17 */
18
19// Self
20#include "fake_unity_plugin.h"
21#include "fake_lenses.h"
22#include "test_unity_object.h"
23
24// Qt
25#include <QtQml>
26
27void FakeUnityPlugin::registerTypes(const char *uri)
28{
29 Q_ASSERT(uri == QLatin1String("Unity"));
30
31 qmlRegisterType<UnityTestObject>(uri, 0, 1, "UnityTestObject");
32 qmlRegisterType<Lenses>(uri, 0, 1, "Lenses");
33 qmlRegisterType<Lens>(uri, 0, 1, "Lens");
34}
035
=== added file 'tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.h'
--- tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.h 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/Unity/fake_unity_plugin.h 2013-04-16 12:13:28 +0000
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
17 */
18
19#ifndef FAKE_UNITY_PLUGIN_H
20#define FAKE_UNITY_PLUGIN_H
21
22// Qt
23#include <QtQml/QQmlExtensionPlugin>
24
25class FakeUnityPlugin : public QQmlExtensionPlugin
26{
27 Q_OBJECT
28 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
29
30public:
31 void registerTypes(const char *uri);
32};
33
34#endif
035
=== added file 'tests/qmluitests/Dash/qml/Unity/qmldir'
--- tests/qmluitests/Dash/qml/Unity/qmldir 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/Unity/qmldir 2013-04-16 12:13:28 +0000
@@ -0,0 +1,2 @@
1module Unity
2plugin FakeUnityQml
03
=== added file 'tests/qmluitests/Dash/qml/Unity/test_unity_object.cpp'
--- tests/qmluitests/Dash/qml/Unity/test_unity_object.cpp 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/Unity/test_unity_object.cpp 2013-04-16 12:13:28 +0000
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2012 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
17 */
18
19// Self
20#include "test_unity_object.h"
21
22QString UnityTestObject::testParameter() const
23{
24 return "test_result";
25}
026
=== added file 'tests/qmluitests/Dash/qml/Unity/test_unity_object.h'
--- tests/qmluitests/Dash/qml/Unity/test_unity_object.h 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/Unity/test_unity_object.h 2013-04-16 12:13:28 +0000
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2012 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
17 */
18
19#ifndef PLUGIN_H
20#define PLUGIN_H
21
22// Qt
23#include <QObject>
24
25class UnityTestObject : public QObject
26{
27 Q_OBJECT
28 Q_PROPERTY(QString testParameter READ testParameter)
29
30public:
31 QString testParameter() const;
32};
33
34#endif // PLUGIN_H
035
=== added file 'tests/qmluitests/Dash/qml/fake_generic_lensView.qml'
--- tests/qmluitests/Dash/qml/fake_generic_lensView.qml 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/fake_generic_lensView.qml 2013-04-16 12:13:28 +0000
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19FakeLensView {
20 id: fake_generic_lensView
21 objectName: "fake_generic_lensView"
22
23 ball_color: "orange"
24}
025
=== added file 'tests/qmluitests/Dash/qml/fake_lensView1.qml'
--- tests/qmluitests/Dash/qml/fake_lensView1.qml 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/fake_lensView1.qml 2013-04-16 12:13:28 +0000
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19FakeLensView {
20 id: fake_lensView1
21 objectName: "fake_lensView1"
22
23 ball_color: "red"
24}
025
=== added file 'tests/qmluitests/Dash/qml/fake_lensView2.qml'
--- tests/qmluitests/Dash/qml/fake_lensView2.qml 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/fake_lensView2.qml 2013-04-16 12:13:28 +0000
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19FakeLensView {
20 id: fake_lensView2
21 objectName: "fake_lensView2"
22
23 ball_color: "blue"
24}
025
=== added file 'tests/qmluitests/Dash/qml/fake_lensView3.qml'
--- tests/qmluitests/Dash/qml/fake_lensView3.qml 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/fake_lensView3.qml 2013-04-16 12:13:28 +0000
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19FakeLensView {
20 id: fake_lensView3
21 objectName: "fake_lensView3"
22
23 ball_color: "green"
24}
025
=== added file 'tests/qmluitests/Dash/qml/fake_lensView4.qml'
--- tests/qmluitests/Dash/qml/fake_lensView4.qml 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/qml/fake_lensView4.qml 2013-04-16 12:13:28 +0000
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19FakeLensView {
20 id: fake_lensView4
21 objectName: "fake_lensView4"
22
23 ball_color: "grey"
24}
025
=== added file 'tests/qmluitests/Dash/tst_DashContent.qml'
--- tests/qmluitests/Dash/tst_DashContent.qml 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/tst_DashContent.qml 2013-04-16 12:13:28 +0000
@@ -0,0 +1,60 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtTest 1.0
19import ".."
20import "../../../Dash"
21
22import Unity 0.1
23
24Item {
25 id: shell
26 width: units.gu(40)
27 height: units.gu(80)
28
29 property ListModel searchHistory: ListModel {}
30
31 Lenses {
32 id: lensesModel
33 }
34
35 DashContent {
36 id: dash_content
37 anchors.fill: parent
38
39 model: lensesModel
40 lenses : lensesModel
41
42
43 lensDelegateMapping: { "MockLens1" : "../tests/qmluitests/Dash/qml/fake_lensView1.qml",
44 "MockLens2" : "../tests/qmluitests/Dash/qml/fake_lensView2.qml",
45 "MockLens3" : "../tests/qmluitests/Dash/qml/fake_lensView3.qml",
46 "MockLens4" : "../tests/qmluitests/Dash/qml/fake_lensView4.qml"
47 }
48
49 genericLens: "../tests/qmluitests/Dash/qml/fake_generic_lensView.qml"
50 }
51
52 UnityTestCase {
53 name: "DashContentTest"
54 when: windowShown
55
56 function test_() {
57
58 }
59 }
60}
061
=== added file 'tests/qmluitests/Dash/tst_LensView.qml'
--- tests/qmluitests/Dash/tst_LensView.qml 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/tst_LensView.qml 2013-04-16 12:13:28 +0000
@@ -0,0 +1,52 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtTest 1.0
19import Unity 0.1
20import ".."
21import "../../../Dash"
22import Ubuntu.Components 0.1
23
24Item {
25 width: units.gu(120)
26 height: units.gu(80)
27
28 Lenses {
29 id: lenses
30 }
31
32 LensView {
33 id: lensView
34 anchors.fill: parent
35
36 Component.onCompleted: lens = lenses.get(0)
37
38 TestCase {
39 name: "LensView"
40
41 function init() {
42 lensView.lens = lenses.get(0)
43 }
44
45 function test_changeLens() {
46 lensView.lens.searchQuery = "test"
47 lensView.lens = lenses.get(1)
48 compare(lensView.lens.searchQuery, "", "searchQuery should be empty")
49 }
50 }
51 }
52}

Subscribers

People subscribed via source and target branches

to all changes: