Use native notification functions in test

Since we'll allocate also some recursive elements with
notification_create, we have to free the notification properly.
This commit is contained in:
Benedikt Heine 2018-07-06 19:39:13 +02:00
parent 740ebdd5a3
commit c5c4b2cafb

View File

@ -104,21 +104,25 @@ SUITE(suite_notification)
load_settings("data/dunstrc.default"); load_settings("data/dunstrc.default");
struct notification *a = notification_create(); struct notification *a = notification_create();
a->appname = "Test"; a->appname = g_strdup("Test");
a->summary = "Summary"; a->summary = g_strdup("Summary");
a->body = "Body"; a->body = g_strdup("Body");
a->icon = "Icon"; a->icon = g_strdup("Icon");
a->urgency = URG_NORM; a->urgency = URG_NORM;
struct notification *b = notification_create(); struct notification *b = notification_create();
memcpy(b, a, sizeof(*b)); b->appname = g_strdup("Test");
b->summary = g_strdup("Summary");
b->body = g_strdup("Body");
b->icon = g_strdup("Icon");
b->urgency = URG_NORM;
//2 equal notifications to be passed for duplicate checking, //2 equal notifications to be passed for duplicate checking,
struct notification *n[2] = {a, b}; struct notification *n[2] = {a, b};
RUN_TEST1(test_notification_is_duplicate, (void*) n); RUN_TEST1(test_notification_is_duplicate, (void*) n);
g_free(a); notification_free(a);
g_free(b); notification_free(b);
RUN_TEST(test_notification_replace_single_field); RUN_TEST(test_notification_replace_single_field);