Skip to content

Commit

Permalink
Merge pull request #1431 from BinaryInk/add-1426-tests
Browse files Browse the repository at this point in the history
Add tests for additions in #1426
  • Loading branch information
bynect authored Jan 8, 2025
2 parents 8010c7e + 7789fbc commit 5408dfc
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,20 @@ TEST test_dbus_cb_dunst_NotificationListHistory(void)
gint64 timestamp1 = n->timestamp;
n->appname = g_strdup("dunstify");
n->summary = g_strdup("Testing");
n->urgency = 2;
n->stack_tag = g_strdup("test-stack-tag");
n->urls = g_strdup("https://dunst-project.org/");
const char *urgency1 = notification_urgency_to_string(n->urgency);
queues_history_push(n);

n = notification_create();
gint64 timestamp2 = n->timestamp;
n->appname = g_strdup("notify-send");
n->summary = g_strdup("More testing");
n->urgency = 0;
n->stack_tag = g_strdup("test-stack-tag");
n->urls = g_strdup("https://dunst-project.org/");
const char *urgency2 = notification_urgency_to_string(n->urgency);
queues_history_push(n);

GVariant *result = dbus_invoke_ifac("NotificationListHistory", NULL, DUNST_IFAC);
Expand Down Expand Up @@ -565,6 +573,18 @@ TEST test_dbus_cb_dunst_NotificationListHistory(void)
ASSERT(g_variant_dict_lookup(&d, "timestamp", "x", &int64));
ASSERT_EQ(timestamp2, int64);

ASSERT(g_variant_dict_lookup(&d, "urgency", "s", &str));
ASSERT_STR_EQ(urgency2, str);
g_free(str);

ASSERT(g_variant_dict_lookup(&d, "stack_tag", "s", &str));
ASSERT_STR_EQ("test-stack-tag", str);
g_free(str);

ASSERT(g_variant_dict_lookup(&d, "urls", "s", &str));
ASSERT_STR_EQ("https://dunst-project.org/", str);
g_free(str);

g_variant_unref(dict);
dict = g_variant_iter_next_value(&array_iter);
g_variant_dict_clear(&d);
Expand All @@ -581,6 +601,18 @@ TEST test_dbus_cb_dunst_NotificationListHistory(void)
ASSERT(g_variant_dict_lookup(&d, "timestamp", "x", &int64));
ASSERT_EQ(timestamp1, int64);

ASSERT(g_variant_dict_lookup(&d, "urgency", "s", &str));
ASSERT_STR_EQ(urgency1, str);
g_free(str);

ASSERT(g_variant_dict_lookup(&d, "stack_tag", "s", &str));
ASSERT_STR_EQ("test-stack-tag", str);
g_free(str);

ASSERT(g_variant_dict_lookup(&d, "urls", "s", &str));
ASSERT_STR_EQ("https://dunst-project.org/", str);
g_free(str);

g_variant_dict_clear(&d);
g_variant_unref(dict);
g_variant_unref(array);
Expand Down

0 comments on commit 5408dfc

Please sign in to comment.