on bbbdccd help sign in
unity8/tests/mocks/Unity/fake_categories.h
54 lines 1.7 kB history raw
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 */
17#ifndef FAKE_CATEGORIES_H
18#define FAKE_CATEGORIES_H
20#include <unity/shell/scopes/CategoriesInterface.h>
22// Qt
23#include <QList>
25class ResultsModel;
27class Categories : public unity::shell::scopes::CategoriesInterface
29 Q_OBJECT
31public:
32 Categories(int category_count, QObject* parent = 0);
34 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
35 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
37 Q_INVOKABLE bool overrideCategoryJson(QString const& categoryId, QString const& json) override;
39 Q_INVOKABLE QVariant data(int row, int role) const;
41 // For testing purposes
42 Q_INVOKABLE void setCount(int count);
43 Q_INVOKABLE ResultsModel* resultModel(int row) const;
44 Q_INVOKABLE void setLayout(int row, const QString &layout);
45 Q_INVOKABLE void setHeaderLink(int row, const QString &headerLink);
47private:
48 mutable QHash<int, ResultsModel*> m_resultsModels;
49 QHash<int, QString> m_layouts;
50 QHash<int, QString> m_headerLinks;
51 int m_category_count;
52};
54#endif // FAKE_CATEGORIES_H