--- /dev/null
+/*
+ * Copyright © 2021 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <gtest/gtest.h>
+#include <string>
+
+#include "mmi_iu.h"
+#include "mmi_iu_log.h"
+#include "mmi-common.h"
+
+#include <glib.h>
+#include <string>
+#include <json-glib/json-glib.h>
+
+using namespace std;
+
+#define TEST_APP_ID "org.tizen.iu-test"
+#define SYSTEM_APP_ID "org.tizen.system-app"
+
+static string output_action;
+
+namespace {
+
+static void output_intent_received_cb(const char *app_id, const char *json_data, void *user_data)
+{
+ JsonParser *parser = json_parser_new();
+ GError *err_msg = NULL;
+ JsonNode *root = NULL;
+ JsonObject *root_obj = NULL;
+ const gchar *action = NULL;
+
+ json_parser_load_from_data(parser, (char *)json_data, -1, &err_msg);
+ if (err_msg) {
+ _E("failed to load json file. error message: %s\n", err_msg->message);
+ goto cleanup;
+ }
+
+ root = json_parser_get_root(parser);
+ if (root == NULL) {
+ _E("failed to get root\n");
+ goto cleanup;
+ }
+
+ root_obj = json_node_get_object(root);
+ if (root_obj == NULL) {
+ _E("failed to get object\n");
+ goto cleanup;
+ }
+
+ action = json_object_get_string_member(root_obj, "Action");
+ _D("Action: %s\n", action);
+ output_action = string(action);
+
+cleanup:
+ if (err_msg)
+ g_error_free(err_msg);
+
+ if (parser)
+ g_object_unref(parser);
+}
+
+class IUClientFeedIntentTest : public testing::Test {
+ public:
+ virtual void SetUp() {
+ int ret = mmi_iu_init();
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ ret = mmi_iu_set_rule_filepath("./default_rule.json");
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ output_action = string("");
+
+ ret = mmi_iu_set_output_intent_received_callback(output_intent_received_cb, NULL);
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+ }
+ virtual void TearDown() {
+ mmi_iu_shutdown();
+ }
+ private:
+
+};
+
+int feed_intent_test(mmi_state app_state, const char *input_intent)
+{
+ int ret = mmi_iu_set_app_state(app_state);
+ if (ret != MMI_IU_ERROR_NONE)
+ return ret;
+
+ ret = mmi_iu_set_focus_app_id(TEST_APP_ID);
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ ret = mmi_iu_feed_intent(TEST_APP_ID, input_intent);
+ return ret;
+}
+
+/**
+ * @function utc_mmi_iu_feed_intent_keyinput_press_mic_button
+ * @description Positive UTC of the feed_intent function
+ * @parameter NA
+ */
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_keyinput_press_mic_button)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "KeyInput",
+ "Action" : "PressMicButton"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_INITIATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ cout << "Output action: " << output_action.c_str() << endl;
+
+ EXPECT_STREQ(output_action.c_str(), "WakeUp");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_showpalm)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Gesture",
+ "Action" : "ShowPalm"
+ }
+ ]
+ })";
+
+ int ret = feed_intent_test(MMI_STATE_INITIATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ cout << "Output action: " << output_action.c_str() << endl;
+
+ EXPECT_STREQ(output_action.c_str(), "WakeUp");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_input_press_up)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "KeyInput",
+ "Action" : "PressUpButton"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveUp");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_input_press_down)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "KeyInput",
+ "Action" : "PressDownButton"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveDown");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_input_press_right)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "KeyInput",
+ "Action" : "PressRightButton"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveRight");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_input_press_left)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "KeyInput",
+ "Action" : "PressLeftButton"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveLeft");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_move_up)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "MoveUp"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveUp");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_move_down)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "MoveDown"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveDown");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_move_right)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "MoveRight"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveRight");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_move_left)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "MoveLeft"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveLeft");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_hand_up)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Gesture",
+ "Action" : "HandUp"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveUp");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_hand_down)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Gesture",
+ "Action" : "HandDown"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveDown");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_hand_right)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Gesture",
+ "Action" : "HandRight"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveRight");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_hand_left)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Gesture",
+ "Action" : "HandLeft"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "MoveLeft");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_press_ok)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "KeyInput",
+ "Action" : "PressOkButton"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXECUTION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Execute");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_execute)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "Execute"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXECUTION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Execute");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_play)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "Play"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXECUTION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Play");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_yes)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "Yes"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXECUTION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Yes");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_hand_push)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Gesture",
+ "Action" : "HandPush"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_EXECUTION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Execute");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_back_button)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "KeyInput",
+ "Action" : "PressBackButton"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_FEEDBACK, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Cancel");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_cancel)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "Cancel"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_FEEDBACK, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Cancel");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_back)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "Back"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_FEEDBACK, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Cancel");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_wavehandx)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Gesture",
+ "Action" : "WaveHandX"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_FEEDBACK, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Cancel");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_vision_outofvision)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Vision",
+ "Action" : "OutOfVision"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_OBSERVATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Pause");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_back_terminate)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "KeyInput",
+ "Action" : "PressBackButton"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_TERMINATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Exit");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_exit)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "Exit"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_TERMINATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Exit");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_stop)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "Stop"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_TERMINATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Stop");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_terminate)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Voice",
+ "Action" : "Terminate"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_TERMINATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Terminate");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_flippalm)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Gesture",
+ "Action" : "FlipPalm"
+ }
+ ]
+ }
+ )";
+
+ int ret = feed_intent_test(MMI_STATE_TERMINATION, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "Exit");
+}
+
+TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_flippalm_different_focus)
+{
+ std::string input_intent_json_data =
+ R"({
+ "InputIntents" : [
+ {
+ "Modality" : "Gesture",
+ "Action" : "FlipPalm"
+ }
+ ]
+ }
+ )";
+
+ int ret = mmi_iu_set_output_intent_received_callback(output_intent_received_cb, NULL);
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ ret = mmi_iu_set_focus_app_id(SYSTEM_APP_ID);
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ ret = mmi_iu_feed_intent(TEST_APP_ID, input_intent_json_data.c_str());
+ EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
+
+ EXPECT_STREQ(output_action.c_str(), "");
+}
+
+} // namespace
static void output_intent_received_cb(const char *app_id, const char *json_data, void *user_data)
{
- JsonParser *parser = json_parser_new();
- GError *err_msg = NULL;
- JsonNode *root = NULL;
- JsonObject *root_obj = NULL;
- const gchar *action = NULL;
- json_parser_load_from_data(parser, (char *)json_data, -1, &err_msg);
- if (err_msg) {
- _E("failed to load json file. error message: %s\n", err_msg->message);
- goto cleanup;
- }
-
- root = json_parser_get_root(parser);
- if (root == NULL) {
- _E("failed to get root\n");
- goto cleanup;
- }
-
- root_obj = json_node_get_object(root);
- if (root_obj == NULL) {
- _E("failed to get object\n");
- goto cleanup;
- }
-
- action = json_object_get_string_member(root_obj, "Action");
- _D("Action: %s\n", action);
- output_action = string(action);
-
-cleanup:
- if (err_msg)
- g_error_free(err_msg);
-
- if (parser)
- g_object_unref(parser);
}
class IUClientTest : public testing::Test {
};
-class IUClientFeedIntentTest : public testing::Test {
- public:
- virtual void SetUp() {
- int ret = mmi_iu_init();
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- output_action = string("");
-
- ret = mmi_iu_set_output_intent_received_callback(output_intent_received_cb, NULL);
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
- }
- virtual void TearDown() {
- mmi_iu_shutdown();
- }
- private:
-
-};
-
-
/**
* @function utc_mmi_iu_init_p
* @description Positive UTC of the function that inits intent understanding
EXPECT_EQ(ret, MMI_IU_ERROR_INVALID_PARAMETER);
}
-int feed_intent_test(mmi_state app_state, const char *input_intent)
-{
- int ret = mmi_iu_set_app_state(app_state);
- if (ret != MMI_IU_ERROR_NONE)
- return ret;
-
- ret = mmi_iu_set_focus_app_id(TEST_APP_ID);
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- ret = mmi_iu_feed_intent(TEST_APP_ID, input_intent);
- return ret;
-}
-
-/**
- * @function utc_mmi_iu_feed_intent_keyinput_press_mic_button
- * @description Positive UTC of the feed_intent function
- * @parameter NA
- */
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_keyinput_press_mic_button)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "KeyInput",
- "Action" : "PressMicButton"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_INITIATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "WakeUp");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_showpalm)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Gesture",
- "Action" : "ShowPalm"
- }
- ]
- })";
-
- int ret = feed_intent_test(MMI_STATE_INITIATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "WakeUp");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_input_press_up)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "KeyInput",
- "Action" : "PressUpButton"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveUp");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_input_press_down)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "KeyInput",
- "Action" : "PressDownButton"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveDown");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_input_press_right)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "KeyInput",
- "Action" : "PressRightButton"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveRight");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_input_press_left)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "KeyInput",
- "Action" : "PressLeftButton"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveLeft");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_move_up)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "MoveUp"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveUp");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_move_down)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "MoveDown"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveDown");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_move_right)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "MoveRight"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveRight");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_move_left)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "MoveLeft"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveLeft");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_hand_up)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Gesture",
- "Action" : "HandUp"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveUp");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_hand_down)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Gesture",
- "Action" : "HandDown"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveDown");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_hand_right)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Gesture",
- "Action" : "HandRight"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveRight");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_hand_left)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Gesture",
- "Action" : "HandLeft"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXPLORATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "MoveLeft");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_press_ok)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "KeyInput",
- "Action" : "PressOkButton"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXECUTION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Execute");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_execute)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "Execute"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXECUTION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Execute");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_play)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "Play"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXECUTION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Play");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_yes)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "Yes"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXECUTION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Yes");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_hand_push)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Gesture",
- "Action" : "HandPush"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_EXECUTION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Execute");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_back_button)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "KeyInput",
- "Action" : "PressBackButton"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_FEEDBACK, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Cancel");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_cancel)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "Cancel"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_FEEDBACK, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Cancel");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_back)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "Back"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_FEEDBACK, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Cancel");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_wavehandx)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Gesture",
- "Action" : "WaveHandX"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_FEEDBACK, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Cancel");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_vision_outofvision)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Vision",
- "Action" : "OutOfVision"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_OBSERVATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Pause");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_key_back_terminate)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "KeyInput",
- "Action" : "PressBackButton"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_TERMINATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Exit");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_exit)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "Exit"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_TERMINATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Exit");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_stop)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "Stop"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_TERMINATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Stop");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_voice_terminate)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Voice",
- "Action" : "Terminate"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_TERMINATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Terminate");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_flippalm)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Gesture",
- "Action" : "FlipPalm"
- }
- ]
- }
- )";
-
- int ret = feed_intent_test(MMI_STATE_TERMINATION, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "Exit");
-}
-
-TEST_F(IUClientFeedIntentTest, utc_mmi_iu_feed_intent_gesture_flippalm_different_focus)
-{
- std::string input_intent_json_data =
- R"({
- "InputIntents" : [
- {
- "Modality" : "Gesture",
- "Action" : "FlipPalm"
- }
- ]
- }
- )";
-
- int ret = mmi_iu_set_output_intent_received_callback(output_intent_received_cb, NULL);
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- ret = mmi_iu_set_focus_app_id(SYSTEM_APP_ID);
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- ret = mmi_iu_feed_intent(TEST_APP_ID, input_intent_json_data.c_str());
- EXPECT_EQ(ret, MMI_IU_ERROR_NONE);
-
- EXPECT_STREQ(output_action.c_str(), "");
-}
-
TEST_F(IUClientTest, utc_mmi_iu_set_output_intent_received_callback_n_callback_null)
{
int ret = mmi_iu_set_output_intent_received_callback(NULL, NULL);