+
+TEST_F(WidgetAppTest, widget_app_exit) {
+ int ret = widget_app_exit();
+ EXPECT_EQ(WIDGET_ERROR_NONE, ret);
+}
+
+TEST_F(WidgetAppTest, widget_app_terminate_context) {
+ widget_context_h context =
+ (widget_context_h)calloc(1, sizeof(widget_context_h));
+ int ret = widget_app_terminate_context(context);
+ EXPECT_EQ(WIDGET_ERROR_NONE, ret);
+}
+
+bool __widget_context_cb(widget_context_h context, void *user_data) {
+ return true;
+}
+
+TEST_F(WidgetAppTest, widget_app_foreach_context) {
+ int ret = widget_app_foreach_context(__widget_context_cb, nullptr);
+ EXPECT_EQ(WIDGET_ERROR_NONE, ret);
+}
+
+void __app_event_cb(app_event_info_h event_info, void *user_data) {
+}
+
+TEST_F(WidgetAppTest, widget_app_add_event_handler) {
+ app_event_handler_h handle;
+ int ret = widget_app_add_event_handler(&handle, APP_EVENT_LOW_MEMORY,
+ __app_event_cb, nullptr);
+ EXPECT_EQ(WIDGET_ERROR_NONE, ret);
+}
+
+TEST_F(WidgetAppTest, widget_app_remove_event_handler) {
+ app_event_handler_h handle;
+ int ret = widget_app_add_event_handler(&handle, APP_EVENT_LOW_MEMORY,
+ __app_event_cb, nullptr);
+ ret = widget_app_remove_event_handler(handle);
+ EXPECT_EQ(WIDGET_ERROR_NONE, ret);
+}
+
+TEST_F(WidgetAppTest, widget_app_get_id) {
+ widget_context_h context =
+ (widget_context_h)calloc(1, sizeof(widget_context_h));
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_instance_get_id(_)).
+ WillOnce(Return("test"));
+
+ const char *id = widget_app_get_id(context);
+ EXPECT_STREQ(id, "test");
+}
+
+TEST_F(WidgetAppTest, widget_app_class_create) {
+ widget_instance_lifecycle_callback_s lifecycle;
+
+ lifecycle.create = __instance_create_cb;
+ lifecycle.destroy = __instance_destroy_cb;
+ lifecycle.pause = __instance_pause_cb;
+ lifecycle.resume = __instance_resume_cb;
+ lifecycle.resize = __instance_resize_cb;
+ lifecycle.update = __instance_update_cb;
+
+ EXPECT_CALL(GetMock<AppCommonMock>(), app_get_id(_)).
+ WillOnce(Invoke(__app_get_id_fake));
+
+ widget_class_h cls = widget_app_class_create(lifecycle, nullptr);
+ EXPECT_NE(nullptr, cls);
+}
+
+TEST_F(WidgetAppTest, widget_app_context_set_tag) {
+ widget_context_h context =
+ (widget_context_h)calloc(1, sizeof(widget_context_h));
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_instance_get_extra(_)).
+ WillOnce(Invoke(__appcore_multiwindow_base_instance_get_extra_fake));
+
+ int ret = widget_app_context_set_tag(context, (void*)"test");
+ EXPECT_EQ(WIDGET_ERROR_NONE, ret);
+}
+
+TEST_F(WidgetAppTest, widget_app_context_get_tag) {
+ widget_context_h context =
+ (widget_context_h)calloc(1, sizeof(widget_context_h));
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_instance_get_extra(_)).
+ WillOnce(Invoke(__appcore_multiwindow_base_instance_get_extra_fake));
+
+ void* tag;
+ int ret = widget_app_context_get_tag(context, &tag);
+ EXPECT_EQ(WIDGET_ERROR_NONE, ret);
+}
+
+TEST_F(WidgetAppTest, widget_app_context_set_content_info) {
+ widget_context_h context =
+ (widget_context_h)calloc(1, sizeof(widget_context_h));
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_instance_get_extra(_)).
+ WillOnce(Invoke(__appcore_multiwindow_base_instance_get_extra_fake));
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_instance_get_id(_)).
+ WillOnce(Invoke(__appcore_multiwindow_base_instance_get_id_fake));
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_instance_get_class_id(_)).
+ WillOnce(Invoke(__appcore_multiwindow_base_instance_get_class_id_fake));
+
+ bundle* content_info = bundle_create();
+ int ret = widget_app_context_set_content_info(context, content_info);
+ EXPECT_EQ(WIDGET_ERROR_NONE, ret);
+}
+
+TEST_F(WidgetAppTest, widget_app_context_set_title) {
+ widget_context_h context =
+ (widget_context_h)calloc(1, sizeof(widget_context_h));
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_instance_get_extra(_)).
+ WillRepeatedly(Invoke(__appcore_multiwindow_base_instance_get_extra_fake));
+
+ int ret = widget_app_context_set_title(context, "title");
+ EXPECT_EQ(WIDGET_ERROR_NONE, ret);
+}
+
+TEST_F(WidgetAppTest, widget_app_class_add) {
+ widget_instance_lifecycle_callback_s lifecycle;
+ widget_class_h cls = widget_app_class_add(
+ nullptr, "test", lifecycle, nullptr);
+
+ lifecycle.create = __instance_create_cb;
+ lifecycle.destroy = __instance_destroy_cb;
+ lifecycle.pause = __instance_pause_cb;
+ lifecycle.resume = __instance_resume_cb;
+ lifecycle.resize = __instance_resize_cb;
+ lifecycle.update = __instance_update_cb;
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_class_add(_)).
+ WillOnce(Invoke(__appcore_multiwindow_base_class_add_fake));
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_instance_get_extra(_)).
+ WillRepeatedly(Invoke(__appcore_multiwindow_base_instance_get_extra_fake));
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_instance_get_class_id(_)).
+ WillRepeatedly(Invoke(__appcore_multiwindow_base_instance_get_class_id_fake));
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_instance_drop(_)).
+ Times(1);
+
+ cls = widget_app_class_add(
+ nullptr, "test", lifecycle, nullptr);
+ EXPECT_NE(nullptr, cls);
+
+ tizen_base::Bundle b;
+ b.Add("__AUL_WIDGET_VIEWER__", "test");
+ int ret = bundle_add_str(b.GetHandle(), "KEY", "VALUE");
+ ASSERT_EQ(ret, BUNDLE_ERROR_NONE);
+
+ char** argv = nullptr;
+ int argc = bundle_export_to_argv(b.GetHandle(), &argv);
+ ASSERT_EQ(get_last_result(), BUNDLE_ERROR_NONE);
+ ASSERT_NE(argv, nullptr);
+ ASSERT_NE(argc, 0);
+
+ widget_app_lifecycle_callback_s callback;
+ callback.create = __app_create_cb;
+ callback.terminate = __app_terminate_cb;
+
+ ret = widget_app_main(argc, argv, &callback, nullptr);
+ EXPECT_EQ(WIDGET_ERROR_NONE, ret);
+}
+
+TEST_F(WidgetAppTest, widget_app_get_elm_win_negative) {
+ Evas_Object* win;
+ widget_context_h context =
+ (widget_context_h)calloc(1, sizeof(widget_context_h));
+ int ret = widget_app_get_elm_win(context, &win);
+ EXPECT_EQ(WIDGET_ERROR_FAULT, ret);
+}
+
+TEST_F(WidgetAppTest, widget_app_get_elm_win) {
+ EXPECT_CALL(GetMock<ElmMock>(),
+ elm_win_add(_, _, _)).
+ WillOnce(Return((Evas_Object*)calloc(1, sizeof(char))));
+
+ EXPECT_CALL(GetMock<EcoreWl2Mock>(),
+ ecore_evas_wayland2_window_get(_)).
+ WillOnce(Return((Ecore_Wl2_Window*)calloc(1, sizeof(char))));
+
+ EXPECT_CALL(GetMock<ElmMock>(),
+ elm_win_aux_hint_add(_, _, _)).
+ WillOnce(Return(0));
+
+ EXPECT_CALL(GetMock<EcoreWl2Mock>(),
+ ecore_wl2_window_surface_get(_)).
+ WillOnce(Return(nullptr));
+
+ EXPECT_CALL(GetMock<EcoreWl2Mock>(),
+ evas_object_event_callback_add(_, _, _, _)).
+ Times(1);
+
+ EXPECT_CALL(GetMock<EcoreWl2Mock>(),
+ evas_object_data_set(_, _, _)).
+ Times(1);
+
+ EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
+ appcore_multiwindow_base_instance_get_extra(_)).
+ WillRepeatedly(Invoke(__appcore_multiwindow_base_instance_get_extra_fake));
+
+ Evas_Object* win;
+ widget_context_h context =
+ (widget_context_h)calloc(1, sizeof(widget_context_h));
+ int ret = widget_app_get_elm_win(context, &win);
+ EXPECT_EQ(WIDGET_ERROR_NONE, ret);
+}