diff --git a/test/theme-parser-test.c b/test/theme-parser-test.c index 8c1398e7..e6efcbb0 100644 --- a/test/theme-parser-test.c +++ b/test/theme-parser-test.c @@ -1437,6 +1437,21 @@ START_TEST(test_prepare_math_multiply) { ck_assert_int_eq(dist, 1024); } END_TEST +START_TEST(test_prepare_math_modulo) { + widget wid; + wid.name = "window"; + wid.state = ""; + rofi_theme_parse_string("window { width: calc( 255 % 4 % 3 % );}"); + ck_assert_ptr_nonnull(rofi_theme); + // ck_assert_ptr_null ( rofi_theme->widgets ); + ck_assert_ptr_null(rofi_theme->properties); + ck_assert_ptr_null(rofi_theme->parent); + ck_assert_str_eq(rofi_theme->name, "Root"); + RofiDistance l = rofi_theme_get_distance(&wid, "width", 0); + int dist = distance_get_pixel(l, ROFI_ORIENTATION_HORIZONTAL); + ck_assert_int_eq(dist, 3); +} +END_TEST START_TEST(test_prepare_math_min) { widget wid; @@ -1470,9 +1485,6 @@ START_TEST(test_prepare_math_max) { } END_TEST START_TEST(test_prepare_default) { - widget wid; - wid.name = "window"; - wid.state = ""; rofi_theme_parse_string("@import \"default\""); ck_assert_ptr_null(error_msg); @@ -1706,6 +1718,7 @@ static Suite *theme_parser_suite(void) { tcase_add_test(tc_prepare_math, test_prepare_math_add); tcase_add_test(tc_prepare_math, test_prepare_math_subtract); tcase_add_test(tc_prepare_math, test_prepare_math_multiply); + tcase_add_test(tc_prepare_math, test_prepare_math_modulo); tcase_add_test(tc_prepare_math, test_prepare_math_floor); tcase_add_test(tc_prepare_math, test_prepare_math_ceil); tcase_add_test(tc_prepare_math, test_prepare_math_round);