on xenial help sign in
Enable mock scopes to have custom primary navigation filters
9a36490Josh Arenson
tests/mocks/Unity/fake_scope.cpp+3−2
@@ -32,7 +32,7 @@ Scope::Scope(Scopes* parent) : Scope("MockScope5", "Mock Scope", false, parent)
32{
32{
33}
33}
34
34
35−Scope::Scope(QString const& id, QString const& name, bool favorite, Scopes* parent, int categories, bool returnNullPreview)
35+Scope::Scope(QString const& id, QString const& name, bool favorite, Scopes* parent, int categories, bool returnNullPreview, QStringList primaryNavigationFilterOptionLabels)
36 : unity::shell::scopes::ScopeInterface(parent)
36 : unity::shell::scopes::ScopeInterface(parent)
37 , m_id(id)
37 , m_id(id)
38 , m_name(name)
38 , m_name(name)
@@ -48,8 +48,9 @@ Scope::Scope(QString const& id, QString const& name, bool favorite, Scopes* pare
48 , m_settings(new SettingsModel(this))
48 , m_settings(new SettingsModel(this))
49 , m_filters(new Filters(this))
49 , m_filters(new Filters(this))
50 , m_returnNullPreview(returnNullPreview)
50 , m_returnNullPreview(returnNullPreview)
51+ , m_primaryNavigationFilterOptionLabels(primaryNavigationFilterOptionLabels)
51{
52{
52− m_primaryNavigationFilter = new FakeOptionSelectorFilter("OSF3", "PFTag", "Which food you like More", false, QStringList() << "meat" << "vegetables", this);
53+ m_primaryNavigationFilter = new FakeOptionSelectorFilter("OSF3", "PFTag", "Which food you like More", false, m_primaryNavigationFilterOptionLabels, this);
53 connect(m_filters, &Filters::activeFiltersCountChanged, this, &Scope::activeFiltersCountChanged);
54 connect(m_filters, &Filters::activeFiltersCountChanged, this, &Scope::activeFiltersCountChanged);
54}
55}
55
56
tests/mocks/Unity/fake_scope.h+2−1
@@ -34,7 +34,7 @@ class Scope : public unity::shell::scopes::ScopeInterface
34
34
35public:
35public:
36 Scope(Scopes* parent = 0);
36 Scope(Scopes* parent = 0);
37− Scope(QString const& id, QString const& name, bool favorite, Scopes* parent = 0, int categories = 20, bool returnNullPreview = false);
37+ Scope(QString const& id, QString const& name, bool favorite, Scopes* parent = 0, int categories = 20, bool returnNullPreview = false, QStringList primaryNavigationFilterOptionLabels = QStringList() << "meat" << "vegetables");
38
38
39 /* getters */
39 /* getters */
40 QString id() const override;
40 QString id() const override;
@@ -122,6 +122,7 @@ protected:
122 FakeOptionSelectorFilter* m_primaryNavigationFilter;
122 FakeOptionSelectorFilter* m_primaryNavigationFilter;
123
123
124 bool m_returnNullPreview;
124 bool m_returnNullPreview;
125+ QStringList m_primaryNavigationFilterOptionLabels;
125};
126};
126
127
127#endif // FAKE_SCOPE_H
128#endif // FAKE_SCOPE_H
tests/mocks/Unity/fake_scopes.cpp+1
@@ -60,6 +60,7 @@ void Scopes::updateScopes()
60 addScope(new Scope("MockScope7", "MS7", false, this));
60 addScope(new Scope("MockScope7", "MS7", false, this));
61 addScope(new Scope("MockScope8", "MS8", false, this));
61 addScope(new Scope("MockScope8", "MS8", false, this));
62 addScope(new Scope("MockScope9", "MS9", false, this));
62 addScope(new Scope("MockScope9", "MS9", false, this));
63+ addScope(new Scope("MockScope10", "MS10", true, this));
63 addScope(new Scope("NullPreviewScope", "NPS", false, this, 1, true));
64 addScope(new Scope("NullPreviewScope", "NPS", false, this, 1, true));
64 m_scopesOverview = new ScopesOverview(this);
65 m_scopesOverview = new ScopesOverview(this);
65
66