Skip to content

Commit

Permalink
Assert that notification icon is not null in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bynect committed Jan 25, 2024
1 parent 2fcea84 commit a3bfee8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/icon-lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ TEST test_new_icon_overrides_raw_icon(void) {
rule->new_icon = g_strdup("edit");

ASSERT(n->icon);

int old_width = cairo_image_surface_get_width(n->icon);
rule_apply(rule, n);

ASSERT(n->icon);
ASSERT(old_width != cairo_image_surface_get_width(n->icon));

cairo_surface_destroy(n->icon);
Expand Down
4 changes: 4 additions & 0 deletions test/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ TEST test_notification_icon_scaling_toosmall(void)
{
struct notification *n = notification_load_icon_with_scaling(20, 100);

ASSERT(n->icon);
ASSERT_EQ(get_icon_width(n->icon, 1), 20);
ASSERT_EQ(get_icon_height(n->icon, 1), 20);

Expand All @@ -164,6 +165,7 @@ TEST test_notification_icon_scaling_toolarge(void)
{
struct notification *n = notification_load_icon_with_scaling(5, 10);

ASSERT(n->icon);
ASSERT_EQ(get_icon_width(n->icon, 1), 10);
ASSERT_EQ(get_icon_height(n->icon, 1), 10);

Expand All @@ -176,6 +178,7 @@ TEST test_notification_icon_scaling_notconfigured(void)
{
struct notification *n = notification_load_icon_with_scaling(0, 0);

ASSERT(n->icon);
ASSERT_EQ(get_icon_width(n->icon, 1), 16);
ASSERT_EQ(get_icon_height(n->icon, 1), 16);

Expand All @@ -188,6 +191,7 @@ TEST test_notification_icon_scaling_notneeded(void)
{
struct notification *n = notification_load_icon_with_scaling(10, 20);

ASSERT(n->icon);
ASSERT_EQ(get_icon_width(n->icon, 1), 16);
ASSERT_EQ(get_icon_height(n->icon, 1), 16);

Expand Down

0 comments on commit a3bfee8

Please sign in to comment.