From: Stephen 'Okra' Houston Date: Thu, 24 Jan 2019 04:02:54 +0000 (+0000) Subject: elm_progressbar test: Add test for custom format strings to show when %% is not escap... X-Git-Tag: submit/tizen/20190308.115227~241 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=61dd0643ca155f7ab05ebcf87bdc11c738601675;p=platform%2Fupstream%2Fefl.git elm_progressbar test: Add test for custom format strings to show when %% is not escaped correctly. 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 Differential Revision: https://phab.enlightenment.org/D7745 --- diff --git a/src/tests/elementary/elm_test_progressbar.c b/src/tests/elementary/elm_test_progressbar.c index 81eeee9..2ad2808 100644 --- a/src/tests/elementary/elm_test_progressbar.c +++ b/src/tests/elementary/elm_test_progressbar.c @@ -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); }