From: Suyeon Hwang Date: Tue, 27 Sep 2022 04:52:44 +0000 (+0900) Subject: Remove unused files and function from IU module X-Git-Tag: accepted/tizen/unified/20221007.101823~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=21c6d024e005ef93e05fe753f151b03b7816fa04;p=platform%2Fcore%2Fuifw%2Fmmi-manager.git Remove unused files and function from IU module Change-Id: I327ca986d62b9d32f723ab22aa09fb036dee2269 Signed-off-by: Suyeon Hwang --- diff --git a/README.md b/README.md index ca34f9e..c774d9f 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -# MMI(Multi-modal Interaction) Manager - -[Source Tree] -. -├── CODEOWNERS -├── COPYING -├── meson.build -├── meson_options.txt -├── packaging -│   ├── mmi-manager.manifest -│   └── mmi-manager.spec -├── README.md +# MMI(Multi-modal Interaction) Manager + +[Source Tree] +. +├── CODEOWNERS +├── COPYING +├── meson.build +├── meson_options.txt +├── packaging +│   ├── mmi-manager.manifest +│   └── mmi-manager.spec +├── README.md ├── src │   ├── bin │   │   ├── main.c @@ -21,10 +21,6 @@ | │   │   ├── CommandFinder.h | │   │   ├── CommandManager.cpp | │   │   ├── CommandManager.h -| │   │   ├── input_intent.cpp -| │   │   ├── input_intent.h -| │   │   ├── iu_rule.cpp -| │   │   ├── iu_rule.h | │   │   ├── json_provider.cpp | │   │   ├── json_provider.h | │   │   ├── mmi_iu.cpp @@ -32,8 +28,6 @@ | │   │   ├── mmi_iu_error.h | │   │   ├── mmi_iu_event.h | │   │   ├── mmi_iu_log.h -| │   │   ├── output_intent.cpp -| │   │   ├── output_intent.h | │   │   ├── StringUtil.cpp | │   │   ├── StringUtil.h | │   │   ├── VoiceTouchEngine.cpp @@ -85,10 +79,10 @@ | |   ├── mv_log_cfg.h | |    ├── mv_video_helper.c | |    └── mv_video_helper.h -├── tests +├── tests │   ├── ecore-event-dispatcher.cpp | ├── meson.build -│   ├── mmi-manager-tests.cpp +│   ├── mmi-manager-tests.cpp │   ├── mmi-manager-tests.h │   ├── mmi-client-tests.cpp | ├── mmi-provider-tests.cpp @@ -105,13 +99,9 @@ │   │   └── mmi-vision-provider-tests.cpp │   └── iu │   ├── CommandFinder_unittests.cpp -│   ├── iu_rule_unittests.cpp -│   ├── mmi_iu_feed_intent_unittests.cpp -│   ├── mmi_iu_unittests.cpp │   ├── CommandManager_unittests.cpp │   ├── mmi_iu_feed_input_event_unittests.cpp │   ├── mmi_iu_noinit_unittests.cpp -│   └── output_intent_unittests.cpp -└── tidl +│   ├── mmi_iu_unittests.cpp +└── tidl └── mmi.tidl - diff --git a/src/mmimgr/iu/input_intent.cpp b/src/mmimgr/iu/input_intent.cpp deleted file mode 100644 index 5cdf95e..0000000 --- a/src/mmimgr/iu/input_intent.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 -#include - -#include "input_intent.h" - -using namespace std; - -InputIntent::InputIntent() -{ - -} - -InputIntent::~InputIntent() -{ - -} - -void InputIntent::set_modality(string modality) -{ - this->modality = modality; -} - -string InputIntent::get_modality() -{ - return modality; -} - -void InputIntent::set_action(string action) -{ - this->action = action; -} - -string InputIntent::get_action() -{ - return action; -} - -void InputIntent::set_input_time(int time) -{ - input_time = time; -} - -int InputIntent::get_input_time() -{ - return input_time; -} - -void InputIntent::set_input_duration(int duration) -{ - input_duration = duration; -} - -int InputIntent::get_input_duration() -{ - return input_duration; -} - -bool InputIntent::match_intent(const InputIntent &other) -{ - if (this->modality == other.modality && - this->action == other.action) - return true; - - return false; -} diff --git a/src/mmimgr/iu/input_intent.h b/src/mmimgr/iu/input_intent.h deleted file mode 100644 index 0280c37..0000000 --- a/src/mmimgr/iu/input_intent.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -#ifndef __INPUT_INTENT_H__ -#define __INPUT_INTENT_H__ - -#include -#include - -using namespace std; - -class InputIntent { -public: - InputIntent(); - virtual ~InputIntent(); - - void set_modality(string modality); - string get_modality(); - - void set_action(string modality); - string get_action(); - - void set_input_time(int time); - int get_input_time(); - - void set_input_duration(int duration); - int get_input_duration(); - - bool match_intent(const InputIntent &other); - -private: - string modality; - string action; - int input_time = 0; - int input_duration = 0; -}; - -#endif /* __INPUT_INTENT_H__ */ diff --git a/src/mmimgr/iu/iu_rule.cpp b/src/mmimgr/iu/iu_rule.cpp deleted file mode 100644 index 2e5834c..0000000 --- a/src/mmimgr/iu/iu_rule.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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 -#include - -#include "input_intent.h" -#include "iu_rule.h" - -using namespace std; - -IntentUnderstandingRule::IntentUnderstandingRule() -{ - -} - -IntentUnderstandingRule::~IntentUnderstandingRule() -{ - -} - -void IntentUnderstandingRule::set_app_state(const char* state) -{ - if (string(state) == "Initiation") - app_state = MMI_STATE_INITIATION; - else if (string(state) == "Exploration") - app_state = MMI_STATE_EXPLORATION; - else if (string(state) == "Execution") - app_state = MMI_STATE_EXECUTION; - else if (string(state) == "Feedback") - app_state = MMI_STATE_FEEDBACK; - else if (string(state) == "Observation") - app_state = MMI_STATE_OBSERVATION; - else if (string(state) == "Termination") - app_state = MMI_STATE_TERMINATION; -} - -mmi_state IntentUnderstandingRule::get_app_state() -{ - return app_state; -} - -void IntentUnderstandingRule::set_output_intent(const OutputIntent &output_intent) -{ - this->output_intent = output_intent; -} - -OutputIntent IntentUnderstandingRule::get_output_intent() -{ - return this->output_intent; -} - -void IntentUnderstandingRule::add_input_intent(const InputIntent &intent) -{ - input_intent_list.push_back(intent); -} - -bool IntentUnderstandingRule::find_input_intent(InputIntent intent) -{ - for (InputIntent it : input_intent_list) - { - if (it.match_intent(intent)) - { - return true; - } - } - - return false; -} - -unsigned int IntentUnderstandingRule::get_input_intent_size() -{ - return input_intent_list.size(); -} diff --git a/src/mmimgr/iu/iu_rule.h b/src/mmimgr/iu/iu_rule.h deleted file mode 100644 index fde0466..0000000 --- a/src/mmimgr/iu/iu_rule.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ - -#ifndef __IU_RULE__ -#define __IU_RULE__ - -#include -#include -#include - -#include "input_intent.h" -#include "output_intent.h" -#include "mmi-common.h" - -using namespace std; - -class IntentUnderstandingRule { -public: - IntentUnderstandingRule(); - virtual ~IntentUnderstandingRule(); - - void set_app_state(const char* state); - mmi_state get_app_state(); - - void set_output_intent(const OutputIntent &output_intent); - OutputIntent get_output_intent(); - - void add_input_intent(const InputIntent &intent); - bool find_input_intent(InputIntent intent); - unsigned int get_input_intent_size(); - -private: - list input_intent_list; - - OutputIntent output_intent; - - mmi_state app_state = MMI_STATE_NONE; -}; - -#endif /* __IU_RULE__ */ diff --git a/src/mmimgr/iu/mmi_iu.cpp b/src/mmimgr/iu/mmi_iu.cpp index 647c985..9d7336e 100644 --- a/src/mmimgr/iu/mmi_iu.cpp +++ b/src/mmimgr/iu/mmi_iu.cpp @@ -22,8 +22,6 @@ #include "mmi_iu.h" #include "mmi_iu_log.h" -#include "output_intent.h" -#include "input_intent.h" #include "VoiceTouchEngine.h" #include "mmi-common.h" @@ -38,8 +36,6 @@ static void *iu_output_modality_user_data = nullptr; static bool initialized = false; -static string g_system_app_id; -static string g_focus_app_id; static VoiceTouchEngine *g_VoiceTouchEngine = nullptr; @@ -56,9 +52,6 @@ static void init() iu_output_modality_received_callback = nullptr; iu_output_modality_user_data = nullptr; - - g_system_app_id = ""; - g_focus_app_id = ""; } void __mmi_iu_voice_touch_engine_output_result_cb(const char* app_id, const char* output_result, void *user_data) @@ -97,9 +90,7 @@ EXPORT_API int mmi_iu_init() g_VoiceTouchEngine->setOutputModalityCallback(__mmi_iu_voice_touch_engine_output_modality_cb, nullptr); } - int ret = mmi_iu_set_rule_filepath(DEFAULT_RULE_FILE); - - return ret; + return MMI_IU_ERROR_NONE; } EXPORT_API int mmi_iu_shutdown() @@ -117,26 +108,6 @@ EXPORT_API int mmi_iu_shutdown() return MMI_IU_ERROR_NONE; } -EXPORT_API int mmi_iu_set_rule_filepath(const char *filepath) -{ - return MMI_IU_ERROR_NONE; -} - -EXPORT_API int mmi_iu_feed_intent(const char *app_id, const char *json_data) -{ - if (!app_id || !json_data) { - _W("[ERROR] Invalid parameter"); - return MMI_IU_ERROR_INVALID_PARAMETER; - } - - if (!initialized) { - _W("[ERROR] Not initialized"); - return MMI_IU_ERROR_NOT_INITIALIZED; - } - - return MMI_IU_ERROR_NONE; -} - EXPORT_API int mmi_iu_feed_input_modality(const char *app_id, int type, void *event) { if (!app_id || !event) { @@ -231,37 +202,3 @@ EXPORT_API int mmi_iu_set_app_state(mmi_state app_state) return MMI_IU_ERROR_NONE; } - -EXPORT_API int mmi_iu_set_focus_app_id(const char *app_id) -{ - if (!app_id) { - _W("[ERROR] Invalid parameter"); - return MMI_IU_ERROR_INVALID_PARAMETER; - } - - if (!initialized) { - _W("[ERROR] Not initialized"); - return MMI_IU_ERROR_NOT_INITIALIZED; - } - - g_focus_app_id = string(app_id); - - return MMI_IU_ERROR_NONE; -} - -EXPORT_API int mmi_iu_set_system_app_id(const char *system_app_id) -{ - if (!system_app_id) { - _W("[ERROR] Invalid parameter"); - return MMI_IU_ERROR_INVALID_PARAMETER; - } - - if (!initialized) { - _W("[ERROR] Not initialized"); - return MMI_IU_ERROR_NOT_INITIALIZED; - } - - g_system_app_id = string(system_app_id); - - return MMI_IU_ERROR_NONE; -} diff --git a/src/mmimgr/iu/mmi_iu.h b/src/mmimgr/iu/mmi_iu.h index 6ded713..8bbc1ae 100644 --- a/src/mmimgr/iu/mmi_iu.h +++ b/src/mmimgr/iu/mmi_iu.h @@ -65,21 +65,6 @@ int mmi_iu_init(); */ int mmi_iu_shutdown(); -/** - * @brief Set file path of json rule data - * @param[in] filepath file path of json rule data - * - * @return int MMI_IU_ERROR_NONE on success - */ -int mmi_iu_set_rule_filepath(const char *filepath); - -/** - * @brief Feed input intent - * @remark The result can be received by the callback registered by mmi_iu_set_output_result_received_callback(). - * @param[in] app_id The app ID that input event occurred - */ -int mmi_iu_feed_intent(const char *app_id, const char *json_data); - /** * @brief Feed raw input event * @remark The result can be received by the callback registered by mmi_iu_set_output_result_received_callback(). @@ -111,17 +96,6 @@ int mmi_iu_unset_output_modality_received_callback(); */ int mmi_iu_set_app_state(mmi_state app_state); -/** - * @brief Set system application ID - * @param[in] system_app_id system application ID - */ -int mmi_iu_set_system_app_id(const char *system_app_id); - -/** - * @brief Set focus app ID - * @param[in] app_id The focus application ID - */ -int mmi_iu_set_focus_app_id(const char *app_id); /** * @} diff --git a/src/mmimgr/iu/output_intent.cpp b/src/mmimgr/iu/output_intent.cpp deleted file mode 100644 index 17b3e79..0000000 --- a/src/mmimgr/iu/output_intent.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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 -#include - -#include "output_intent.h" -#include "mmi_iu_log.h" - -OutputIntent::OutputIntent() -{ - json_object = json_object_new(); -} - -OutputIntent::~OutputIntent() -{ - json_object = NULL; -} - -string OutputIntent::get_action() -{ - return action; -} - -void OutputIntent::set_action(string action) -{ - json_object_set_string_member(json_object, "Action", action.c_str()); - this->action = action; -} - -void OutputIntent::add_member_value(string key, string value) -{ - json_object_set_string_member(json_object, key.c_str(), value.c_str()); -} - -string OutputIntent::get_output_intent_text() -{ - string json_output_text; - JsonGenerator *j_generator = NULL; - JsonNode *j_node = NULL; - gsize size = 0; - gchar *data = NULL; - - j_generator = json_generator_new(); - if (j_generator == NULL) { - _E("json generator create error"); - goto cleanup; - } - - j_node = json_node_new(JSON_NODE_OBJECT); - if (j_node == NULL) { - _E("json node create error"); - goto cleanup; - } - - json_node_set_object(j_node, json_object); - json_generator_set_root(j_generator, j_node); - - data = json_generator_to_data(j_generator, &size); - if (data == NULL) { - _E("Failed to get json data"); - goto cleanup; - } - - json_output_text = string(data); - -cleanup: - if (data) - g_free(data); - - if (j_node) - json_node_free(j_node); - - if (j_generator) - g_object_unref(j_generator); - - return json_output_text; -} diff --git a/src/mmimgr/iu/output_intent.h b/src/mmimgr/iu/output_intent.h deleted file mode 100644 index 5608662..0000000 --- a/src/mmimgr/iu/output_intent.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ - -#ifndef __OUTPUT_INTENT_H__ -#define __OUTPUT_INTENT_H__ - -#include -#include -#include - -using namespace std; - -class OutputIntent -{ -public: - OutputIntent(); - virtual ~OutputIntent(); - - void add_member_value(string key, string value); - void set_action(string action); - string get_action(); - - string get_output_intent_text(); - -private: - JsonObject *json_object = NULL; - string action; -}; - -#endif /* __OUTPUT_INTENT_H__ */ diff --git a/src/mmimgr/meson.build b/src/mmimgr/meson.build index 05f120d..a5255f2 100644 --- a/src/mmimgr/meson.build +++ b/src/mmimgr/meson.build @@ -15,13 +15,7 @@ mmimgr_srcs = [ 'mmi-manager-dbg.h', 'mmi_stub.h', 'mmi_stub.c', - 'iu/input_intent.cpp', - 'iu/input_intent.h', - 'iu/iu_rule.cpp', - 'iu/iu_rule.h', 'iu/mmi_iu.cpp', - 'iu/output_intent.cpp', - 'iu/output_intent.h', 'iu/CommandFinder.cpp', 'iu/CommandFinder.h', 'iu/ClickableItem.h', diff --git a/tests/iu/iu_rule_unittests.cpp b/tests/iu/iu_rule_unittests.cpp deleted file mode 100644 index de2f7b8..0000000 --- a/tests/iu/iu_rule_unittests.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 -#include - -#include "iu_rule.h" -#include -#include -#include - -using namespace std; - -namespace { - -class IntentUnderstandingRuleTest : public testing::Test { - public: - virtual void SetUp() { - } - virtual void TearDown() { - } - -private: - -}; - -TEST_F(IntentUnderstandingRuleTest, utc_iu_rule_set_app_state) -{ - IntentUnderstandingRule iu_rule; - iu_rule.set_app_state("Initiation"); - EXPECT_EQ(iu_rule.get_app_state(), MMI_STATE_INITIATION); - - iu_rule.set_app_state("Exploration"); - EXPECT_EQ(iu_rule.get_app_state(), MMI_STATE_EXPLORATION); - - iu_rule.set_app_state("Execution"); - EXPECT_EQ(iu_rule.get_app_state(), MMI_STATE_EXECUTION); - - iu_rule.set_app_state("Feedback"); - EXPECT_EQ(iu_rule.get_app_state(), MMI_STATE_FEEDBACK); - - iu_rule.set_app_state("Observation"); - EXPECT_EQ(iu_rule.get_app_state(), MMI_STATE_OBSERVATION); - - iu_rule.set_app_state("Termination"); - EXPECT_EQ(iu_rule.get_app_state(), MMI_STATE_TERMINATION); -} - -} // namespace diff --git a/tests/iu/mmi_iu_feed_input_event_unittests.cpp b/tests/iu/mmi_iu_feed_input_event_unittests.cpp index 286b368..7d0dbbe 100644 --- a/tests/iu/mmi_iu_feed_input_event_unittests.cpp +++ b/tests/iu/mmi_iu_feed_input_event_unittests.cpp @@ -136,9 +136,6 @@ int feed_input_event_test(mmi_state app_state, int type, void *event) 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_input_modality(TEST_APP_ID, type, event); return ret; } @@ -451,9 +448,6 @@ TEST_F(IUClientFeedInputEventTest, utc_mmi_iu_feed_input_event_gesture_push_diff ret = mmi_iu_set_app_state(MMI_STATE_TERMINATION); EXPECT_EQ(ret, MMI_IU_ERROR_NONE); - ret = mmi_iu_set_focus_app_id(SYSTEM_APP_ID); - EXPECT_EQ(ret, MMI_IU_ERROR_NONE); - mmi_provider_event_gesture ge = { 0, }; ge.type = MMI_EVENT_GESTURE_TYPE_PUSH; diff --git a/tests/iu/mmi_iu_feed_intent_unittests.cpp b/tests/iu/mmi_iu_feed_intent_unittests.cpp deleted file mode 100644 index b9105f5..0000000 --- a/tests/iu/mmi_iu_feed_intent_unittests.cpp +++ /dev/null @@ -1,700 +0,0 @@ -/* - * 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 -#include - -#include "mmi_iu.h" -#include "mmi_iu_log.h" -#include "mmi-common.h" - -#include -#include -#include - -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, int type, 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_result_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_result_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 diff --git a/tests/iu/mmi_iu_noinit_unittests.cpp b/tests/iu/mmi_iu_noinit_unittests.cpp index a153cfe..6687b6c 100644 --- a/tests/iu/mmi_iu_noinit_unittests.cpp +++ b/tests/iu/mmi_iu_noinit_unittests.cpp @@ -49,34 +49,11 @@ class IUClientNoInitTest : public testing::Test { private: }; -TEST_F(IUClientNoInitTest, utc_mmi_iu_feed_intent_n) -{ - int ret = mmi_iu_feed_intent(TEST_APP_ID, NULL); - EXPECT_EQ(ret, MMI_IU_ERROR_INVALID_PARAMETER); -} - static void output_intent_received_cb(const char *app_id, int type, const char *json_data, void *user_data) { } -TEST_F(IUClientNoInitTest, utc_mmi_iu_feed_intent_no_init) -{ - std::string input_intent_json_data = - R"({ - "InputIntents" : [ - { - "Modality" : "KeyInput", - "Action" : "PressMicButton" - } - ] - } - )"; - - int ret = mmi_iu_feed_intent(TEST_APP_ID, input_intent_json_data.c_str()); - EXPECT_EQ(ret, MMI_IU_ERROR_NOT_INITIALIZED); -} - TEST_F(IUClientNoInitTest, utc_mmi_iu_feed_input_event_no_init) { mmi_provider_event_key key_event; @@ -99,18 +76,6 @@ TEST_F(IUClientNoInitTest, utc_mmi_iu_set_app_state_no_init) EXPECT_EQ(ret, MMI_IU_ERROR_NOT_INITIALIZED); } -TEST_F(IUClientNoInitTest, utc_mmi_iu_set_focus_app_id_no_init) -{ - int ret = mmi_iu_set_focus_app_id(TEST_APP_ID); - EXPECT_EQ(ret, MMI_IU_ERROR_NOT_INITIALIZED); -} - -TEST_F(IUClientNoInitTest, utc_mmi_iu_set_system_app_id_no_init) -{ - int ret = mmi_iu_set_system_app_id(SYSTEM_APP_ID); - EXPECT_EQ(ret, MMI_IU_ERROR_NOT_INITIALIZED); -} - TEST_F(IUClientNoInitTest, utc_mmi_iu_unset_output_intent_received_callback_no_init) { int ret = mmi_iu_unset_output_result_received_callback(); diff --git a/tests/iu/mmi_iu_unittests.cpp b/tests/iu/mmi_iu_unittests.cpp index c2f310e..57a4645 100644 --- a/tests/iu/mmi_iu_unittests.cpp +++ b/tests/iu/mmi_iu_unittests.cpp @@ -86,17 +86,6 @@ TEST_F(IUClientTest, utc_mmi_mmi_iu_shutdown_p) EXPECT_EQ(ret, MMI_IU_ERROR_NONE); } -/** - * @function utc_mmi_iu_feed_intent_n - * @description Negative UTC of the feed_intent function - * @parameter NA - */ -TEST_F(IUClientTest, utc_mmi_iu_feed_intent_n) -{ - int ret = mmi_iu_feed_intent(TEST_APP_ID, NULL); - EXPECT_EQ(ret, MMI_IU_ERROR_INVALID_PARAMETER); -} - TEST_F(IUClientTest, utc_mmi_iu_set_output_intent_received_callback_n_callback_null) { int ret = mmi_iu_set_output_result_received_callback(NULL, NULL); @@ -115,30 +104,6 @@ TEST_F(IUClientTest, utc_mmi_iu_set_app_state_p) EXPECT_EQ(ret, MMI_IU_ERROR_NONE); } -TEST_F(IUClientTest, utc_mmi_iu_set_focus_app_id_p) -{ - int ret = mmi_iu_set_focus_app_id(TEST_APP_ID); - EXPECT_EQ(ret, MMI_IU_ERROR_NONE); -} - -TEST_F(IUClientTest, utc_mmi_iu_set_focus_app_id_n) -{ - int ret = mmi_iu_set_focus_app_id(NULL); - EXPECT_EQ(ret, MMI_IU_ERROR_INVALID_PARAMETER); -} - -TEST_F(IUClientTest, utc_mmi_iu_set_system_app_id_p) -{ - int ret = mmi_iu_set_system_app_id(SYSTEM_APP_ID); - EXPECT_EQ(ret, MMI_IU_ERROR_NONE); -} - -TEST_F(IUClientTest, utc_mmi_iu_set_system_app_id_n) -{ - int ret = mmi_iu_set_system_app_id(NULL); - EXPECT_EQ(ret, MMI_IU_ERROR_INVALID_PARAMETER); -} - TEST_F(IUClientTest, utc_mmi_iu_unset_output_intent_received_callback_p) { int ret = mmi_iu_unset_output_result_received_callback(); diff --git a/tests/iu/output_intent_unittests.cpp b/tests/iu/output_intent_unittests.cpp deleted file mode 100644 index dc50173..0000000 --- a/tests/iu/output_intent_unittests.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 -#include - -#include "mmi_iu.h" -#include "output_intent.h" -#include -#include -#include - -using namespace std; - -namespace { - -class OutputIntentTest : public testing::Test { - public: - virtual void SetUp() { - } - virtual void TearDown() { - } - -private: - -}; - -TEST_F(OutputIntentTest, utc_output_intent_p) -{ - OutputIntent oi; - oi.set_action("WakeUp"); - - EXPECT_STREQ(oi.get_output_intent_text().c_str(), - R"({"Action":"WakeUp"})"); -} - -TEST_F(OutputIntentTest, utc_output_intent_p2) -{ - OutputIntent oi; - oi.add_member_value("Action", "WakeUp"); - oi.add_member_value("Time", "Now"); - - EXPECT_STREQ(oi.get_output_intent_text().c_str(), - R"({"Action":"WakeUp","Time":"Now"})"); -} - -} // namespace diff --git a/tests/meson.build b/tests/meson.build index da0f5fe..0dd9c57 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -4,11 +4,9 @@ mmi_manager_tests_srcs = [ 'mmi-client-tests.cpp', 'mmi-manager-main-tests.cpp', 'ecore-event-dispatcher.cpp', - 'iu/iu_rule_unittests.cpp', 'iu/mmi_iu_feed_input_event_unittests.cpp', 'iu/mmi_iu_noinit_unittests.cpp', 'iu/mmi_iu_unittests.cpp', - 'iu/output_intent_unittests.cpp', 'iu/CommandFinder_unittests.cpp', 'iu/CommandManager_unittests.cpp' ]