--- /dev/null
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <Ecore.h>
+#include <system_info.h>
+
+#include <voice_control_elm.h>
+#include "system_info_mock.h"
+#include "cynara_mock.h"
+
+static int g_vc_elm_init = false;
+static bool g_vc_elm_supported = false;
+
+namespace {
+
+class VCElmTest : public testing::Test {
+ public:
+ virtual void SetUp() {
+ ecore_init();
+
+ cynara_check_set_result(CYNARA_API_ACCESS_ALLOWED);
+
+ int ret = VC_ELM_ERROR_NONE;
+ int i;
+
+ bool mic_supported = false;
+ bool vc_supported = false;
+ g_vc_elm_supported = false;
+ if (0 == system_info_get_platform_bool("http://tizen.org/feature/speech.control", &vc_supported)) {
+ if (0 == system_info_get_platform_bool("http://tizen.org/feature/microphone", &mic_supported)) {
+ if (true == vc_supported && true == mic_supported) {
+ g_vc_elm_supported = true;
+ }
+ }
+ }
+
+ g_vc_elm_init = false;
+ elm_init(0,NULL);
+ ret = vc_elm_initialize();
+ for (i = 0; i < 20; i++)
+ ecore_main_loop_iterate();
+
+ if (VC_ELM_ERROR_NONE == ret) {
+ g_vc_elm_init = true;
+ } else {
+ g_vc_elm_init = false;
+ }
+ }
+
+ virtual void TearDown() {
+ int i;
+ for (i = 0; i < 30; i++)
+ ecore_main_loop_iterate();
+
+ vc_elm_deinitialize();
+ elm_shutdown();
+
+ g_vc_elm_init = false;
+
+ ecore_shutdown();
+ }
+};
+
+static bool _vc_elm_supported_language_cb(const char *language, void *user_data)
+{
+ (void)language;
+ (void)user_data;
+ return true;
+}
+
+static bool _vc_elm_widget_cb(const char *widget, void *user_data)
+{
+ (void)widget;
+ (void)user_data;
+ return false;
+}
+
+static bool _vc_elm_action_cb(const char *action, void *user_data)
+{
+ (void)action;
+ (void)user_data;
+ return false;
+}
+
+static void _vc_elm_current_language_changed_cb(const char *previous, const char *current, void *user_data)
+{
+ (void)previous;
+ (void)current;
+ (void)user_data;
+}
+
+/**
+ * @testcase utc_vc_elm_initialize_p
+ * @since_tizen 2.4
+ * @description test whether vc-elm is initialized properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_initialize_p)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_initialize_n
+ * @since_tizen 2.4
+ * @description test whether function returns error when vc-elm is already initialized.
+ */
+TEST_F(VCElmTest, utc_vc_elm_initialize_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_initialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_STATE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_deinitialize_p
+ * @since_tizen 2.4
+ * @description test whether vc-elm is deinitialized properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_deinitialize_p)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_deinitialize_n
+ * @since_tizen 2.4
+ * @description test whether function returns error when vc-elm is already deinitialized.
+ */
+TEST_F(VCElmTest, utc_vc_elm_deinitialize_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_STATE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_foreach_supported_languages_p
+ * @since_tizen 2.4
+ * @description test whether it is to get each supported languages properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_foreach_supported_languages_p)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_languages(_vc_elm_supported_language_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_languages(_vc_elm_supported_language_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_foreach_supported_languages_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as callback function pointer.
+ */
+TEST_F(VCElmTest, utc_vc_elm_foreach_supported_languages_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_languages(NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_languages(NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_foreach_supported_languages_n2
+ * @since_tizen 2.4
+ * @description test whether function returns error when vc-elm is not initialized.
+ */
+TEST_F(VCElmTest, utc_vc_elm_foreach_supported_languages_n2)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_languages(_vc_elm_supported_language_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_foreach_supported_languages(_vc_elm_supported_language_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_STATE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_current_language_p
+ * @since_tizen 2.4
+ * @description test whether it is to get current language properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_current_language_p)
+{
+ char *current_language = NULL;
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_current_language(¤t_language);
+ if (NULL != current_language) {
+ free(current_language);
+ current_language = NULL;
+ }
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_current_language(¤t_language);
+ if (NULL != current_language) {
+ free(current_language);
+ current_language = NULL;
+ }
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_voice_control_elm_vc_elm_get_current_language_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_current_language_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_current_language(NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_current_language(NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_voice_control_elm_vc_elm_get_current_language_n2
+ * @since_tizen 2.4
+ * @description test whether function returns error when vc-elm is already deinitialized.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_current_language_n2)
+{
+ char *current_language = NULL;
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_current_language(¤t_language);
+ if (NULL != current_language) {
+ free(current_language);
+ current_language = NULL;
+ }
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_get_current_language(¤t_language);
+ if (NULL != current_language) {
+ free(current_language);
+ current_language = NULL;
+ }
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_STATE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_foreach_supported_widgets_p
+ * @since_tizen 2.4
+ * @description test whether it is to get each supported widgets properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_foreach_supported_widgets_p)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_languages(_vc_elm_widget_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_languages(_vc_elm_widget_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_foreach_supported_widgets_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as callback function pointer.
+ */
+TEST_F(VCElmTest, utc_vc_elm_foreach_supported_widgets_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_languages(NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_languages(NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_foreach_supported_widgets_n2
+ * @since_tizen 2.4
+ * @description test whether function returns error when vc-elm is not initialized.
+ */
+TEST_F(VCElmTest, utc_vc_elm_foreach_supported_widgets_n2)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_languages(_vc_elm_widget_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_foreach_supported_languages(_vc_elm_widget_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_STATE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_foreach_supported_actions_p
+ * @since_tizen 2.4
+ * @description test whether it is to get each supported actions properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_foreach_supported_actions_p)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_actions("Elm_List", _vc_elm_action_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_actions("Elm_List", _vc_elm_action_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_foreach_supported_actions_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as callback function pointer.
+ */
+TEST_F(VCElmTest, utc_vc_elm_foreach_supported_actions_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_actions("Elm_List", NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_actions("Elm_List", NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_foreach_supported_actions_n2
+ * @since_tizen 2.4
+ * @description test whether function returns error when vc-elm is not initialized.
+ */
+TEST_F(VCElmTest, utc_vc_elm_foreach_supported_actions_n2)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_actions("Elm_List", _vc_elm_action_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_foreach_supported_actions("Elm_List", _vc_elm_action_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_STATE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_foreach_supported_actions_n3
+ * @since_tizen 2.4
+ * @description test whether function returns error when widget is not supported.
+ */
+TEST_F(VCElmTest, utc_vc_elm_foreach_supported_actions_n3)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_actions("Elm_None", _vc_elm_action_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_foreach_supported_actions("Elm_None", _vc_elm_action_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_OPERATION_FAILED);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_action_command_p
+ * @since_tizen 2.4
+ * @description test whether it is to get action command properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_action_command_p)
+{
+ char *command = NULL;
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_action_command("scroll_up", &command);
+ if (NULL != command) {
+ free(command);
+ command = NULL;
+ }
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_action_command("scroll_up", &command);
+ if (NULL != command) {
+ free(command);
+ command = NULL;
+ }
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_action_command_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as action and command parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_action_command_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_action_command(NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_action_command(NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_action_command_n2
+ * @since_tizen 2.4
+ * @description test whether function returns error when vc-elm is not initialized.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_action_command_n2)
+{
+ char *command = NULL;
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_action_command("scroll_up", &command);
+ if (NULL != command) {
+ free(command);
+ command = NULL;
+ }
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_get_action_command("scroll_up", &command);
+ if (NULL != command) {
+ free(command);
+ command = NULL;
+ }
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_STATE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_action_command_n3
+ * @since_tizen 2.4
+ * @description test whether function returns error when action is not supported.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_action_command_n3)
+{
+ char *command = NULL;
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_action_command("no_command", &command);
+ if (NULL != command) {
+ free(command);
+ command = NULL;
+ }
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_action_command("no_command", &command);
+ if (NULL != command) {
+ free(command);
+ command = NULL;
+ }
+ EXPECT_EQ(ret, VC_ELM_ERROR_OPERATION_FAILED);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_p
+ * @since_tizen 2.4
+ * @description test whether it is to create handle for button object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_p)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_p2
+ * @since_tizen 2.4
+ * @description test whether it is to create handle for checkbox object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_p2)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_check_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_p3
+ * @since_tizen 2.4
+ * @description test whether it is to create handle for radio button object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_p3)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_radio_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_p4
+ * @since_tizen 2.4
+ * @description test whether it is to create handle for slider object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_p4)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_slider_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_p5
+ * @since_tizen 2.4
+ * @description test whether it is to create handle for spinner object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_p5)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_spinner_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_p6
+ * @since_tizen 2.4
+ * @description test whether it is to create handle for entry object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_p6)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_entry_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_p7
+ * @since_tizen 2.4
+ * @description test whether it is to create handle for scroller object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_p7)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_scroller_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_p8
+ * @since_tizen 2.4
+ * @description test whether it is to create handle for label object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_p8)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_label_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_p9
+ * @since_tizen 2.4
+ * @description test whether it is to create handle for genlist object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_p9)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_genlist_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_p10
+ * @since_tizen 2.4
+ * @description test whether it is to create handle for gengrid object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_p10)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_gengrid_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as handler parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_n)
+{
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_n2
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as object parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_n2)
+{
+ vc_elm_h handler = NULL;
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(NULL, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(NULL, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_object_n3
+ * @since_tizen 2.4
+ * @description test whether function returns error when vc-elm is not initialized.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_object_n3)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_STATE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_item_p
+ * @since_tizen 2.4
+ * @description test whether it is to create handle for item object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_item_p)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_item_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as handler parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_item_n)
+{
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_item_n2
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as item object parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_item_n2)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(NULL, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(NULL, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_create_item_n3
+ * @since_tizen 2.4
+ * @description test whether function returns error when vc-elm is not initialized.
+ */
+TEST_F(VCElmTest, utc_vc_elm_create_item_n3)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(it, nullptr);
+
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_STATE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_destroy_p
+ * @since_tizen 2.4
+ * @description test whether it is to destroy handle for object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_destroy_p)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_destroy_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as handler parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_destroy_n)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_destroy(NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_destroy_n2
+ * @since_tizen 2.4
+ * @description test whether function returns error when try to destroy handle that is not created.
+ */
+ TEST_F(VCElmTest, utc_vc_elm_destroy_n2)
+{
+ vc_elm_h handler = NULL;
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_p
+ * @since_tizen 2.4
+ * @description test whether it is to set command on object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_p)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_p2
+ * @since_tizen 2.4
+ * @description test whether it is to set command on item object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_p2)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as handler parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command(NULL, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command(NULL, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_unset_command_p
+ * @since_tizen 2.4
+ * @description test whether it is to unset command on object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_unset_command_p)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_command(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_unset_command(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_unset_command_p2
+ * @since_tizen 2.4
+ * @description test whether it is to unset command on item object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_unset_command_p2)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_command(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_unset_command(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_unset_command_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as handler parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_unset_command_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_command(NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_command(NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_hint_p
+ * @since_tizen 2.4
+ * @description test whether it is to set command hint on object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_hint_p)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_hint_p2
+ * @since_tizen 2.4
+ * @description test whether it is to set command hint on item object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_hint_p2)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_hint_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as handler parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_hint_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint(NULL, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint(NULL, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_unset_command_hint_p
+ * @since_tizen 2.4
+ * @description test whether it is to unset command hint on object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_unset_command_hint_p)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_command_hint(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_unset_command_hint(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_unset_command_hint_p2
+ * @since_tizen 2.4
+ * @description test whether it is to unset command hint on item object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_unset_command_hint_p2)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_command_hint(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_unset_command_hint(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_unset_command_hint_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as handler parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_unset_command_hint_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_command_hint(NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_command_hint(NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_hint_direction_p
+ * @since_tizen 2.4
+ * @description test whether it is to set command hint direction on object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_hint_direction_p)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint_direction(handler, VC_ELM_DIRECTION_TOP);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint_direction(handler, VC_ELM_DIRECTION_TOP);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_hint_direction_p2
+ * @since_tizen 2.4
+ * @description test whether it is to set command hint direction on item object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_hint_direction_p2)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint_direction(handler, VC_ELM_DIRECTION_TOP);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint_direction(handler, VC_ELM_DIRECTION_TOP);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_hint_direction_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as handler parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_hint_direction_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint_direction(NULL, VC_ELM_DIRECTION_TOP);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint_direction(NULL, VC_ELM_DIRECTION_TOP);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_command_hint_direction_p
+ * @since_tizen 2.4
+ * @description test whether it is to get command hint direction on object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_command_hint_direction_p)
+{
+ vc_elm_h handler = NULL;
+ vc_elm_direction_e direction;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_command_hint_direction(handler, &direction);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint_direction(handler, VC_ELM_DIRECTION_TOP);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_get_command_hint_direction(handler, &direction);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_EQ(direction, VC_ELM_DIRECTION_TOP);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_command_hint_direction_p2
+ * @since_tizen 2.4
+ * @description test whether it is to get command hint direction on item object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_command_hint_direction_p2)
+{
+ vc_elm_h handler = NULL;
+ vc_elm_direction_e direction;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_command_hint_direction(handler, &direction);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint_direction(handler, VC_ELM_DIRECTION_TOP);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_get_command_hint_direction(handler, &direction);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_EQ(direction, VC_ELM_DIRECTION_TOP);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_command_hint_direction_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as handler parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_command_hint_direction_n)
+{
+ vc_elm_direction_e direction;
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_command_hint_direction(NULL, &direction);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_command_hint_direction(NULL, &direction);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_hint_offset_p
+ * @since_tizen 2.4
+ * @description test whether it is to set command hint offset on object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_hint_offset_p)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint_offset(handler, 100, 100);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint_offset(handler, 100, 100);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_hint_offset_p2
+ * @since_tizen 2.4
+ * @description test whether it is to set command hint offset on item object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_hint_offset_p2)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint_offset(handler, 100, 100);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint_offset(handler, 100, 100);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_command_hint_offset_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as handler parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_command_hint_offset_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint_offset(NULL, 100, 100);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_command_hint_offset(NULL, 100, 100);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_command_hint_offset_p
+ * @since_tizen 2.4
+ * @description test whether it is to get command hint offset on object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_command_hint_offset_p)
+{
+ int x, y;
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_command_hint_offset(handler, &x, &y);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint_offset(handler, 100, 100);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_get_command_hint_offset(handler, &x, &y);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_EQ(x, 100);
+ EXPECT_EQ(y, 100);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_command_hint_offset_p2
+ * @since_tizen 2.4
+ * @description test whether it is to get command hint offset on item object properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_command_hint_offset_p2)
+{
+ int x, y;
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* glist = elm_list_add(win);
+ Elm_Object_Item *it = elm_list_item_append(glist, "test", NULL, NULL, NULL, NULL);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_command_hint_offset(handler, &x, &y);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+ EXPECT_NE(it, nullptr);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_item(it, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_set_command(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint(handler, "TEST");
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_command_hint_offset(handler, 100, 100);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_get_command_hint_offset(handler, &x, &y);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_EQ(x, 100);
+ EXPECT_EQ(y, 100);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_command_hint_offset_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as handler parameter.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_command_hint_offset_n)
+{
+ int x, y;
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_command_hint_offset(NULL, &x, &y);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_command_hint_offset(NULL, &x, &y);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_get_command_hint_offset_n2
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as position x and y.
+ */
+TEST_F(VCElmTest, utc_vc_elm_get_command_hint_offset_n2)
+{
+ vc_elm_h handler = NULL;
+ Evas_Object* win = elm_win_add(NULL, "test", ELM_WIN_BASIC);
+ Evas_Object* object = elm_button_add(win);
+
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_get_command_hint_offset(handler, NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_create_object(object, &handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ EXPECT_NE(handler, nullptr);
+
+ ret = vc_elm_get_command_hint_offset(handler, NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_PARAMETER);
+
+ ret = vc_elm_destroy(handler);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_current_language_changed_cb_p
+ * @since_tizen 2.4
+ * @description test whether it is to set current_language_changed callback function properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_current_language_changed_cb_p)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_current_language_changed_cb(_vc_elm_current_language_changed_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_current_language_changed_cb(_vc_elm_current_language_changed_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_current_language_changed_cb_n
+ * @since_tizen 2.4
+ * @description test whether function returns error with NULL as callback pointer.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_current_language_changed_cb_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_current_language_changed_cb(NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_current_language_changed_cb(NULL, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_OPERATION_FAILED);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_set_current_language_changed_cb_n2
+ * @since_tizen 2.4
+ * @description test whether function returns error when vc-elm is not initialized.
+ */
+TEST_F(VCElmTest, utc_vc_elm_set_current_language_changed_cb_n2)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_current_language_changed_cb(_vc_elm_current_language_changed_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_set_current_language_changed_cb(_vc_elm_current_language_changed_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_STATE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_unset_current_language_changed_cb_p
+ * @since_tizen 2.4
+ * @description test whether it is to unset current_language_changed callback function properly.
+ */
+TEST_F(VCElmTest, utc_vc_elm_unset_current_language_changed_cb_p)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_current_language_changed_cb();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_set_current_language_changed_cb(_vc_elm_current_language_changed_cb, NULL);
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_unset_current_language_changed_cb();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_unset_current_language_changed_cb_n
+ * @since_tizen 2.4
+ * @description test whether function returns error when current_language_changed callback is not set.
+ */
+TEST_F(VCElmTest, utc_vc_elm_unset_current_language_changed_cb_n)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_current_language_changed_cb();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_current_language_changed_cb();
+ EXPECT_NE(ret, VC_ELM_ERROR_NONE);
+ }
+}
+
+/**
+ * @testcase utc_vc_elm_unset_current_language_changed_cb_n2
+ * @since_tizen 2.4
+ * @description test whether function returns error when vc-elm is not initialized.
+ */
+TEST_F(VCElmTest, utc_vc_elm_unset_current_language_changed_cb_n2)
+{
+ if (false == g_vc_elm_supported) {
+ EXPECT_EQ(g_vc_elm_init, false);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_unset_current_language_changed_cb();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NOT_SUPPORTED);
+ } else {
+ EXPECT_EQ(g_vc_elm_init, true);
+
+ int ret = VC_ELM_ERROR_NONE;
+ ret = vc_elm_deinitialize();
+ EXPECT_EQ(ret, VC_ELM_ERROR_NONE);
+
+ ret = vc_elm_unset_current_language_changed_cb();
+ EXPECT_EQ(ret, VC_ELM_ERROR_INVALID_STATE);
+ }
+}
+
+} // namespace