on xenial help sign in
Improve dash plugin mock
1d88d67Albert Astals Cid
tests/mocks/Unity/fake_optionselectorfilter.cpp+5
@@ -63,3 +63,8 @@ bool FakeOptionSelectorFilter::isActive() const
63{
63{
64 return m_options->anyChecked();
64 return m_options->anyChecked();
65}
65}
66+
67+void FakeOptionSelectorFilter::clear()
68+{
69+ m_options->clear();
70+}
tests/mocks/Unity/fake_optionselectorfilter.h+2
@@ -37,6 +37,8 @@ public:
37
37
38 bool isActive() const;
38 bool isActive() const;
39
39
40+ void clear();
41+
40Q_SIGNALS:
42Q_SIGNALS:
41 void isActiveChanged();
43 void isActiveChanged();
42
44
tests/mocks/Unity/fake_optionselectoroptions.cpp+13
@@ -75,3 +75,16 @@ bool FakeOptionSelectorOptions::anyChecked() const
75{
75{
76 return !m_checkedIndexes.isEmpty();
76 return !m_checkedIndexes.isEmpty();
77}
77}
78+
79+void FakeOptionSelectorOptions::clear()
80+{
81+ if (!m_checkedIndexes.isEmpty()) {
82+ auto checkedIndexes = m_checkedIndexes;
83+ m_checkedIndexes.clear();
84+ Q_FOREACH(int row, checkedIndexes) {
85+ const QModelIndex idx = index(row, 0);
86+ Q_EMIT dataChanged(idx, idx, QVector<int>() << RoleOptionChecked);
87+ }
88+ Q_EMIT anyCheckedChanged();
89+ }
90+}
tests/mocks/Unity/fake_optionselectoroptions.h+2
@@ -36,6 +36,8 @@ public:
36
36
37 bool anyChecked() const;
37 bool anyChecked() const;
38
38
39+ void clear();
40+
39Q_SIGNALS:
41Q_SIGNALS:
40 void anyCheckedChanged();
42 void anyCheckedChanged();
41
43
tests/mocks/Unity/fake_scope.cpp+4
@@ -342,6 +342,10 @@ int Scope::activeFiltersCount() const
342
342
343void Scope::resetPrimaryNavigationTag()
343void Scope::resetPrimaryNavigationTag()
344{
344{
345+ if (m_hasPrimaryFilter && m_primaryNavigationFilter->isActive()) {
346+ m_primaryNavigationFilter->clear();
347+ }
348+
345 if (m_currentNavigationId != "root") {
349 if (m_currentNavigationId != "root") {
346 setNavigationState("root");
350 setNavigationState("root");
347 }
351 }