[TEST] Add modulo test.

This commit is contained in:
Dave Davenport 2022-01-31 22:11:19 +01:00
parent 579735e76f
commit af8a3505b5
1 changed files with 16 additions and 3 deletions

View File

@ -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);