From: Daehyeon Jung Date: Tue, 21 Jun 2016 01:06:18 +0000 (+0900) Subject: [UTC][appcore-widget][ACR-453][Add TC for new API] X-Git-Tag: Beta_RC10~21^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=82a4a5058b1ba17f0e23b6550434940ce72e6368;p=test%2Ftct%2Fnative%2Fapi.git [UTC][appcore-widget][ACR-453][Add TC for new API] Change-Id: I7e318136a79f9b74dc7ec6f3748e24793698372a Signed-off-by: Daehyeon Jung --- diff --git a/src/utc/appcore-widget/public.list b/src/utc/appcore-widget/public.list index 8e5223e..3fe4f6a 100755 --- a/src/utc/appcore-widget/public.list +++ b/src/utc/appcore-widget/public.list @@ -6,6 +6,7 @@ widget_app_add_event_handler widget_app_remove_event_handler widget_app_get_id widget_app_class_create +widget_app_class_add widget_app_context_set_tag widget_app_context_get_tag widget_app_context_set_content_info diff --git a/src/utc/appcore-widget/tct-appcore-widget-core_mobile.h b/src/utc/appcore-widget/tct-appcore-widget-core_mobile.h index 8bff21a..61aafb0 100755 --- a/src/utc/appcore-widget/tct-appcore-widget-core_mobile.h +++ b/src/utc/appcore-widget/tct-appcore-widget-core_mobile.h @@ -31,6 +31,8 @@ extern int utc_appcore_widget_widget_app_add_event_handler_n(void); extern int utc_appcore_widget_widget_app_remove_event_handler_p(void); extern int utc_appcore_widget_widget_app_remove_event_handler_n(void); extern int utc_appcore_widget_widget_app_class_create_p(void); +extern int utc_appcore_widget_widget_app_class_add_p(void); +extern int utc_appcore_widget_widget_app_class_add_n(void); extern int utc_appcore_widget_widget_app_exit_p(void); extern int utc_appcore_widget_widget_app_terminate_context_n(void); extern int utc_appcore_widget_widget_app_foreach_context_p(void); @@ -53,6 +55,8 @@ testcase tc_array[] = { {"utc_appcore_widget_widget_app_remove_event_handler_p", utc_appcore_widget_widget_app_remove_event_handler_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_remove_event_handler_n", utc_appcore_widget_widget_app_remove_event_handler_n, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_class_create_p", utc_appcore_widget_widget_app_class_create_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, + {"utc_appcore_widget_widget_app_class_add_p", utc_appcore_widget_widget_app_class_add_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, + {"utc_appcore_widget_widget_app_class_add_n", utc_appcore_widget_widget_app_class_add_n, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_exit_p", utc_appcore_widget_widget_app_exit_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_terminate_context_n", utc_appcore_widget_widget_app_terminate_context_n, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_foreach_context_p", utc_appcore_widget_widget_app_foreach_context_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, diff --git a/src/utc/appcore-widget/tct-appcore-widget-core_tv.h b/src/utc/appcore-widget/tct-appcore-widget-core_tv.h index 8bff21a..61aafb0 100755 --- a/src/utc/appcore-widget/tct-appcore-widget-core_tv.h +++ b/src/utc/appcore-widget/tct-appcore-widget-core_tv.h @@ -31,6 +31,8 @@ extern int utc_appcore_widget_widget_app_add_event_handler_n(void); extern int utc_appcore_widget_widget_app_remove_event_handler_p(void); extern int utc_appcore_widget_widget_app_remove_event_handler_n(void); extern int utc_appcore_widget_widget_app_class_create_p(void); +extern int utc_appcore_widget_widget_app_class_add_p(void); +extern int utc_appcore_widget_widget_app_class_add_n(void); extern int utc_appcore_widget_widget_app_exit_p(void); extern int utc_appcore_widget_widget_app_terminate_context_n(void); extern int utc_appcore_widget_widget_app_foreach_context_p(void); @@ -53,6 +55,8 @@ testcase tc_array[] = { {"utc_appcore_widget_widget_app_remove_event_handler_p", utc_appcore_widget_widget_app_remove_event_handler_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_remove_event_handler_n", utc_appcore_widget_widget_app_remove_event_handler_n, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_class_create_p", utc_appcore_widget_widget_app_class_create_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, + {"utc_appcore_widget_widget_app_class_add_p", utc_appcore_widget_widget_app_class_add_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, + {"utc_appcore_widget_widget_app_class_add_n", utc_appcore_widget_widget_app_class_add_n, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_exit_p", utc_appcore_widget_widget_app_exit_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_terminate_context_n", utc_appcore_widget_widget_app_terminate_context_n, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_foreach_context_p", utc_appcore_widget_widget_app_foreach_context_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, diff --git a/src/utc/appcore-widget/tct-appcore-widget-core_wearable.h b/src/utc/appcore-widget/tct-appcore-widget-core_wearable.h index 8bff21a..61aafb0 100755 --- a/src/utc/appcore-widget/tct-appcore-widget-core_wearable.h +++ b/src/utc/appcore-widget/tct-appcore-widget-core_wearable.h @@ -31,6 +31,8 @@ extern int utc_appcore_widget_widget_app_add_event_handler_n(void); extern int utc_appcore_widget_widget_app_remove_event_handler_p(void); extern int utc_appcore_widget_widget_app_remove_event_handler_n(void); extern int utc_appcore_widget_widget_app_class_create_p(void); +extern int utc_appcore_widget_widget_app_class_add_p(void); +extern int utc_appcore_widget_widget_app_class_add_n(void); extern int utc_appcore_widget_widget_app_exit_p(void); extern int utc_appcore_widget_widget_app_terminate_context_n(void); extern int utc_appcore_widget_widget_app_foreach_context_p(void); @@ -53,6 +55,8 @@ testcase tc_array[] = { {"utc_appcore_widget_widget_app_remove_event_handler_p", utc_appcore_widget_widget_app_remove_event_handler_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_remove_event_handler_n", utc_appcore_widget_widget_app_remove_event_handler_n, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_class_create_p", utc_appcore_widget_widget_app_class_create_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, + {"utc_appcore_widget_widget_app_class_add_p", utc_appcore_widget_widget_app_class_add_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, + {"utc_appcore_widget_widget_app_class_add_n", utc_appcore_widget_widget_app_class_add_n, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_exit_p", utc_appcore_widget_widget_app_exit_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_terminate_context_n", utc_appcore_widget_widget_app_terminate_context_n, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, {"utc_appcore_widget_widget_app_foreach_context_p", utc_appcore_widget_widget_app_foreach_context_p, utc_appcore_widget_startup, utc_appcore_widget_cleanup}, diff --git a/src/utc/appcore-widget/utc-appcore-widget.c b/src/utc/appcore-widget/utc-appcore-widget.c index 5761a37..40f7f5e 100755 --- a/src/utc/appcore-widget/utc-appcore-widget.c +++ b/src/utc/appcore-widget/utc-appcore-widget.c @@ -430,6 +430,89 @@ int utc_appcore_widget_widget_app_class_create_p(void) return 0; } +/** + * @testcase utc_appcore_widget_widget_app_class_add_p + * @since_tizen 3.0 + * @type Positive + * @description Makes multiple classes for widget instance. + * @scenario Calls the widget_app_class_add() and then checks the return value. + */ +int utc_appcore_widget_widget_app_class_add_p(void) +{ + widget_instance_lifecycle_callback_s ops = { + .create = widget_obj_create, + .destroy = widget_obj_destroy, + .pause = widget_obj_pause, + .resume = widget_obj_resume, + .update = widget_obj_update, + .resize = widget_obj_resize, + }; + + widget_class_h ch = NULL; + int ret; + bool feature; + + ret = system_info_get_platform_bool(FEATURE_SHELL_APPWIDGET, &feature); + assert_eq_with_exit(ret, SYSTEM_INFO_ERROR_NONE); + + if (!feature) { + ch = widget_app_class_add(NULL, NULL, ops, NULL); + assert_eq_with_exit(get_last_result(), WIDGET_ERROR_NOT_SUPPORTED); + normal_exit(0); + return 0; + } + + ch = widget_app_class_add(ch, "test", ops, NULL); + + assert_eq_with_exit(get_last_result(), WIDGET_ERROR_NONE); + + ch = widget_app_class_add(ch, "2@test", ops, NULL); + + assert_eq_with_exit(get_last_result(), WIDGET_ERROR_NONE); + + normal_exit(0); + + return 0; +} + +/** + * @testcase utc_appcore_widget_widget_app_class_add_n + * @since_tizen 3.0 + * @type Negative + * @description Makes multiple classes for widget instance. + * @scenario Calls the widget_app_class_add() and then checks the return value. + */ +int utc_appcore_widget_widget_app_class_add_n(void) +{ + int ret; + bool feature; + widget_instance_lifecycle_callback_s ops = { + .create = widget_obj_create, + .destroy = widget_obj_destroy, + .pause = widget_obj_pause, + .resume = widget_obj_resume, + .update = widget_obj_update, + .resize = widget_obj_resize, + }; + + ret = system_info_get_platform_bool(FEATURE_SHELL_APPWIDGET, &feature); + assert_eq_with_exit(ret, SYSTEM_INFO_ERROR_NONE); + + if (!feature) { + widget_app_class_add(NULL, NULL, ops, NULL); + assert_eq_with_exit(get_last_result(), WIDGET_ERROR_NOT_SUPPORTED); + normal_exit(0); + return 0; + } + + widget_app_class_add(NULL, NULL, ops, NULL); + + assert_eq_with_exit(get_last_result(), WIDGET_ERROR_INVALID_PARAMETER); + normal_exit(0); + + return 0; +} + static widget_class_h _app_create_and_exit(void *user_data) { widget_instance_lifecycle_callback_s ops = {