Skip to content

Commit f0506a0

Browse files
committed
Adjustments to tests
1 parent 915b672 commit f0506a0

File tree

3 files changed

+38
-44
lines changed

3 files changed

+38
-44
lines changed

src/notification.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,10 @@ bool notification_is_duplicate(const struct notification *a, const struct notifi
247247
return STR_EQ(a->appname, b->appname)
248248
&& STR_EQ(a->summary, b->summary)
249249
&& STR_EQ(a->body, b->body)
250-
&& a->icon_position == b->icon_position
251-
&& (a->iconname && b->iconname ? STR_EQ(a->iconname, b->iconname) : 1)
252-
&& (a->icon_id && b->icon_id ? STR_EQ(a->icon_id, b->icon_id) : 1)
253-
&& a->urgency == b->urgency;
250+
&& a->urgency == b->urgency
251+
&& (a->icon_position == ICON_OFF || b->icon_position == ICON_OFF
252+
|| (a->icon_id && b->icon_id ? STR_EQ(a->icon_id, b->icon_id)
253+
: (a->iconname && b->iconname ? STR_EQ(a->iconname, b->iconname) : 1)));
254254
}
255255

256256
bool notification_is_locked(struct notification *n) {

test/functional-tests/test.sh

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -458,69 +458,61 @@ function replaced_icon {
458458
start_dunst dunstrc.default
459459
echo "Normal icon"
460460
cp "$DATADIR/adwaita-icon1.png" "$TESTDIR/tmp.png"
461-
$DUNSTIFY -a "dunst tester" "just icon" -i "$TESTDIR/tmp.png"
462-
keypress
463-
464-
$DUNSTIFY -a "dunst tester" "just icon" -i "$TESTDIR/tmp.png"
465-
keypress
461+
for i in 1 2; do
462+
$DUNSTIFY -a "dunst tester" "just icon" -i "$TESTDIR/tmp.png"
463+
keypress
464+
done
466465

467466
cp "$DATADIR/adwaita-icon2.png" "$TESTDIR/tmp.png"
468-
$DUNSTIFY -a "dunst tester" "just icon" -i "$TESTDIR/tmp.png"
469-
keypress
470-
471-
$DUNSTIFY -a "dunst tester" "just icon" -i "$TESTDIR/tmp.png"
472-
keypress
467+
for i in 1 2; do
468+
$DUNSTIFY -a "dunst tester" "just icon" -i "$TESTDIR/tmp.png"
469+
keypress
470+
done
473471

474472
$DUNSTCTL close-all
475473

476474
echo "Raw icon"
477475
cp "$DATADIR/adwaita-icon1.png" "$TESTDIR/tmp.png"
478-
$DUNSTIFY -a "dunst tester" "just raw icon" -I "$TESTDIR/tmp.png"
479-
keypress
480-
481-
$DUNSTIFY -a "dunst tester" "just raw icon" -I "$TESTDIR/tmp.png"
482-
keypress
476+
for i in 1 2; do
477+
$DUNSTIFY -a "dunst tester" "just raw icon" -I "$TESTDIR/tmp.png"
478+
keypress
479+
done
483480

484481
cp "$DATADIR/adwaita-icon2.png" "$TESTDIR/tmp.png"
485-
$DUNSTIFY -a "dunst tester" "just raw icon" -I "$TESTDIR/tmp.png"
486-
keypress
487-
488-
$DUNSTIFY -a "dunst tester" "just raw icon" -I "$TESTDIR/tmp.png"
489-
keypress
482+
for i in 1 2; do
483+
$DUNSTIFY -a "dunst tester" "just raw icon" -I "$TESTDIR/tmp.png"
484+
keypress
485+
done
490486

491487
$DUNSTCTL close-all
492488

493489
echo "Tagged icon"
494490
cp "$DATADIR/adwaita-icon1.png" "$TESTDIR/tmp.png"
495-
$DUNSTIFY -a "dunst tester" "icon with tag" -i "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
496-
keypress
497-
498-
$DUNSTIFY -a "dunst tester" "icon with tag" -i "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
499-
keypress
491+
for i in 1 2; do
492+
$DUNSTIFY -a "dunst tester" "icon with tag $i" -i "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
493+
keypress
494+
done
500495

501496
cp "$DATADIR/adwaita-icon2.png" "$TESTDIR/tmp.png"
502-
$DUNSTIFY -a "dunst tester" "icon with tag" -i "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
503-
keypress
504-
505-
$DUNSTIFY -a "dunst tester" "icon with tag" -i "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
506-
keypress
497+
for i in 1 2; do
498+
$DUNSTIFY -a "dunst tester" "icon with tag $i" -i "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
499+
keypress
500+
done
507501

508502
$DUNSTCTL close-all
509503

510504
echo "Tagged raw icon"
511505
cp "$DATADIR/adwaita-icon1.png" "$TESTDIR/tmp.png"
512-
$DUNSTIFY -a "dunst tester" "raw icon with tag" -I "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
513-
keypress
514-
515-
$DUNSTIFY -a "dunst tester" "raw icon with tag" -I "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
516-
keypress
506+
for i in 1 2; do
507+
$DUNSTIFY -a "dunst tester" "raw icon with tag $i" -I "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
508+
keypress
509+
done
517510

518511
cp "$DATADIR/adwaita-icon2.png" "$TESTDIR/tmp.png"
519-
$DUNSTIFY -a "dunst tester" "raw icon with tag" -I "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
520-
keypress
521-
522-
$DUNSTIFY -a "dunst tester" "raw icon with tag" -I "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
523-
keypress
512+
for i in 1 2; do
513+
$DUNSTIFY -a "dunst tester" "raw icon with tag $i" -I "$TESTDIR/tmp.png" -h string:x-dunst-stack-tag:test
514+
keypress
515+
done
524516
}
525517

526518
if [ -n "$1" ]; then

test/notification.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ TEST test_notification_is_duplicate(void)
2929
a->body = g_strdup("Body");
3030
a->iconname = g_strdup("Icon");
3131
a->icon_id = g_strdup("Icon");
32+
a->icon_position = ICON_LEFT;
3233
a->urgency = URG_NORM;
3334

3435
struct notification *b = notification_create();
@@ -37,6 +38,7 @@ TEST test_notification_is_duplicate(void)
3738
b->body = g_strdup("Body");
3839
b->iconname = g_strdup("Icon");
3940
b->icon_id = g_strdup("Icon");
41+
b->icon_position = ICON_LEFT;
4042
b->urgency = URG_NORM;
4143

4244
ASSERT(notification_is_duplicate(a, b));

0 commit comments

Comments
 (0)