diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gmenuharness/MenuItemMatcher.cpp | 20 | ||||
-rw-r--r-- | src/media-player-mpris.vala | 2 |
2 files changed, 21 insertions, 1 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( diff --git a/src/media-player-mpris.vala b/src/media-player-mpris.vala index 8bc2884..b9961f5 100644 --- a/src/media-player-mpris.vala +++ b/src/media-player-mpris.vala @@ -290,7 +290,7 @@ public class MediaPlayerMpris: MediaPlayer { if (changed_properties.lookup ("PlaybackStatus", "s", null)) { this.state = this.proxy.PlaybackStatus != null ? this.proxy.PlaybackStatus : "Unknown"; } - if (changed_properties.lookup ("CanGoNext", "b", null) || changed_properties.lookup ("CanGoPrev", "b", null)) { + if (changed_properties.lookup ("CanGoNext", "b", null) || changed_properties.lookup ("CanGoPrevious", "b", null)) { this.playbackstatus_changed (); } |