elm_progressbar test: Add test for custom format strings to show when %% is not escap...
authorStephen 'Okra' Houston <smhouston88@gmail.com>
Thu, 24 Jan 2019 04:02:54 +0000 (04:02 +0000)
committerWonki Kim <wonki_.kim@samsung.com>
Fri, 8 Mar 2019 11:49:33 +0000 (20:49 +0900)
This adds a test that sets a custom progressbar format string that includes a custom percent (%%) that should be escaped to just one percent (%).  This case has been broken and fixed many times and is broken again so it makes sense to now add a check for it to try and prevent the continual breakage.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D7745

src/tests/elementary/elm_test_progressbar.c

index 81eeee9..2ad2808 100644 (file)
@@ -26,6 +26,22 @@ EFL_START_TEST(elm_progressbar_legacy_type_check)
 }
 EFL_END_TEST
 
+EFL_START_TEST(elm_progressbar_custom_unit_check)
+{
+   Evas_Object *win, *progressbar;
+   char format[50];
+
+   snprintf(format, sizeof(format), "%d percent (%d%%)", 50, 50);
+
+   win = win_add(NULL, "progressbar", ELM_WIN_BASIC);
+
+   progressbar = elm_progressbar_add(win);
+   elm_progressbar_unit_format_set(progressbar, format);
+   elm_progressbar_value_set(progressbar, .50);
+   ck_assert(!strcmp(elm_object_part_text_get(progressbar, "elm.text.status"), "50 percent (50%)"));
+}
+EFL_END_TEST
+
 EFL_START_TEST(elm_atspi_role_get)
 {
    Evas_Object *win, *progressbar;
@@ -44,5 +60,6 @@ EFL_END_TEST
 void elm_test_progressbar(TCase *tc)
 {
    tcase_add_test(tc, elm_progressbar_legacy_type_check);
+   tcase_add_test(tc, elm_progressbar_custom_unit_check);
    tcase_add_test(tc, elm_atspi_role_get);
 }