aboutsummaryrefslogtreecommitdiff
path: root/tests/indicator-test.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-03-06 21:46:30 -0600
committerTed Gould <ted@gould.cx>2015-03-06 21:46:30 -0600
commit474099ef1d4010fa918da698707b644cbc3fe5da (patch)
tree264ae602ee1390949470bbbfac13e39a92d6ca00 /tests/indicator-test.cpp
parentdf3f745d94c5bd0c5c0c2eaf85ed63a438981e3d (diff)
downloadayatana-indicator-messages-474099ef1d4010fa918da698707b644cbc3fe5da.tar.gz
ayatana-indicator-messages-474099ef1d4010fa918da698707b644cbc3fe5da.tar.bz2
ayatana-indicator-messages-474099ef1d4010fa918da698707b644cbc3fe5da.zip
A test that puts a message in the menu
Diffstat (limited to 'tests/indicator-test.cpp')
-rw-r--r--tests/indicator-test.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/indicator-test.cpp b/tests/indicator-test.cpp
index 3a5ef6d..afb55d0 100644
--- a/tests/indicator-test.cpp
+++ b/tests/indicator-test.cpp
@@ -23,6 +23,9 @@
#include "indicator-fixture.h"
#include "accounts-service-mock.h"
+#include "messaging-menu-app.h"
+#include "messaging-menu-message.h"
+
class IndicatorTest : public IndicatorFixture
{
protected:
@@ -38,6 +41,8 @@ protected:
g_setenv("GSETTINGS_SCHEMA_DIR", SCHEMA_DIR, TRUE);
g_setenv("GSETTINGS_BACKEND", "memory", TRUE);
+ g_setenv("XDG_DATA_DIRS", XDG_DATA_DIRS, TRUE);
+
as = std::make_shared<AccountsServiceMock>();
addMock(*as);
@@ -60,6 +65,24 @@ TEST_F(IndicatorTest, RootAction) {
EXPECT_EVENTUALLY_ACTION_EXISTS("messages");
EXPECT_ACTION_STATE_TYPE("messages", G_VARIANT_TYPE("a{sv}"));
EXPECT_ACTION_STATE("messages", g_variant_new_parsed("{'icon': <('themed', <['indicator-messages-offline', 'indicator-messages', 'indicator']>)>, 'title': <'Notifications'>, 'accessible-desc': <'Messages'>, 'visible': <false>}"));
-
}
+TEST_F(IndicatorTest, SingleMessage) {
+ setActions("/com/canonical/indicator/messages");
+
+ auto app = std::shared_ptr<MessagingMenuApp>(messaging_menu_app_new("test.desktop"), [](MessagingMenuApp * app) { g_clear_object(&app); });
+ ASSERT_NE(nullptr, app);
+ messaging_menu_app_register(app.get());
+
+ auto msg = std::shared_ptr<MessagingMenuMessage>(messaging_menu_message_new(
+ "test-id",
+ nullptr, /* no icon */
+ "Test Title",
+ "A subtitle too",
+ "You only like me for my body",
+ 0), [](MessagingMenuMessage * msg) { g_clear_object(&msg); });
+ messaging_menu_app_append_message(app.get(), msg.get(), nullptr, FALSE);
+
+ EXPECT_EVENTUALLY_ACTION_EXISTS("test.launch");
+
+}