#include <widget_viewer_evas.h>
#include "assert.h"
+#include "assert_common.h"
#include "tct_app_common.h"
#define SAMPLE_NAME "sample"
int is_asserted;
bool appwidget_supported;
} s_info = {
- .is_asserted = 0,
- .appwidget_supported = 0
+ .is_asserted = 0,
+ .appwidget_supported = 0
};
+static int lifecycle_resume;
+static int result = -1;
+
+typedef int (*test_case_cb)(Evas_Object *widget);
+int add_a_sample_widget(test_case_cb cb);
+
/**
* Setup the TC environment
ret = widget_service_get_size(WIDGET_SIZE_TYPE_UNKNOWN, &w, &h);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}
/* Out-param is NULL */
ret = widget_service_get_size_type(1, 1, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
/* Invalid width & height */
ret = widget_service_get_size_type(1, 1, &type);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}
/* Package name is not valid */
ret = widget_service_get_need_of_mouse_event(NULL, WIDGET_SIZE_TYPE_2x2, &mouse_event);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_need_of_touch_effect(NULL, WIDGET_SIZE_TYPE_2x2, &touch_effect);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_need_of_frame(NULL, WIDGET_SIZE_TYPE_2x2, &frame);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_trigger_update(NULL, NULL, NULL, 0);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
/**
* If it is okay for security view.
*/
+ normal_exit(0);
return 0;
}
ret = widget_service_change_period(NULL, NULL, -0.1f);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_widget_list(NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}
char *ret;
ret = widget_service_get_main_app_id(NEGATIVE_SAMPLE_WIDGET);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
ret = widget_service_get_main_app_id(NULL);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
+ normal_exit(0);
return 0;
}
ret = widget_service_get_widget_list_by_pkgid(NULL, NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}
char *ret;
ret = widget_service_get_widget_id(NULL);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
ret = widget_service_get_widget_id(NEGATIVE_SAMPLE_WIDGET);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
+ normal_exit(0);
return 0;
}
char *ret;
ret = widget_service_get_app_id_of_setup_app(NULL);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
ret = widget_service_get_app_id_of_setup_app(NEGATIVE_SAMPLE_WIDGET);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
+ normal_exit(0);
return 0;
}
char *ret;
ret = widget_service_get_package_id(NULL);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
ret = widget_service_get_package_id(NEGATIVE_SAMPLE_WIDGET);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
+ normal_exit(0);
return 0;
}
char *ret;
ret = widget_service_get_name(NULL, NULL);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
ret = widget_service_get_name(NEGATIVE_SAMPLE_WIDGET, NULL);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
+ normal_exit(0);
return 0;
}
char *ret;
ret = widget_service_get_preview_image_path(NULL, WIDGET_SIZE_TYPE_UNKNOWN);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
ret = widget_service_get_preview_image_path(NEGATIVE_SAMPLE_WIDGET, WIDGET_SIZE_TYPE_UNKNOWN);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
ret = widget_service_get_preview_image_path(SAMPLE_WIDGET, WIDGET_SIZE_TYPE_1x1);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
+ normal_exit(0);
return 0;
}
char *ret;
ret = widget_service_get_icon(NULL, NULL);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
ret = widget_service_get_icon(NEGATIVE_SAMPLE_WIDGET, NULL);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
+ normal_exit(0);
return 0;
}
if (ret == 0)
ret = get_last_result();
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_supported_sizes(NULL, NULL, NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_supported_sizes(SAMPLE_WIDGET, NULL, NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_supported_sizes(SAMPLE_WIDGET, &cnt, NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_supported_sizes(SAMPLE_WIDGET, &cnt, (int **)&w, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_supported_sizes(NEGATIVE_SAMPLE_WIDGET, &cnt, (int **)&w, (int **)&h);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NOT_EXIST);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_EXIST);
}
-
-
+ normal_exit(0);
return 0;
}
ret = widget_service_get_supported_size_types(NULL, NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_supported_size_types(SAMPLE_WIDGET, NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_supported_size_types(NULL, &cnt, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_supported_size_types(NULL, NULL, &size_types);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_supported_size_types(SAMPLE_WIDGET, &cnt, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_supported_size_types(NULL, &cnt, &size_types);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_supported_size_types(SAMPLE_WIDGET, NULL, &size_types);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_supported_size_types(NEGATIVE_SAMPLE_WIDGET, &cnt, &size_types);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
- assert_eq(cnt, 0);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(cnt, 0);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_widget_instance_list(NULL, NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_set_lifecycle_event_cb(NULL, NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
- return 0;
+ normal_exit(0);
+return 0;;
}
/**
int ret;
ret = widget_service_unset_lifecycle_event_cb(SAMPLE_WIDGET, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NOT_EXIST);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_EXIST);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_content_of_widget_instance(NULL, NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_content_of_widget_instance(SAMPLE_WIDGET, NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_content_of_widget_instance(SAMPLE_WIDGET, "error", NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
ret = widget_service_get_content_of_widget_instance(SAMPLE_WIDGET, "error", NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_size(WIDGET_SIZE_TYPE_2x2, &w, &h);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_size(WIDGET_SIZE_TYPE_2x2, &w, &h);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
ret = widget_service_get_size_type(w, h, &type);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
- assert_eq(type, WIDGET_SIZE_TYPE_2x2);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(type, WIDGET_SIZE_TYPE_2x2);
}
+ normal_exit(0);
return 0;
}
/* Package name is not valid */
ret = widget_service_get_need_of_mouse_event(SAMPLE_WIDGET, WIDGET_SIZE_TYPE_2x2, &mouse_event);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_need_of_touch_effect(SAMPLE_WIDGET, WIDGET_SIZE_TYPE_2x2, &touch_effect);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
- assert_eq(touch_effect, false);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(touch_effect, false);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_need_of_frame(SAMPLE_WIDGET, WIDGET_SIZE_TYPE_2x2, &frame);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
+ normal_exit(0);
return 0;
}
+static int __list_cb(const char *widget_id, const char *instance_id, void *data)
+{
+ int ret;
+ bundle *b;
+
+ if (strcmp(widget_id, "org.tizen.sample_widget")) {
+ normal_exit(0);
+ return WIDGET_ERROR_NONE;
+ }
+
+ b = bundle_create();
+ if (b == NULL)
+ return WIDGET_ERROR_OUT_OF_MEMORY;
+
+ bundle_add_str(b, "CI_KEY", "CI_VALUE");
+
+ ret = widget_service_trigger_update(widget_id, instance_id, b, true);
+ if (s_info.appwidget_supported == false) {
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ } else {
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
+ }
+
+ bundle_free(b);
+
+ normal_exit(0);
+ return WIDGET_ERROR_NONE;
+}
+
+static int tc_trigger_update_p_callback(Evas_Object *widget)
+{
+ int ret;
+
+ ret = widget_service_get_widget_instance_list("org.tizen.sample_widget", __list_cb, NULL);
+ if (s_info.appwidget_supported == false) {
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ } else {
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
+ }
+
+ return ret;
+}
+
/**
* @testcase utc_widget_service_trigger_update_p
* @since_tizen 2.3.1
* @note
* TC could not trigger the update, because the TC is not packaged in with Sample Widget
*/
- ret = widget_service_trigger_update(SAMPLE_WIDGET, NULL, NULL, 1);
+ ret = add_a_sample_widget(tc_trigger_update_p_callback);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_PERMISSION_DENIED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
return 0;
static int tct_async_ret_callback(test_case_cb cb, struct widget_evas_event_info *info)
{
assert_neq(info, NULL);
- assert_eq(info->error, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(info->error, WIDGET_ERROR_NONE);
assert_neq(info->widget_app_id, NULL);
- assert_eq(strcmp(info->widget_app_id, "org.tizen.sample_widget"), 0);
- assert_eq(info->event, WIDGET_EVENT_CREATED);
+ assert_eq_with_exit(strcmp(info->widget_app_id, "org.tizen.sample_widget"), 0);
+ assert_eq_with_exit(info->event, WIDGET_EVENT_CREATED);
- return 0;
+ normal_exit(0);
+ return 0;;
}
static void _widget_create_cb(void *data, Evas_Object *obj, void *event_info)
ret = tct_async_ret_callback(cb, info);
s_info.is_asserted = ret;
if (!ret && cb) {
- cb(obj);
+ result = cb(obj);
}
}
+
+Evas_Object *_win;
static int __lifecycle_cb(const char *widget_id, widget_lifecycle_event_e lifecycle_event,
const char *widget_instance_id, void *data)
{
- if (lifecycle_event == WIDGET_LIFE_CYCLE_EVENT_RESUME &&
- s_info.is_asserted == 0)
- elm_exit();
+ int ret;
+ if (lifecycle_event == WIDGET_LIFE_CYCLE_EVENT_RESUME)
+ lifecycle_resume = 1;
+
+ if (result != -1 && lifecycle_resume) {
+ widget_service_unset_lifecycle_event_cb("org.tizen.sample_widget", NULL);
+ ret = widget_viewer_evas_fini();
+ if (s_info.appwidget_supported == false) {
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ return WIDGET_ERROR_NOT_SUPPORTED;
+ } else {
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
+ }
+ evas_object_del(_win);
+ elm_exit();
+ normal_exit(0);
+ }
return 0;
}
int add_a_sample_widget(test_case_cb cb)
{
- Evas_Object *win;
+
Evas_Object *widget;
int w, h;
int ret;
- win = elm_win_add(NULL, "sample_widget", ELM_WIN_BASIC);
- assert_neq(win, NULL);
- evas_object_size_hint_weight_set(win, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ _win = elm_win_add(NULL, "sample_widget", ELM_WIN_BASIC);
+ assert_neq(_win, NULL);
+ evas_object_size_hint_weight_set(_win, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- ret = widget_viewer_evas_init(win);
+ ret = widget_viewer_evas_init(_win);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
return WIDGET_ERROR_NOT_SUPPORTED;
} else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
- evas_object_show(win);
+ evas_object_show(_win);
- widget = widget_viewer_evas_add_widget(win, "org.tizen.sample_widget", NULL, 0.0f);
+ widget = widget_viewer_evas_add_widget(_win, "org.tizen.sample_widget", NULL, 0.0f);
if (s_info.appwidget_supported == false) {
- assert_eq(widget, NULL);
+ assert_eq_with_exit(widget, NULL);
return WIDGET_ERROR_NOT_SUPPORTED;
} else {
assert_neq(widget, NULL);
ret = widget_service_get_size(WIDGET_SIZE_TYPE_2x2, &w, &h);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
return WIDGET_ERROR_NOT_SUPPORTED;
} else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
widget_service_set_lifecycle_event_cb("org.tizen.sample_widget", __lifecycle_cb, NULL);
evas_object_show(widget);
elm_run();
-
- widget_service_unset_lifecycle_event_cb("org.tizen.sample_widget", NULL);
- ret = widget_viewer_evas_fini();
- if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
- return WIDGET_ERROR_NOT_SUPPORTED;
- } else {
- assert_eq(ret, WIDGET_ERROR_NONE);
- }
-
- evas_object_del(win);
-
- return s_info.is_asserted;
+ return WIDGET_ERROR_NONE;
}
/* Common routines for creating a widget instance - END*/
if (s_info.appwidget_supported == false) {
assert_neq(ret, WIDGET_ERROR_NONE);
} else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
return ret;
ret = add_a_sample_widget(tc_change_period_p_callback);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
} else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
return s_info.is_asserted;
static int widget_list_cb_p(const char *pkgid, const char *widget_id, int is_prime, void *data)
{
+ normal_exit(0);
return 0;
}
*/
ret = widget_service_get_widget_list(widget_list_cb_p, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
} else {
assert_neq(ret, WIDGET_ERROR_NOT_EXIST);
}
+ normal_exit(0);
return 0;
}
if (s_info.appwidget_supported == false) {
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
}
else {
assert_neq(ret, NULL);
result = strcmp(ret, SAMPLE_WIDGET);
free(ret);
- assert_eq(result, 0);
+ assert_eq_with_exit(result, 0);
}
+ normal_exit(0);
return 0;
}
static int utc_widget_service_get_widget_list_by_pkgid_p_cb(const char *widget_id, int is_primary, void *data)
{
+ normal_exit(0);
return 0;
}
int ret;
ret = widget_service_get_widget_list_by_pkgid(SAMPLE_WIDGET, utc_widget_service_get_widget_list_by_pkgid_p_cb, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, 1);
+ assert_eq_with_exit(ret, 1);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_widget_id(SAMPLE_WIDGET);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
}
else {
assert_neq(ret, NULL);
result = strcmp(ret, SAMPLE_WIDGET);
free(ret);
- assert_eq(result, 0);
+ assert_eq_with_exit(result, 0);
}
+ normal_exit(0);
return 0;
}
char *ret;
ret = widget_service_get_app_id_of_setup_app(SAMPLE_WIDGET);
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
+ normal_exit(0);
return 0;
}
ret = widget_service_get_package_id(SAMPLE_WIDGET);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
}
else {
assert_neq(ret, NULL);
result = strcmp(ret, SAMPLE_PKGNAME);
free(ret);
- assert_eq(result, 0);
+ assert_eq_with_exit(result, 0);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_name(SAMPLE_WIDGET, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
}
else {
assert_neq(ret, NULL);
free(ret);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_preview_image_path(SAMPLE_WIDGET, WIDGET_SIZE_TYPE_2x2);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
}
else {
assert_neq(ret, NULL);
assert_neq(result, 0);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_icon(SAMPLE_WIDGET, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, NULL);
+ assert_eq_with_exit(ret, NULL);
}
else {
assert_neq(ret, NULL);
assert_neq(result, 0);
}
+ normal_exit(0);
return 0;
}
if (s_info.appwidget_supported == true) {
ret = widget_service_get_nodisplay(SAMPLE_WIDGET);
- assert_eq(ret, 0);
+ assert_eq_with_exit(ret, 0);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_supported_sizes(SAMPLE_WIDGET, &cnt, &w, &h);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
- assert_eq(cnt, 1);
+ assert_eq_with_exit(cnt, 1);
ret = widget_service_get_size(WIDGET_SIZE_TYPE_2x2, &sw, &sh);
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
- assert_eq(w[0], sw);
- assert_eq(h[0], sh);
+ assert_eq_with_exit(w[0], sw);
+ assert_eq_with_exit(h[0], sh);
free(w);
free(h);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_get_supported_size_types(SAMPLE_WIDGET, &cnt, &size_types);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
- assert_eq(cnt, 1);
- assert_eq(size_types[0], WIDGET_SIZE_TYPE_2x2);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(cnt, 1);
+ assert_eq_with_exit(size_types[0], WIDGET_SIZE_TYPE_2x2);
free(size_types);
}
+ normal_exit(0);
return 0;
}
static int utc_widget_instance_list_cb_p(const char *widget_id, const char *instance_id, void *data)
{
+ normal_exit(0);
return 0;
}
ret = add_a_sample_widget(tc_get_widget_instance_list_p_callback);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
+ normal_exit(0);
return 0;
}
static int widget_lifecycle_event_cb_p(const char *widget_id, widget_lifecycle_event_e lifecycle_event, const char *widget_instance_id, void *data)
{
+ normal_exit(0);
return 0;
}
ret = widget_service_set_lifecycle_event_cb(NULL, widget_lifecycle_event_cb_p, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
ret = widget_service_unset_lifecycle_event_cb(NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
+ normal_exit(0);
return 0;
}
ret = widget_service_set_lifecycle_event_cb(NULL, widget_lifecycle_event_cb_p, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
ret = widget_service_unset_lifecycle_event_cb(NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_NONE);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NONE);
}
+ normal_exit(0);
return 0;
}
*/
ret = widget_service_get_content_of_widget_instance(SAMPLE_WIDGET, NULL, NULL);
if (s_info.appwidget_supported == false) {
- assert_eq(ret, WIDGET_ERROR_NOT_SUPPORTED);
+ assert_eq_with_exit(ret, WIDGET_ERROR_NOT_SUPPORTED);
}
else {
- assert_eq(ret, WIDGET_ERROR_INVALID_PARAMETER);
+ assert_eq_with_exit(ret, WIDGET_ERROR_INVALID_PARAMETER);
}
+ normal_exit(0);
return 0;
}