diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2017-09-20 05:04:10 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2017-09-20 05:04:10 +0200 |
| commit | a1c7b8b8e4e6e175febf34dc543ee1328e48f8db (patch) | |
| tree | 54d23e98760d24281ad36ec87295c2e7a6ad48af | |
| parent | e06a5666c2b45df5d529127f28bf34a76600cf8d (diff) | |
tests MockResults: properly return a truly mock result instead of still using dee
(bzr r4253.1.9)
| -rw-r--r-- | tests/MockResults.h | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/tests/MockResults.h b/tests/MockResults.h index 0eacdfaec..cb9c4591c 100644 --- a/tests/MockResults.h +++ b/tests/MockResults.h @@ -26,19 +26,44 @@ namespace unity { namespace dash { -struct MockResults : public Results +struct MockResult : Result +{ + MockResult(std::size_t index) + : Result(nullptr, nullptr, nullptr) + { + uri.SetGetterFunction([index] { return "proto://result-" + std::to_string(index); }); + icon_hint.SetGetterFunction([index] { return ""; }); + category_index.SetGetterFunction([index] { return 0; }); + result_type.SetGetterFunction([index] { return 0; }); + mimetype.SetGetterFunction([index] { return "mime-type-" + std::to_string(index); }); + name.SetGetterFunction([index] { return "MockResult " + std::to_string(index); }); + comment.SetGetterFunction([index] { return "Just a pointless result " + std::to_string(index); }); + dnd_uri.SetGetterFunction([index] { return "dnd://mock-result" + std::to_string(index); }); + hints.SetGetterFunction([index] { return glib::HintsMap(); }); + } +}; + +struct MockResults : Results { MockResults(unsigned int count_) : Results(LOCAL) { count.SetGetterFunction([count_] { return count_; }); } + + virtual const Result RowAtIndex(std::size_t index) const override + { + return MockResult(index); + } }; // Template specialization for Result in tests -template<> const Result Model<Result>::RowAtIndex(std::size_t index) const; +template<> const Result Model<Result>::RowAtIndex(std::size_t index) const +{ + return MockResult(index); +} } } -#endif \ No newline at end of file +#endif |
