diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-09-06 13:50:51 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-09-06 13:50:51 +0200 |
| commit | 278970b164ed9edee5a8d119ca765c925a3e95a5 (patch) | |
| tree | 91caff6d283e39abda8eb460fe86144e4844696a /tests | |
| parent | f044be5f9b8d3b5034ecad56206e07caae9fda73 (diff) | |
MockApplication: use tuple for log events and add function to verify them
(bzr r3477.5.48)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mock-application.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/mock-application.h b/tests/mock-application.h index 7d971874d..4b5890f5f 100644 --- a/tests/mock-application.h +++ b/tests/mock-application.h @@ -157,7 +157,7 @@ struct MockApplication : unity::Application bool urgent_; unity::WindowList windows_; std::string type_; - std::vector<std::tuple<unity::ApplicationEventType, unity::ApplicationSubjectPtr>> actions_log_; + std::vector<std::pair<unity::ApplicationEventType, unity::ApplicationSubjectPtr>> actions_log_; MOCK_CONST_METHOD0(type, std::string()); MOCK_CONST_METHOD0(repr, std::string()); @@ -179,7 +179,22 @@ struct MockApplication : unity::Application void LocalLogEvent(unity::ApplicationEventType type, unity::ApplicationSubjectPtr const& subject) { - actions_log_.push_back(std::make_tuple(type, subject)); + if (subject) + actions_log_.push_back(std::make_pair(type, subject)); + } + + bool HasLoggedEvent(unity::ApplicationEventType type, unity::ApplicationSubjectPtr const& subject) + { + if (!subject) + return false; + + for (auto const& pair : actions_log_) + { + if (pair.first == type && *pair.second == *subject) + return true; + } + + return false; } void SetRunState(bool state) { |
