106 Commits

Author SHA1 Message Date
Benedikt Heine
fb5926b6fa Add tests for queue teardown 2018-11-24 15:22:18 +01:00
Benedikt Heine
e04003e291 Add Framework for queues tests 2018-11-24 15:22:18 +01:00
Benedikt Heine
9b45a111f1 Sort includes alphabetically 2018-11-15 15:17:48 +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
eba6913faa Test version number in unittests
Enforces a version number as intended in the Makefile. This check is
necessary, as there is no ability to check via Macros for an empty
string.
2018-11-12 15:32:58 +01:00
Benedikt Heine
90b04a22dd Use g_malloc instead of malloc
g_malloc won't return NULL, but abort the program. As we don't check for
NULl, this is the better solution.
2018-11-11 15:18:56 +01:00
Benedikt Heine
d8d457f500 Remove string_replace()
string_replace_at does almost the same and string_replace is only used
once, where additionally string_replace_at would be the better choice.
2018-11-11 15:18:56 +01:00
Nikos Tsipinakis
2c6cb8ebf3 Implement smarter markup escaping
Automatically detect and escape invalid and unsupported & entities.

Fixes #546
2018-11-06 20:49:47 +02:00
Benedikt Heine
52c47524f2 Test notification referencing 2018-10-08 18:27:11 +02:00
Benedikt Heine
778a6857d8 Move clean_value function to utils.c
This is a typical string manipulation function an has no necessity to
stay in option_parser.
2018-10-08 18:27:11 +02:00
Benedikt Heine
6cc7ca361a Allow half quoted values
Previously config lines like

[rule]
script = mail -s "New notif"

were only possible to get written with additional full quotes,
which makes no sense in command line expressions.
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
f4fb95c827 Do not make explicit NULL checks on elements
Most of the NULL checks are actually doubly false logic. Turning the
logic around and removing the NULL check makes the program easier to
read.
2018-07-10 13:23:12 +02:00
Benedikt Heine
a2b383ec0b Add Tests for tilde expansion in icons 2018-06-23 23:49:25 +02:00
Benedikt Heine
3bfc77864f Refactor GdkPixbuf loading
Rename both functions to make clear, what the difference between the
previous functions _from_file and _from_path is. Also remove the
superfluous `== NULL` checks as these don't match dunst's current style.
2018-05-14 09:11:25 +03:00
Benedikt Heine
3f7de41732 Add tests for icon.c 2018-05-14 09:11:25 +03:00
Benedikt Heine
2c503c2984 Add option to suppress log output when testing 2018-02-02 17:29:04 +01:00
Benedikt Heine
acd8be51ab Remove a and img tags from msg
While the notification spec allows tags like <a href="...">...</a> and
<img src="..." alt="...">, pango cannot parse these tags and therefore
these tags should be removed before passed to pango.

Also the method notification_extract_markup_urls is not needed anymore,
as markup_strip_a can return URLs optionally.

This implies, that URL replacement is now indicated via show_indicators
for URLs and the dmenu string is in the format of
'[text between a tags] URL\n'. This is similarly handled for images,
too.
2017-12-15 00:16:31 +01:00
Benedikt Heine
5f51147263 Prefix urgency enum with URG_ 2017-11-16 17:12:30 +01:00
Nikos Tsipinakis
e8e4af9ea3 Temporarily remove invalid value test in string_to_time
As mentioned in #368 testing for invalid values with the current
implementation would result in misleading error messages being printed
to stdout. These tests should be disabled until a solution is found.
2017-10-07 19:05:49 +03:00
Benedikt Heine
5d46cd700c Add option_get_time functions 2017-10-07 17:46:24 +02:00
Nikos Tsipinakis
0a3298dde4 Merge pull request #387 from bebehei/tests-for-string-append
Tests for string append
2017-10-06 18:17:50 +03:00
Benedikt Heine
a6301ff464 Do not concatenate empty strings with separator 2017-10-06 13:13:47 +02:00
Benedikt Heine
a1781a451b Check for b value if null in string_append
This avoids "a", NULL, "sep" to come to "asep" instead of "a".
2017-09-25 03:55:19 +02:00
Benedikt Heine
8b11113be1 Implement test_string_append 2017-09-25 03:54:37 +02:00
Benedikt Heine
554c873808 Mark constant strings as const
It's hard to trace back, which methods in option parser require freeing
the result and which prohibit it. Marking all non-freeable values as
const lets this problem solve the compiler.
2017-09-25 02:26:11 +02: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
Benedikt Heine
7eb99ea64d add tests for *_get_path functions 2017-08-15 23:51:14 +02:00
Nikos Tsipinakis
a08fba49d0 Remove bounce setting
Bounce was functionally removed in
b2883b213342c912a76329bb8f6c179ea3451ae5 during the transition from Xft
to Cairo without any mention. There is no use to keeping it in the example dunstrc
and storing the value in the code,

This commit will probably be reversed if and when bounce is
re-implemented.
2017-07-03 15:36:08 +03:00
Luke Shumaker
c645ba3106 Add tests for markup functions 2017-03-13 16:40:18 -04:00
Nikos Tsipinakis
d8d267e1f0 ASSERT_FALSE(expr == NULL) -> ASSERT(expr)
Simplify assert calls to improve code readability.
2017-02-23 20:45:09 +02:00
Nikos Tsipinakis
0c49b49254 Replace string_to_argv util function with g_shell_parse_argv
string_to_argv parsing was very simplistic and didn't properly handle
quotations. Since we are already using glib, g_shell_parse_argv serves
the same purpose with much better parsing and error handling.
2017-02-05 13:00:59 +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
Nikos Tsipinakis
f34b846041 Fix memory leaks in the unit tests
Making valgrind complain less should help finding actual memory leaks in
the long run.
2017-01-29 15:32:36 +02:00
Nikos Tsipinakis
2614b4d06e Move functional tests to a different subdirectory 2017-01-04 11:13:21 +02:00
Nikos Tsipinakis
187d3f9ab9 Invalid boolean values should fall back to the default
Previously, an invalid value was always false
2016-12-15 19:13:08 +02:00
Nikos Tsipinakis
b9619a1460 Add option parser test suite 2016-12-03 19:33:40 +02:00
Nikos Tsipinakis
9333d68656 Use the suite_ prefix for test suites 2016-12-03 19:19:10 +02:00
Nikos Tsipinakis
256440b25a Implement tests for most of the util functions
Also improved the implementation of the test_string_replace_char test.
2016-11-22 18:47:38 +02:00
Nikos Tsipinakis
d441e950d8 Implement test target and add the first test
make test will now compile the tests to test/test.
The first test, testing string_replace_char from utils.c, was added.
2016-11-19 12:26:00 +02:00
Nikos Tsipinakis
7ba0fe03ae Add 'greatest' testing framework
Never used this framework before but it seems promising.
2016-11-19 12:17:23 +02:00