void* user_data;
} widget_base_instance_data;
+struct _widget_context {
+ int context;
+};
+
class Mocks : public ::testing::NiceMock<GioMock>,
public ::testing::NiceMock<MultiWindowBaseMock>,
public ::testing::NiceMock<AppCommonMock>,
TEST_F(WidgetAppTest, widget_app_terminate_context) {
widget_context_h context =
- (widget_context_h)calloc(1, sizeof(widget_context_h));
+ (widget_context_h)calloc(1, sizeof(struct _widget_context));
int ret = widget_app_terminate_context(context);
+ free(context);
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));
+ (widget_context_h)calloc(1, sizeof(struct _widget_context));
EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
appcore_multiwindow_base_instance_get_id(_)).
WillOnce(Return("test"));
const char *id = widget_app_get_id(context);
+ free(context);
EXPECT_STREQ(id, "test");
}
TEST_F(WidgetAppTest, widget_app_context_set_tag) {
widget_context_h context =
- (widget_context_h)calloc(1, sizeof(widget_context_h));
+ (widget_context_h)calloc(1, sizeof(struct _widget_context));
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");
+ free(context);
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));
+ (widget_context_h)calloc(1, sizeof(struct _widget_context));
EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
appcore_multiwindow_base_instance_get_extra(_)).
void* tag;
int ret = widget_app_context_get_tag(context, &tag);
+ free(context);
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));
+ (widget_context_h)calloc(1, sizeof(struct _widget_context));
EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
appcore_multiwindow_base_instance_get_extra(_)).
bundle* content_info = bundle_create();
int ret = widget_app_context_set_content_info(context, content_info);
+ free(context);
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));
+ (widget_context_h)calloc(1, sizeof(struct _widget_context));
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");
+ free(context);
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.resize = __instance_resize_cb;
lifecycle.update = __instance_update_cb;
+ widget_class_h cls = widget_app_class_add(
+ nullptr, "test", lifecycle, nullptr);
+
EXPECT_CALL(GetMock<MultiWindowBaseMock>(),
appcore_multiwindow_base_class_add(_)).
WillOnce(Invoke(__appcore_multiwindow_base_class_add_fake));
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));
+ (widget_context_h)calloc(1, sizeof(struct _widget_context));
int ret = widget_app_get_elm_win(context, &win);
+ free(context);
EXPECT_EQ(WIDGET_ERROR_FAULT, ret);
}
Evas_Object* win;
widget_context_h context =
- (widget_context_h)calloc(1, sizeof(widget_context_h));
+ (widget_context_h)calloc(1, sizeof(struct _widget_context));
int ret = widget_app_get_elm_win(context, &win);
+ free(context);
EXPECT_EQ(WIDGET_ERROR_NONE, ret);
}