aboutsummaryrefslogtreecommitdiff
path: root/src/gmenuharness
diff options
context:
space:
mode:
authorXavi Garcia Mena <xavi.garcia.mena@canonical.com>2015-09-25 10:31:24 +0200
committerXavi Garcia Mena <xavi.garcia.mena@canonical.com>2015-09-25 10:31:24 +0200
commit5d88ce9836c1d32abfd369e650354ed855ec4654 (patch)
tree89bec140f86d907b747683ab7c53b555ed0f10ff /src/gmenuharness
parent035626d4df388a10e65226a81bd380f277fb12d2 (diff)
downloadayatana-indicator-sound-5d88ce9836c1d32abfd369e650354ed855ec4654.tar.gz
ayatana-indicator-sound-5d88ce9836c1d32abfd369e650354ed855ec4654.tar.bz2
ayatana-indicator-sound-5d88ce9836c1d32abfd369e650354ed855ec4654.zip
Added attribute_not_set to gmenuharness, added tests for player control buttons
Diffstat (limited to 'src/gmenuharness')
-rw-r--r--src/gmenuharness/MenuItemMatcher.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gmenuharness/MenuItemMatcher.cpp b/src/gmenuharness/MenuItemMatcher.cpp
index dae9e7d..f39acef 100644
--- a/src/gmenuharness/MenuItemMatcher.cpp
+++ b/src/gmenuharness/MenuItemMatcher.cpp
@@ -191,6 +191,8 @@ struct MenuItemMatcher::Priv
vector<pair<string, shared_ptr<GVariant>>> m_attributes;
+ vector<string> m_not_exist_attributes;
+
vector<pair<string, shared_ptr<GVariant>>> m_pass_through_attributes;
shared_ptr<bool> m_isToggled;
@@ -249,6 +251,7 @@ MenuItemMatcher& MenuItemMatcher::operator=(const MenuItemMatcher& other)
p->m_action = other.p->m_action;
p->m_state_icons = other.p->m_state_icons;
p->m_attributes = other.p->m_attributes;
+ p->m_not_exist_attributes = other.p->m_not_exist_attributes;
p->m_pass_through_attributes = other.p->m_pass_through_attributes;
p->m_isToggled = other.p->m_isToggled;
p->m_linkType = other.p->m_linkType;
@@ -388,6 +391,12 @@ MenuItemMatcher& MenuItemMatcher::double_attribute(const std::string& name, doub
&gvariant_deleter));
}
+MenuItemMatcher& MenuItemMatcher::attribute_not_set(const std::string& name)
+{
+ p->m_not_exist_attributes.emplace_back (name);
+ return *this;
+}
+
MenuItemMatcher& MenuItemMatcher::toggled(bool isToggled)
{
p->m_isToggled = make_shared<bool>(isToggled);
@@ -779,6 +788,17 @@ void MenuItemMatcher::match(
}
}
+ for (const auto& e: p->m_not_exist_attributes)
+ {
+ auto value = get_attribute(menuItem, e.c_str());
+ if (value)
+ {
+ matchResult.failure(location,
+ "Not expected attribute '" + e
+ + "' was found");
+ }
+ }
+
if (p->m_isToggled && (*p->m_isToggled) != isToggled)
{
matchResult.failure(