Merge lp:~mzanetti/unity-api/appdrawermodelinterface into lp:unity-api

Proposed by Michael Zanetti
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 263
Merged at revision: 257
Proposed branch: lp:~mzanetti/unity-api/appdrawermodelinterface
Merge into: lp:unity-api
Prerequisite: lp:~ci-train-bot/unity-api/unity-api-ubuntu-zesty-2202
Diff against target: 471 lines (+273/-11)
11 files modified
debian/changelog (+6/-0)
include/unity/shell/launcher/AppDrawerModelInterface.h (+71/-0)
include/unity/shell/launcher/CMakeLists.txt (+1/-1)
include/unity/shell/launcher/LauncherItemInterface.h (+10/-6)
test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt (+2/-0)
test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp (+89/-0)
test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h (+38/-0)
test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp (+14/-0)
test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h (+6/-0)
test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp (+4/-0)
test/qmltest/unity/shell/launcher/tst_Launcher.qml (+32/-4)
To merge this branch: bzr merge lp:~mzanetti/unity-api/appdrawermodelinterface
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Approve
Unity8 CI Bot continuous-integration Approve
Ubuntu Unity PS integration team Pending
Review via email: mp+312140@code.launchpad.net

This proposal supersedes a proposal from 2016-11-04.

Commit message

Add AppDrawerModelInterface

Description of the change

Requires: lp:~mzanetti/unity8/appdrawer

See silo 2150 for working builds.

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:261
https://unity8-jenkins.ubuntu.com/job/lp-unity-api-ci/111/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/3382/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3410
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3261/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3261/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3261/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3261/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3261/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3261/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3261/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3261/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3261/console

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity-api-ci/111/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal

LGTM, works fine with the u8 appdrawer branch

CI failing because of lp:1642673, passing locally

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:263
https://unity8-jenkins.ubuntu.com/job/lp-unity-api-ci/115/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3427
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3455
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3302/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3302/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3302/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3302/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3302/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3302/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity-api-ci/115/rebuild

