summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-06-14 08:18:59 +0200
committerDave Davenport <qball@gmpclient.org>2017-06-14 08:18:59 +0200
commit32f67ab5a5a55fa6e5dc37c28f8875e1e01c6219 (patch)
tree36b9af2e060962256ff38c893a0e54f6d7780bd7 /test
parent8f035bf9195cc350ab903939d0da3894d7bf197c (diff)
Add list property test, allow empty lists.
Diffstat (limited to 'test')
-rw-r--r--test/theme-parser-test.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/theme-parser-test.c b/test/theme-parser-test.c
index 6c78af68..24561728 100644
--- a/test/theme-parser-test.c
+++ b/test/theme-parser-test.c
@@ -1078,6 +1078,34 @@ START_TEST ( test_properties_orientation_case )
}
END_TEST
+START_TEST ( test_properties_list )
+{
+ widget wid;
+ wid.name = "blaat";
+ wid.state = NULL;
+ rofi_theme_parse_string ( "#blaat { liste: []; list1: [ one ]; list2: [ one, two ];}");
+ GList *list = rofi_theme_get_list ( &wid, "liste", NULL );
+ ck_assert_ptr_null ( list );
+ list = rofi_theme_get_list ( &wid, "list1", NULL );
+ ck_assert_ptr_nonnull ( list );
+ ck_assert_str_eq ( (char *)list->data, "one" );
+ g_list_free_full ( list, (GDestroyNotify)g_free);
+ list = rofi_theme_get_list ( &wid, "list2", NULL );
+ ck_assert_ptr_nonnull ( list );
+ ck_assert_int_eq ( g_list_length ( list ), 2 );
+ ck_assert_str_eq ( (char *)list->data, "one" );
+ ck_assert_str_eq ( (char *)list->next->data, "two" );
+ g_list_free_full ( list, (GDestroyNotify)g_free);
+
+ list = rofi_theme_get_list ( &wid, "blaat", "aap,noot,mies");
+ ck_assert_ptr_nonnull ( list );
+ ck_assert_int_eq ( g_list_length ( list ), 3 );
+ ck_assert_str_eq ( (char *)list->data, "aap" );
+ ck_assert_str_eq ( (char *)list->next->data, "noot" );
+ ck_assert_str_eq ( (char *)list->next->next->data, "mies" );
+ g_list_free_full ( list, (GDestroyNotify)g_free);
+}
+END_TEST
START_TEST ( test_configuration )
{
@@ -1276,6 +1304,12 @@ static Suite * theme_parser_suite (void)
suite_add_tcase(s, tc_prop_orientation );
}
{
+ TCase *tc_prop_list = tcase_create("Propertieslist");
+ tcase_add_checked_fixture(tc_prop_list, theme_parser_setup, theme_parser_teardown);
+ tcase_add_test ( tc_prop_list, test_properties_list);
+ suite_add_tcase(s, tc_prop_list );
+ }
+ {
TCase *tc_prop_configuration = tcase_create("Configuration");
tcase_add_checked_fixture(tc_prop_configuration, theme_parser_setup, theme_parser_teardown);
tcase_add_test ( tc_prop_configuration, test_configuration);