aboutsummaryrefslogtreecommitdiff
path: root/tests/utils/gtest-print-helpers.h
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-04-22 09:43:44 -0500
committerCharles Kerr <charles.kerr@canonical.com>2016-04-22 09:43:44 -0500
commitce5234162fa0c534ff9abf3fce3d03f4b01e893e (patch)
treefa1de28390d3fad05b9a9405190f82cde3fa70e5 /tests/utils/gtest-print-helpers.h
parentb37db33c628675971f118fb3e241dc32a9f0a5d0 (diff)
downloadayatana-indicator-display-ce5234162fa0c534ff9abf3fce3d03f4b01e893e.tar.gz
ayatana-indicator-display-ce5234162fa0c534ff9abf3fce3d03f4b01e893e.tar.bz2
ayatana-indicator-display-ce5234162fa0c534ff9abf3fce3d03f4b01e893e.zip
don't prompt when the greeter's not running yet: change greeter's payload from an 'is_active' bool to a three-value state of active, inactive, and unavailable
Diffstat (limited to 'tests/utils/gtest-print-helpers.h')
-rw-r--r--tests/utils/gtest-print-helpers.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/utils/gtest-print-helpers.h b/tests/utils/gtest-print-helpers.h
new file mode 100644
index 0000000..75ee13b
--- /dev/null
+++ b/tests/utils/gtest-print-helpers.h
@@ -0,0 +1,18 @@
+
+#pragma once
+
+#include <src/greeter.h>
+
+inline void PrintTo(const Greeter::State& state, std::ostream* os) {
+ switch(state) {
+ case Greeter::State::ACTIVE: *os << "Active"; break;
+ case Greeter::State::INACTIVE: *os << "Inactive"; break;
+ default: *os << "Unavailable"; break;
+ }
+}
+
+std::ostream& operator<<(std::ostream& os, const Greeter::State& state) {
+ PrintTo(state, &os);
+ return os;
+}
+