review: Approve (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Re-approving after after having been resubmitted

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2016-11-30 10:47:05 +0000
+++ debian/changelog 2016-11-30 10:47:05 +0000
@@ -1,3 +1,9 @@
1unity-api (7.121) UNRELEASED; urgency=medium
2
3 * Add AppDrawerModelInterface
4
5 -- Michael Zanetti <michael.zanetti@canonical.com> Thu, 10 Nov 2016 19:14:25 +0100
6
1unity-api (7.120+17.04.20161123-0ubuntu1) zesty; urgency=medium7unity-api (7.120+17.04.20161123-0ubuntu1) zesty; urgency=medium
28
3 [ Andrea Azzarone ]9 [ Andrea Azzarone ]
410
=== added file 'include/unity/shell/launcher/AppDrawerModelInterface.h'
--- include/unity/shell/launcher/AppDrawerModelInterface.h 1970-01-01 00:00:00 +0000
+++ include/unity/shell/launcher/AppDrawerModelInterface.h 2016-11-30 10:47:05 +0000
@@ -0,0 +1,71 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include <unity/SymbolExport.h>
20
21#include <QAbstractListModel>
22
23namespace unity {
24namespace shell {
25namespace launcher {
26
27/**
28 * @brief A list of app drawer items to be displayed
29 *
30 * This model exposes all the items that should be shown in the app drawer.
31 */
32class UNITY_API AppDrawerModelInterface: public QAbstractListModel
33{
34 Q_OBJECT
35 Q_ENUMS(Roles)
36public:
37 /**
38 * @brief The Roles supported by the model
39 *
40 * See LauncherItemInterface properties for details.
41 */
42 enum Roles {
43 RoleAppId,
44 RoleName,
45 RoleIcon,
46 RoleKeywords,
47 RoleUsage
48 };
49
50 /// @cond
51 AppDrawerModelInterface(QObject* parent = nullptr): QAbstractListModel(parent) {}
52 /// @endcond
53
54 virtual ~AppDrawerModelInterface() {}
55
56 /// @cond
57 QHash<int, QByteArray> roleNames() const override {
58 QHash<int, QByteArray> roles;
59 roles.insert(RoleAppId, "appId");
60 roles.insert(RoleName, "name");
61 roles.insert(RoleIcon, "icon");
62 roles.insert(RoleKeywords, "keywords");
63 roles.insert(RoleUsage, "usage");
64 return roles;
65 }
66 /// @endcond
67};
68
69}
70}
71}
072
=== modified file 'include/unity/shell/launcher/CMakeLists.txt'
--- include/unity/shell/launcher/CMakeLists.txt 2016-11-30 10:47:05 +0000
+++ include/unity/shell/launcher/CMakeLists.txt 2016-11-30 10:47:05 +0000
@@ -7,7 +7,7 @@
77
8set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)8set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)
99
10set(VERSION 10)10set(VERSION 11)
11set(PKGCONFIG_NAME "unity-shell-launcher")11set(PKGCONFIG_NAME "unity-shell-launcher")
12set(PKGCONFIG_DESCRIPTION "Unity shell Launcher APIs")12set(PKGCONFIG_DESCRIPTION "Unity shell Launcher APIs")
13set(PKGCONFIG_REQUIRES "Qt5Core")13set(PKGCONFIG_REQUIRES "Qt5Core")
1414
=== modified file 'include/unity/shell/launcher/LauncherItemInterface.h'
--- include/unity/shell/launcher/LauncherItemInterface.h 2016-05-11 10:48:13 +0000
+++ include/unity/shell/launcher/LauncherItemInterface.h 2016-11-30 10:47:05 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright 2013 Canonical Ltd.2 * Copyright 2013-2106 Canonical Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by5 * it under the terms of the GNU Lesser General Public License as published by
@@ -12,9 +12,6 @@
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Michael Zanetti <michael.zanetti@canonical.com>
18 */15 */
1916
20#ifndef UNITY_SHELL_LAUNCHER_LAUNCHERITEM_H17#ifndef UNITY_SHELL_LAUNCHER_LAUNCHERITEM_H
@@ -52,12 +49,17 @@
52 /**49 /**
53 * @brief The user visible name of the item.50 * @brief The user visible name of the item.
54 */51 */
55 Q_PROPERTY(QString name READ name CONSTANT)52 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
5653
57 /**54 /**
58 * @brief The full path to the icon to be shown for the item.55 * @brief The full path to the icon to be shown for the item.
59 */56 */
60 Q_PROPERTY(QString icon READ icon CONSTANT)57 Q_PROPERTY(QString icon READ icon NOTIFY iconChanged)
58
59 /**
60 * @brief The keywords for this item.
61 */
62 Q_PROPERTY(QStringList keywords READ keywords NOTIFY keywordsChanged)
6163
62 /**64 /**
63 * @brief A flag whether the item is pinned or not65 * @brief A flag whether the item is pinned or not
@@ -137,6 +139,7 @@
137 virtual QString appId() const = 0;139 virtual QString appId() const = 0;
138 virtual QString name() const = 0;140 virtual QString name() const = 0;
139 virtual QString icon() const = 0;141 virtual QString icon() const = 0;
142 virtual QStringList keywords() const = 0;
140 virtual bool pinned() const = 0;143 virtual bool pinned() const = 0;
141 virtual bool running() const = 0;144 virtual bool running() const = 0;
142 virtual bool recent() const = 0;145 virtual bool recent() const = 0;
@@ -151,6 +154,7 @@
151Q_SIGNALS:154Q_SIGNALS:
152 void nameChanged(const QString &name);155 void nameChanged(const QString &name);
153 void iconChanged(const QString &icon);156 void iconChanged(const QString &icon);
157 void keywordsChanged(const QStringList &keywords);
154 void pinnedChanged(bool pinned);158 void pinnedChanged(bool pinned);
155 void runningChanged(bool running);159 void runningChanged(bool running);
156 void recentChanged(bool running);160 void recentChanged(bool running);
157161
=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt'
--- test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt 2014-09-03 22:59:26 +0000
+++ test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt 2016-11-30 10:47:05 +0000
@@ -16,11 +16,13 @@
16 ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherModelInterface.h16 ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherModelInterface.h
17 ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherItemInterface.h17 ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherItemInterface.h
18 ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/QuickListModelInterface.h18 ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/QuickListModelInterface.h
19 ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/AppDrawerModelInterface.h
19 ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationManagerInterface.h20 ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationManagerInterface.h
20 ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationInfoInterface.h21 ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationInfoInterface.h
21 Mocks/MockLauncherModel.cpp22 Mocks/MockLauncherModel.cpp
22 Mocks/MockLauncherItem.cpp23 Mocks/MockLauncherItem.cpp
23 Mocks/MockQuickListModel.cpp24 Mocks/MockQuickListModel.cpp
25 Mocks/MockAppDrawerModel.cpp
24 ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationManager.cpp26 ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationManager.cpp
25 ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationInfo.cpp27 ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationInfo.cpp
26)28)
2729
=== added file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp'
--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp 1970-01-01 00:00:00 +0000
+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp 2016-11-30 10:47:05 +0000
@@ -0,0 +1,89 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <Mocks/MockAppDrawerModel.h>
18#include <Mocks/MockLauncherItem.h>
19
20using namespace unity::shell::launcher;
21
22MockAppDrawerModel::MockAppDrawerModel(QObject* parent): AppDrawerModelInterface(parent)
23{
24 MockLauncherItem *item = new MockLauncherItem("phone-app", "/usr/share/applications/phone-app.desktop", "Phone", "phone-app", this);
25 item->setKeywords({"keyword1", "keyword2"});
26 m_list.append(item);
27 item = new MockLauncherItem("camera-app", "/usr/share/applications/camera-app.desktop", "Camera", "camera", this);
28 item->setKeywords({"keyword1", "keyword2"});
29 m_list.append(item);
30 item = new MockLauncherItem("gallery-app", "/usr/share/applications/gallery-app.desktop", "Gallery", "gallery", this);
31 item->setKeywords({"keyword1", "keyword2"});
32 m_list.append(item);
33 item = new MockLauncherItem("facebook-webapp", "/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook", this);
34 item->setKeywords({"keyword1", "keyword2"});
35 m_list.append(item);
36 item = new MockLauncherItem("webbrowser-app", "/usr/share/applications/webbrowser-app.desktop", "Browser", "browser", this);
37 item->setKeywords({"keyword1", "keyword2"});
38 m_list.append(item);
39 item = new MockLauncherItem("twitter-webapp", "/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter", this);
40 item->setKeywords({"keyword1", "keyword2"});
41 m_list.append(item);
42 item = new MockLauncherItem("gmail-webapp", "/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail", this);
43 item->setKeywords({"keyword1", "keyword2"});
44 m_list.append(item);
45 item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather", this);
46 item->setKeywords({"keyword1", "keyword2"});
47 m_list.append(item);
48 item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad", this);
49 item->setKeywords({"keyword1", "keyword2"});
50 m_list.append(item);
51 item = new MockLauncherItem("ubuntu-calendar-app", "/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar", this);
52 item->setKeywords({"keyword1", "keyword2"});
53 m_list.append(item);
54}
55
56MockAppDrawerModel::~MockAppDrawerModel()
57{
58 while (!m_list.empty())
59 {
60 m_list.takeFirst()->deleteLater();
61 }
62}
63
64// cppcheck-suppress unusedFunction
65int MockAppDrawerModel::rowCount(const QModelIndex& parent) const
66{
67 Q_UNUSED(parent)
68 return m_list.count();
69}
70
71QVariant MockAppDrawerModel::data(const QModelIndex& index, int role) const
72{
73 LauncherItemInterface *item = m_list.at(index.row());
74 switch(role)
75 {
76 case RoleAppId:
77 return item->appId();
78 case RoleName:
79 return item->name();
80 case RoleIcon:
81 return item->icon();
82 case RoleKeywords:
83 return item->keywords();
84 case RoleUsage:
85 return 1;
86 }
87
88 return QVariant();
89}
090
=== added file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h'
--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h 1970-01-01 00:00:00 +0000
+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h 2016-11-30 10:47:05 +0000
@@ -0,0 +1,38 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include <AppDrawerModelInterface.h>
20
21class MockLauncherItem;
22
23using namespace unity::shell::launcher;
24
25class UNITY_API MockAppDrawerModel: public AppDrawerModelInterface
26{
27 Q_OBJECT
28
29public:
30 MockAppDrawerModel(QObject* parent = 0);
31 ~MockAppDrawerModel();
32
33 int rowCount(const QModelIndex& parent) const override;
34 QVariant data(const QModelIndex& index, int role) const override;
35
36private:
37 QList<MockLauncherItem*> m_list;
38};
039
=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp'
--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2016-05-18 13:43:40 +0000
+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2016-11-30 10:47:05 +0000
@@ -61,6 +61,20 @@
61 return m_icon;61 return m_icon;
62}62}
6363
64QStringList MockLauncherItem::keywords() const
65{
66 return m_keywords;
67}
68
69void MockLauncherItem::setKeywords(const QStringList &keywords)
70{
71 if (m_keywords != keywords)
72 {
73 m_keywords = keywords;
74 Q_EMIT keywordsChanged(m_keywords);
75 }
76}
77
64bool MockLauncherItem::pinned() const78bool MockLauncherItem::pinned() const
65{79{
66 return m_pinned;80 return m_pinned;
6781
=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h'
--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2016-05-18 13:43:40 +0000
+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2016-11-30 10:47:05 +0000
@@ -22,6 +22,8 @@
2222
23#include <LauncherItemInterface.h>23#include <LauncherItemInterface.h>
2424
25#include <QStringList>
26
25using namespace unity::shell::launcher;27using namespace unity::shell::launcher;
2628
27class UNITY_API MockLauncherItem: public LauncherItemInterface29class UNITY_API MockLauncherItem: public LauncherItemInterface
@@ -35,6 +37,9 @@
35 QString name() const;37 QString name() const;
36 QString icon() const;38 QString icon() const;
3739
40 QStringList keywords() const;
41 void setKeywords(const QStringList &keywords);
42
38 bool pinned() const;43 bool pinned() const;
39 void setPinned(bool pinned);44 void setPinned(bool pinned);
4045
@@ -67,6 +72,7 @@
67 QString m_desktopFile;72 QString m_desktopFile;
68 QString m_name;73 QString m_name;
69 QString m_icon;74 QString m_icon;
75 QStringList m_keywords;
70 bool m_pinned;76 bool m_pinned;
71 bool m_running;77 bool m_running;
72 bool m_recent;78 bool m_recent;
7379
=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp'
--- test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp 2013-09-11 15:28:22 +0000
+++ test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp 2016-11-30 10:47:05 +0000
@@ -21,9 +21,11 @@
21#include <Mocks/MockLauncherModel.h>21#include <Mocks/MockLauncherModel.h>
22#include <Mocks/MockLauncherItem.h>22#include <Mocks/MockLauncherItem.h>
23#include <Mocks/MockQuickListModel.h>23#include <Mocks/MockQuickListModel.h>
24#include <Mocks/MockAppDrawerModel.h>
2425
25#include <LauncherModelInterface.h>26#include <LauncherModelInterface.h>
26#include <LauncherItemInterface.h>27#include <LauncherItemInterface.h>
28#include <AppDrawerModelInterface.h>
2729
28#include <QtQml/qqml.h>30#include <QtQml/qqml.h>
2931
@@ -42,10 +44,12 @@
42 qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Interface for the LauncherModel");44 qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Interface for the LauncherModel");
43 qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Interface for the LauncherItem");45 qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Interface for the LauncherItem");
44 qmlRegisterUncreatableType<QuickListModelInterface>(uri, 0, 1, "QuickListModelInterface", "Interface for the QuickListModel");46 qmlRegisterUncreatableType<QuickListModelInterface>(uri, 0, 1, "QuickListModelInterface", "Interface for the QuickListModel");
47 qmlRegisterUncreatableType<AppDrawerModelInterface>(uri, 0, 1, "AppDrawerModelInterface", "Interface for the AppDrawerModel");
4548
46 qmlRegisterSingletonType<MockLauncherModel>(uri, 0, 1, "LauncherModel", modelProvider);49 qmlRegisterSingletonType<MockLauncherModel>(uri, 0, 1, "LauncherModel", modelProvider);
47 qmlRegisterUncreatableType<MockLauncherItem>(uri, 0, 1, "LauncherItem", "Can't create LauncherItems in QML. Get them from the LauncherModel");50 qmlRegisterUncreatableType<MockLauncherItem>(uri, 0, 1, "LauncherItem", "Can't create LauncherItems in QML. Get them from the LauncherModel");
48 qmlRegisterUncreatableType<MockQuickListModel>(uri, 0, 1, "QuickListModel", "Can't create QuickListModels in QML. Get them from the LauncherItems");51 qmlRegisterUncreatableType<MockQuickListModel>(uri, 0, 1, "QuickListModel", "Can't create QuickListModels in QML. Get them from the LauncherItems");
52 qmlRegisterType<MockAppDrawerModel>(uri, 0, 1, "AppDrawerModel");
4953
50 // Need to register the appmanager here ourselves as there won't be a real AppManager plugin in this test54 // Need to register the appmanager here ourselves as there won't be a real AppManager plugin in this test
51 qmlRegisterUncreatableType<unity::shell::application::ApplicationManagerInterface>(uri, 0, 1, "ApplicationManagerInterface", "Interface for the ApplicationManager");55 qmlRegisterUncreatableType<unity::shell::application::ApplicationManagerInterface>(uri, 0, 1, "ApplicationManagerInterface", "Interface for the ApplicationManager");
5256
=== modified file 'test/qmltest/unity/shell/launcher/tst_Launcher.qml'
--- test/qmltest/unity/shell/launcher/tst_Launcher.qml 2016-11-30 10:47:05 +0000
+++ test/qmltest/unity/shell/launcher/tst_Launcher.qml 2016-11-30 10:47:05 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright 2013 Canonical Ltd.2 * Copyright 2013-2016 Canonical Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by5 * it under the terms of the GNU Lesser General Public License as published by
@@ -12,9 +12,6 @@
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Michael Zanetti <michael.zanetti@canonical.com>
18 */15 */
1916
20import QtQuick 2.017import QtQuick 2.0
@@ -67,6 +64,15 @@
67 }64 }
68 }65 }
6966
67
68 Repeater {
69 id: appDrawerRepeater
70 model: AppDrawerModel {}
71 delegate: Item {
72 property var roles: model
73 }
74 }
75
70 function initTestCase() {76 function initTestCase() {
71 if (repeater.count < 5) {77 if (repeater.count < 5) {
72 print("This Test Suite requires at least 5 items in the model.")78 print("This Test Suite requires at least 5 items in the model.")
@@ -138,6 +144,7 @@
138 { tag: "Item.properties[appId]", constant: "appId", type: "string" },144 { tag: "Item.properties[appId]", constant: "appId", type: "string" },
139 { tag: "Item.properties[name]", constant: "name", type: "string" },145 { tag: "Item.properties[name]", constant: "name", type: "string" },
140 { tag: "Item.properties[icon]", constant: "icon", type: "string" },146 { tag: "Item.properties[icon]", constant: "icon", type: "string" },
147 { tag: "Item.properties[keywords]", constant: "keywords", type: "object" },
141 { tag: "Item.properties[pinned]", property: "pinned", type: "boolean" },148 { tag: "Item.properties[pinned]", property: "pinned", type: "boolean" },
142 { tag: "Item.properties[recent]", property: "recent", type: "boolean" },149 { tag: "Item.properties[recent]", property: "recent", type: "boolean" },
143 { tag: "Item.properties[running]", property: "running", type: "boolean" },150 { tag: "Item.properties[running]", property: "running", type: "boolean" },
@@ -182,5 +189,26 @@
182189
183 verifyData(data);190 verifyData(data);
184 }191 }
192
193 function test_appdrawer_model_roles_data() {
194 return [
195 { tag: "Model.roles[appId]", role: "appId", type: "string" },
196 { tag: "Model.roles[name]", role: "name", type: "string" },
197 { tag: "Model.roles[icon]", role: "icon", type: "string" },
198 { tag: "Model.roles[keywords]", role: "keywords", type: "object" },
199 { tag: "Model.roles[usage]", role: "usage", type: "number" },
200 ];
201 }
202
203 function test_appdrawer_model_roles(data) {
204 name = "AppDrawerModel"
205 try {
206 object = appDrawerRepeater.itemAt(0).roles;
207 } catch(err) {
208 object = undefined;
209 }
210
211 verifyData(data);
212 }
185 }213 }
186}214}

Subscribers

People subscribed via source and target branches

to all changes: