23 Commits

Author SHA1 Message Date
Benedikt Heine
6f8b53c4e8 Compare raw icons by their checksums
Currently, we just skipped the notification comparison, if the
notification had a raw icon attached. This is a bit counterintuitive.

Calculating a checksum of the raw icon's data is the solution.

For that we cache the pixel buffer and introduce a field, which saves
the current icon's id. The icon_id may be a path or a hash.
So you can compare two notifications by their icon_id field regardless
of their icon type by their icon_id field.
2019-01-11 13:10:37 +01:00
Benedikt Heine
088907488c Rename icon field to iconname 2019-01-07 17:56:00 +01:00
Benedikt Heine
c37326c9a0 Move memory allocation into test methods
This implies, that memory will only get freed, if the whole test method
is gone through. In case of failure, memory leaks aren't important. But
it's crucial not to fail with a segfault just for an assertion.

Fixes #580
2019-01-03 12:21:05 +01:00
Benedikt Heine
84e5a0bf26 Make notification_is_duplicate test icons
Before, it only did test for `ASSERT_FALSE` both times. So a raw_image
wasn't guaranteed to be a condition to falsify the return.

Using the single field function, will test for both cases.
2019-01-03 12:19:53 +01:00
Benedikt Heine
5284ce01f4 Make notification tests easier 2018-11-26 12:19:17 +01:00
Benedikt Heine
193b1f7202 Test notification maximum length 2018-11-26 12:19:17 +01:00
Benedikt Heine
1b4ca786cd Test notification_format_message 2018-11-26 12:17:50 +01:00
Benedikt Heine
a6abfdf7c5 Include all local files relatively 2018-11-15 15:17:48 +01:00
Benedikt Heine
8c192f3c28 Make tests runnable from everywhere 2018-11-15 15:17:46 +01:00
Benedikt Heine
2e9d8300de Include full c source to assert static objects
To assert static objects, we either have to add a method into the
object under test itself and recompile on a test run with the activated test
method (but also recompile after tests, so that method is gone on
release builds).

Alternatively we can include the whole .c file in our test
infrastructure and save the object in the test directory. So there's no
necessity to clean it up prior to a release build and it's contained
away.

This requires, that the test folder isn't excluded in coveralls.
2018-11-15 15:17:21 +01:00
Benedikt Heine
52c47524f2 Test notification referencing 2018-10-08 18:27:11 +02:00
Benedikt Heine
837b4fe125 Implement refcounting for notifications 2018-10-06 13:43:49 +02:00
Benedikt Heine
c5c4b2cafb Use native notification functions in test
Since we'll allocate also some recursive elements with
notification_create, we have to free the notification properly.
2018-10-01 13:11:21 +02:00
Benedikt Heine
c5d552856f Reformat icon_position enum 2018-09-16 02:58:35 +02:00
Benedikt Heine
bbbddad3a7 Use structs for notifications 2018-09-16 02:58:31 +02:00
Benedikt Heine
de0f0bf3d9 Pack type RawImage into raw_image struct 2018-09-16 02:58:26 +02:00
Benedikt Heine
3f7de41732 Add tests for icon.c 2018-05-14 09:11:25 +03:00
Benedikt Heine
5f51147263 Prefix urgency enum with URG_ 2017-11-16 17:12:30 +01:00
Benedikt Heine
e16117ca30 Use double pointers for haystack 2017-09-07 15:25:54 +02:00
Benedikt Heine
ab9bf55892 Prevent replacement of format strings in message
To replace all occuring format strings inside the msg, replace_all had
been used previously. This leads to buggy behavior, if a format string
occurs in the replaced text, as the format string will get replaced
again under certain conditions.

Introducing a pointer, which skips the already replaced parts, will
prevent doubly replacing format strings from content.

Fixes #322
2017-09-07 15:25:14 +02:00
Nikos Tsipinakis
38856bc705 Fix wrong config path in notification test suite 2017-02-05 13:00:59 +02:00
Nikos Tsipinakis
d445661031 Add simple test for notification_replace_format 2017-02-04 22:10:51 +02:00
Nikos Tsipinakis
0deff4412e Add initial notification test suite
The beginnings of the notification test suite, currently only includes
tests for `notification_is_duplicate`.
2017-01-29 15:32:36 +02:00