on xenial help sign in
Enable mock scopes to have custom primary navigation filters
commit9a36490a2e67cb7a6fd13e12e0a7596f696c6739 authorJosh Arenson <joshua.arenson@canonical.com> dateWed 27 Apr 2016, 10:08 (11 years ago) parentfd77a84
3 files changed+6−3
tests/mocks/Unity/fake_scope.cpp+3−2 tests/mocks/Unity/fake_scope.h+2−1 tests/mocks/Unity/fake_scopes.cpp+1
tests/mocks/Unity/fake_scope.cpp+3−2
@@ -32,7 +32,7 @@ Scope::Scope(Scopes* parent) : Scope("MockScope5", "Mock Scope", false, parent)
3232{
3333}
3434
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)
3636 : unity::shell::scopes::ScopeInterface(parent)
3737 , m_id(id)
3838 , m_name(name)
@@ -48,8 +48,9 @@ Scope::Scope(QString const& id, QString const& name, bool favorite, Scopes* pare
4848 , m_settings(new SettingsModel(this))
4949 , m_filters(new Filters(this))
5050 , m_returnNullPreview(returnNullPreview)
51+ , m_primaryNavigationFilterOptionLabels(primaryNavigationFilterOptionLabels)
5152{
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);
5354 connect(m_filters, &Filters::activeFiltersCountChanged, this, &Scope::activeFiltersCountChanged);
5455}
5556
tests/mocks/Unity/fake_scope.h+2−1
@@ -34,7 +34,7 @@ class Scope : public unity::shell::scopes::ScopeInterface
3434
3535public:
3636 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");
3838
3939 /* getters */
4040 QString id() const override;
@@ -122,6 +122,7 @@ protected:
122122 FakeOptionSelectorFilter* m_primaryNavigationFilter;
123123
124124 bool m_returnNullPreview;
125+ QStringList m_primaryNavigationFilterOptionLabels;
125126};
126127
127128#endif // FAKE_SCOPE_H
tests/mocks/Unity/fake_scopes.cpp+1
@@ -60,6 +60,7 @@ void Scopes::updateScopes()
6060 addScope(new Scope("MockScope7", "MS7", false, this));
6161 addScope(new Scope("MockScope8", "MS8", false, this));
6262 addScope(new Scope("MockScope9", "MS9", false, this));
63+ addScope(new Scope("MockScope10", "MS10", true, this));
6364 addScope(new Scope("NullPreviewScope", "NPS", false, this, 1, true));
6465 m_scopesOverview = new ScopesOverview(this);
6566