on 1ea033d help sign in
unity8/tests/mocks/Unity/fake_scope.h
109 lines 4.0 kB history raw
1/*
2 * Copyright (C) 2013, 2014 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 */
17#ifndef FAKE_SCOPE_H
18#define FAKE_SCOPE_H
20#include <unity/shell/scopes/ScopeInterface.h>
22#include "fake_categories.h"
23#include "fake_previewstack.h"
25#include <QTimer>
27class Scopes;
29class Scope : public unity::shell::scopes::ScopeInterface
31 Q_OBJECT
33public:
34 Scope(Scopes* parent = 0);
35 Scope(QString const& id, QString const& name, bool favorite, Scopes* parent = 0, int categories = 20, bool returnNullPreview = false);
37 /* getters */
38 QString id() const override;
39 QString name() const override;
40 QString iconHint() const override;
41 QString description() const override;
42 QString searchHint() const override;
43 QString shortcut() const override;
44 bool searchInProgress() const override;
45 bool favorite() const override;
46 unity::shell::scopes::CategoriesInterface* categories() const override;
47 QString searchQuery() const override;
48 QString noResultsHint() const override;
49 QString formFactor() const override;
50 bool isActive() const override;
51 unity::shell::scopes::SettingsModelInterface* settings() const override;
53 /* setters */
54 void setSearchQuery(const QString& search_query) override;
55 void setNoResultsHint(const QString& hint) override;
56 void setFormFactor(const QString& form_factor) override;
57 void setActive(const bool) override;
58 void setFavorite(const bool) override;
59 Q_INVOKABLE void setId(const QString &id); // This is not invokable in the Interface, here for testing benefits
60 Q_INVOKABLE void setName(const QString &name); // This is not invokable in the Interface, here for testing benefits
61 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
63 Q_INVOKABLE void activate(QVariant const& result) override;
64 Q_INVOKABLE PreviewStack* preview(QVariant const& result) override;
65 Q_INVOKABLE void cancelActivation() override;
66 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
68 QString currentNavigationId() const override;
69 bool hasNavigation() const override;
70 QString currentAltNavigationId() const override;
71 bool hasAltNavigation() const override;
72 Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) override;
73 Q_INVOKABLE unity::shell::scopes::NavigationInterface* getAltNavigation(QString const& altNavigationId) override;
74 Q_INVOKABLE void setNavigationState(const QString &navigationId, bool isAltNavigation) override;
75 Q_SIGNAL void performQuery(const QString& query) override;
77 Status status() const override;
78 QVariantMap customizations() const override;
80 Q_INVOKABLE void refresh() override;
82Q_SIGNALS:
83 void refreshed(); // This is not in the Interface, here for testing benefits
85protected:
87 QString m_id;
88 QString m_iconHint;
89 QString m_description;
90 QString m_name;
91 QString m_searchQuery;
92 QString m_noResultsHint;
93 QString m_formFactor;
94 bool m_searching;
95 bool m_favorite;
96 bool m_isActive;
97 QString m_currentNavigationId;
98 QString m_currentAltNavigationId;
100 QString m_previewRendererName;
102 unity::shell::scopes::CategoriesInterface* m_categories;
103 unity::shell::scopes::ScopeInterface* m_openScope;
104 unity::shell::scopes::SettingsModelInterface* m_settings;
106 bool m_returnNullPreview;
107};
109#endif // FAKE_SCOPE_H