}
void __provider_foreach_cb(const provider_info_h info, void *user_data) {
- char* str_value;
- int types;
-
+ char* str_value = nullptr;
watchface_complication_provider_info_get_id(info, &str_value);
- EXPECT_STREQ(str_value, "org.tizen.gmock_comp_provider/test");
- free(str_value);
+ unique_ptr<char, decltype(free)*> ptr(str_value, free);
+ EXPECT_STREQ(ptr.get(), "org.tizen.gmock_comp_provider/test");
+ str_value = nullptr;
watchface_complication_provider_info_get_app_id(info, &str_value);
- EXPECT_STREQ(str_value, "org.tizen.gmock_comp_provider");
- free(str_value);
+ ptr.reset(str_value);
+ EXPECT_STREQ(ptr.get(), "org.tizen.gmock_comp_provider");
+ str_value = nullptr;
watchface_complication_provider_info_get_label(info, &str_value);
- EXPECT_STREQ(str_value, "provider_label");
- free(str_value);
+ ptr.reset(str_value);
+ EXPECT_STREQ(ptr.get(), "provider_label");
+ str_value = nullptr;
watchface_complication_provider_info_get_icon(info, &str_value);
- EXPECT_STREQ(str_value, "icon_path");
- free(str_value);
+ ptr.reset(str_value);
+ EXPECT_STREQ(ptr.get(), "icon_path");
+ int types;
watchface_complication_provider_info_get_types(info, &types);
EXPECT_EQ(WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT |
WATCHFACE_COMPLICATION_TYPE_LONG_TEXT |
WATCHFACE_COMPLICATION_TYPE_IMAGE |
WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE,
types);
-
}
class CWCP : public ::testing::Test {