return MMI_ERROR_NONE;
}
+
+MMI_API int mmi_set_result_cb(int input_event_type, result_cb callback, void* user_data)
+{
+ LOGI("Set result cb about input event type(%d)", input_event_type);
+
+ int ret;
+
+ ret = mmi_client_set_result_cb(input_event_type, callback, user_data);
+ if(ret != MMI_ERROR_NONE) {
+ LOGE("Fail to set result cb(%d)", ret);
+ return MMI_ERROR_NOT_SUPPORTED;
+ }
+
+ return MMI_ERROR_NONE;
+}
MMI_API int mmi_init(void);
MMI_API int mmi_shutdown(void);
+MMI_API int mmi_set_result_cb(int input_event_type, result_cb callback, void* user_data);
#ifdef __cplusplus
}
data = (result_cb_s*)iter->data;
EXPECT_NE(data->result_callback, nullptr);
EXPECT_EQ(data->result_callback, voice_touch_callback);
- EXPECT_EQ(data->input_event_type, MMI_VOICE_TOUCH);
+ EXPECT_EQ(data->input_event_type, input_event_type);
}
else {
EXPECT_TRUE(false);
mmi_shutdown();
}
+
+TEST_F(MMIMainTest, MMISetResultCbSuccess)
+{
+ int res = mmi_init();
+ mmi_input_event_type_e input_event_type = MMI_VOICE_TOUCH;
+
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+ res = mmi_set_result_cb(input_event_type, voice_touch_callback, NULL);
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ mmi_shutdown();
+}
+
+TEST_F(MMIMainTest, MMISetResultCbFail)
+{
+ int res = mmi_init();
+ mmi_input_event_type_e input_event_type = MMI_VOICE_TOUCH;
+
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_set_result_cb(input_event_type, NULL, NULL);
+ EXPECT_EQ(res, MMI_ERROR_NOT_SUPPORTED);
+
+ mmi_shutdown();
+}