[UT] ewk_popup_menu_item ... tests
authorKrzysztof Czech <k.czech@samsung.com>
Wed, 27 Mar 2013 15:18:37 +0000 (16:18 +0100)
committerKrzysztof Czech <k.czech@samsung.com>
Tue, 9 Apr 2013 07:18:25 +0000 (09:18 +0200)
- utc_webkit2_ewk_popup_menu_item_accessibility_text_get_func.c
- utc_webkit2_ewk_popup_menu_item_enabled_get_func.c
- utc_webkit2_ewk_popup_menu_item_is_label_get_func.c
- utc_webkit2_ewk_popup_menu_item_text_direction_get_func.c
- utc_webkit2_ewk_popup_menu_item_text_direction_override_get_func.c
- utc_webkit2_ewk_popup_menu_item_text_get_func.c
- utc_webkit2_ewk_popup_menu_item_tooltip_get_func.c
- utc_webkit2_ewk_popup_menu_item_type_get_func.c

Change-Id: Idfa66d8a8b2c95b6af58221eda9cbdfc5b2ffaad

TC/unit_test/webkit2/Makefile
TC/unit_test/webkit2/tslist
TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_accessibility_text_get_func.c [new file with mode: 0644]
TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_enabled_get_func.c [new file with mode: 0644]
TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_is_label_get_func.c [new file with mode: 0644]
TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_direction_get_func.c [new file with mode: 0644]
TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_direction_override_get_func.c [new file with mode: 0644]
TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_get_func.c [new file with mode: 0644]
TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_tooltip_get_func.c [new file with mode: 0644]
TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_type_get_func.c [new file with mode: 0644]

index 85dad7d..6a76922 100644 (file)
@@ -112,6 +112,14 @@ TARGETS = \
           utc_webkit2_ewk_policy_decision_type_get_func \
           utc_webkit2_ewk_policy_decision_url_get_func \
           utc_webkit2_ewk_policy_decision_use_func \
+          utc_webkit2_ewk_popup_menu_item_accessibility_text_get_func \
+          utc_webkit2_ewk_popup_menu_item_enabled_get_func \
+          utc_webkit2_ewk_popup_menu_item_is_label_get_func \
+          utc_webkit2_ewk_popup_menu_item_text_direction_get_func \
+          utc_webkit2_ewk_popup_menu_item_text_direction_override_get_func \
+          utc_webkit2_ewk_popup_menu_item_text_get_func \
+          utc_webkit2_ewk_popup_menu_item_tooltip_get_func \
+          utc_webkit2_ewk_popup_menu_item_type_get_func \
           utc_webkit2_ewk_settings_auto_fitting_get_func \
           utc_webkit2_ewk_settings_auto_fitting_set_func \
           utc_webkit2_ewk_settings_auto_load_images_get_func \
index 1cc8b8d..25dda5d 100644 (file)
 /unit_test/webkit2/utc_webkit2_ewk_policy_decision_type_get_func
 /unit_test/webkit2/utc_webkit2_ewk_policy_decision_url_get_func
 /unit_test/webkit2/utc_webkit2_ewk_policy_decision_use_func
+/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_accessibility_text_get_func
+/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_enabled_get_func
+/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_is_label_get_func
+/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_direction_get_func
+/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_direction_override_get_func
+/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_get_func
+/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_tooltip_get_func
+/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_type_get_func
 /unit_test/webkit2/utc_webkit2_ewk_settings_auto_fitting_get_func
 /unit_test/webkit2/utc_webkit2_ewk_settings_auto_fitting_set_func
 /unit_test/webkit2/utc_webkit2_ewk_settings_auto_load_images_get_func
diff --git a/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_accessibility_text_get_func.c b/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_accessibility_text_get_func.c
new file mode 100644 (file)
index 0000000..823103f
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * WebKit2 EFL
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/**
+ * @file utc_webkit2_ewk_popup_menu_item_accessibility_text_get.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-27
+ * @brief Tests EWK function ewk_popup_menu_item_accessibility_text_get()
+ */
+
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Elementary.h>
+#include <tet_api.h>
+
+#define TESTED_FUN_NAME "ewk_popup_menu_item_accessibility_text_get"
+#define POS_STRING_FAIL "failed in positive test case"
+#define NEG_STRING_FAIL "failed in negative test case"
+
+static Evas_Object* webview;
+static Evas_Object* window;
+static Evas_Smart* evasSmartClass;
+static Ewk_View_Smart_Class ewkViewSmartClass;
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_webkit2_ewk_popup_menu_item_accessibility_text_get_positive(void);
+static void utc_webkit2_ewk_popup_menu_item_accessibility_text_get_negative(void);
+
+enum {
+    POSITIVE_TC_IDX = 1,
+    NEGATIVE_TC_IDX
+};
+
+struct tet_testlist tet_testlist[] = {
+    {utc_webkit2_ewk_popup_menu_item_accessibility_text_get_positive, POSITIVE_TC_IDX},
+    {utc_webkit2_ewk_popup_menu_item_accessibility_text_get_negative, NEGATIVE_TC_IDX},
+    {NULL, 0}
+};
+
+static Ewk_View_Smart_Class smartClass()
+{
+    static Ewk_View_Smart_Class smart = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("tcwebkit2");
+    return smart;
+}
+
+static void onLoadFinished(void* data, Evas_Object* obj, void* eventInfo)
+{
+    tet_infoline("====== onLoadFinished ======\n");
+    ecore_main_loop_quit();
+}
+
+static void startup(void)
+{
+    tet_infoline("====== startup ======\n");
+
+    g_type_init();
+    elm_init(0, NULL);
+
+    elm_config_preferred_engine_set("opengl_x11");
+
+    window = elm_win_add(NULL, "TC Launcher", ELM_WIN_BASIC);
+    elm_win_title_set(window, "TC Launcher");
+    evas_object_show(window);
+
+    Evas *evas = evas_object_evas_get(window);
+
+    ewkViewSmartClass = smartClass();
+    ewk_view_smart_class_set(&ewkViewSmartClass);
+    evasSmartClass = evas_smart_class_new(&ewkViewSmartClass.sc);
+    Ewk_Context *context = ewk_context_default_get();
+    webview = ewk_view_smart_add(evas, evasSmartClass, context);
+
+    evas_object_resize(webview, 800, 600);
+    evas_object_show(webview);
+
+    evas_object_smart_callback_add(webview, "load,finished", onLoadFinished, 0);
+}
+
+static void cleanup(void)
+{
+    evas_object_smart_callback_del(webview, "load,finished", onLoadFinished);
+    evas_smart_free(evasSmartClass);
+    evas_object_del(webview);
+}
+
+static void mouseClick(int x, int y)
+{
+    Evas *evas = evas_object_evas_get(window);
+    evas_event_feed_mouse_move(evas, x, y, 0, 0);
+    evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+    evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+}
+
+static Eina_Bool onTimeout(void* data)
+{
+    ecore_main_loop_quit();
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool popupMenuShow(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selected_index)
+{
+    tet_infoline("====== popup_menu_show ======\n");
+    Ewk_Popup_Menu_Item *item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 0));
+
+    dts_check_str_eq(TESTED_FUN_NAME, ewk_popup_menu_item_accessibility_text_get(item), "aria", POS_STRING_FAIL);
+
+    return EINA_TRUE;
+}
+
+/**
+* @brief Checking whether function properly returns accessibility text.
+*/
+static void utc_webkit2_ewk_popup_menu_item_accessibility_text_get_positive(void)
+{
+    static const char selectHTML[] =
+        "<body>"
+        "<select>"
+        "<option title=\"tooltip\" aria-label=\"aria\">one</option>"
+        "<option disabled>two</option>"
+        "</select>"
+        "</body>";
+
+    ewkViewSmartClass.popup_menu_show = popupMenuShow;
+    ewk_view_html_string_load(webview, selectHTML, 0, 0);
+    ecore_main_loop_begin();
+
+    static const unsigned x = 46;
+    static const unsigned y = 19;
+    mouseClick(x, y);
+
+    static const double timeout = 2;
+    Ecore_Timer *timer = ecore_timer_add(timeout, onTimeout, 0);
+    ecore_main_loop_begin();
+}
+
+/**
+* @brief Checking whether function works properly in case null of a popup element.
+*/
+static void utc_webkit2_ewk_popup_menu_item_accessibility_text_get_negative(void)
+{
+    dts_check_eq(TESTED_FUN_NAME, ewk_popup_menu_item_accessibility_text_get(0), 0, NEG_STRING_FAIL);
+}
+
diff --git a/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_enabled_get_func.c b/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_enabled_get_func.c
new file mode 100644 (file)
index 0000000..4628ed3
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * WebKit2 EFL
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/**
+ * @file utc_webkit2_ewk_popup_menu_item_enabled_get_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-27
+ * @brief Tests EWK function ewk_popup_menu_item_enabled_get()
+ */
+
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Elementary.h>
+#include <tet_api.h>
+
+#define TESTED_FUN_NAME "ewk_popup_menu_item_enabled_get"
+#define POS_STRING_FAIL "failed in positive test case"
+#define NEG_STRING_FAIL "failed in negative test case"
+
+static Evas_Object* webview;
+static Evas_Object* window;
+static Evas_Smart* evasSmartClass;
+static Ewk_View_Smart_Class ewkViewSmartClass;
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_webkit2_ewk_popup_menu_item_enabled_get_positive(void);
+static void utc_webkit2_ewk_popup_menu_item_enabled_get_negative(void);
+
+enum {
+    POSITIVE_TC_IDX = 1,
+    NEGATIVE_TC_IDX
+};
+
+struct tet_testlist tet_testlist[] = {
+    {utc_webkit2_ewk_popup_menu_item_enabled_get_positive, POSITIVE_TC_IDX},
+    {utc_webkit2_ewk_popup_menu_item_enabled_get_negative, NEGATIVE_TC_IDX},
+    {NULL, 0}
+};
+
+static Ewk_View_Smart_Class smartClass()
+{
+    static Ewk_View_Smart_Class smart = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("tcwebkit2");
+    return smart;
+}
+
+static void onLoadFinished(void* data, Evas_Object* obj, void* eventInfo)
+{
+    tet_infoline("====== onLoadFinished ======\n");
+    ecore_main_loop_quit();
+}
+
+static void startup(void)
+{
+    tet_infoline("====== startup ======\n");
+
+    g_type_init();
+    elm_init(0, NULL);
+
+    elm_config_preferred_engine_set("opengl_x11");
+
+    window = elm_win_add(NULL, "TC Launcher", ELM_WIN_BASIC);
+    elm_win_title_set(window, "TC Launcher");
+    evas_object_show(window);
+
+    Evas *evas = evas_object_evas_get(window);
+
+    ewkViewSmartClass = smartClass();
+    ewk_view_smart_class_set(&ewkViewSmartClass);
+    evasSmartClass = evas_smart_class_new(&ewkViewSmartClass.sc);
+    Ewk_Context *context = ewk_context_default_get();
+    webview = ewk_view_smart_add(evas, evasSmartClass, context);
+
+    evas_object_resize(webview, 800, 600);
+    evas_object_show(webview);
+
+    evas_object_smart_callback_add(webview, "load,finished", onLoadFinished, 0);
+}
+
+static void cleanup(void)
+{
+    evas_object_smart_callback_del(webview, "load,finished", onLoadFinished);
+    evas_smart_free(evasSmartClass);
+    evas_object_del(webview);
+}
+
+static void mouseClick(int x, int y)
+{
+    Evas *evas = evas_object_evas_get(window);
+    evas_event_feed_mouse_move(evas, x, y, 0, 0);
+    evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+    evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+}
+
+static Eina_Bool onTimeout(void* data)
+{
+    ecore_main_loop_quit();
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool popupMenuShow(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selected_index)
+{
+    tet_infoline("====== popup_menu_show ======\n");
+
+    Ewk_Popup_Menu_Item *item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 0));
+    Eina_Bool enabled = ewk_popup_menu_item_enabled_get(item);
+
+    item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 1));
+    Eina_Bool isEnabled = ewk_popup_menu_item_enabled_get(item);
+
+    dts_check_eq(TESTED_FUN_NAME, enabled && !isEnabled, EINA_TRUE, POS_STRING_FAIL);
+
+    return EINA_TRUE;
+}
+
+/**
+* @brief Checking whether popup item is enabled.
+*/
+static void utc_webkit2_ewk_popup_menu_item_enabled_get_positive(void)
+{
+    static const char selectHTML[] =
+        "<body>"
+        "<select>"
+        "<option title=\"tooltip\" aria-label=\"aria\">one</option>"
+        "<option disabled>two</option>"
+        "</select>"
+        "</body>";
+
+    ewkViewSmartClass.popup_menu_show = popupMenuShow;
+    ewk_view_html_string_load(webview, selectHTML, 0, 0);
+    ecore_main_loop_begin();
+
+    static const unsigned x = 46;
+    static const unsigned y = 19;
+    mouseClick(x, y);
+
+    static const double timeout = 2;
+    Ecore_Timer *timer = ecore_timer_add(timeout, onTimeout, 0);
+    ecore_main_loop_begin();
+}
+
+/**
+* @brief Checking whether function works properly in case of a null popup item.
+*/
+static void utc_webkit2_ewk_popup_menu_item_enabled_get_negative(void)
+{
+    dts_check_eq(TESTED_FUN_NAME, ewk_popup_menu_item_enabled_get(0), 0, NEG_STRING_FAIL);
+}
+
diff --git a/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_is_label_get_func.c b/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_is_label_get_func.c
new file mode 100644 (file)
index 0000000..630cdd0
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * WebKit2 EFL
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/**
+ * @file utc_webkit2_ewk_popup_menu_item_is_label_get_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-27
+ * @brief Tests EWK function ewk_popup_menu_item_is_label_get()
+ */
+
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Elementary.h>
+#include <tet_api.h>
+
+#define TESTED_FUN_NAME "ewk_popup_menu_item_is_label_get"
+#define POS_STRING_FAIL "failed in positive test case"
+#define NEG_STRING_FAIL "failed in negative test case"
+
+static Evas_Object* webview;
+static Evas_Object* window;
+static Evas_Smart* evasSmartClass;
+static Ewk_View_Smart_Class ewkViewSmartClass;
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_webkit2_ewk_popup_menu_item_is_label_get_positive(void);
+static void utc_webkit2_ewk_popup_menu_item_is_label_get_negative(void);
+
+enum {
+    POSITIVE_TC_IDX = 1,
+    NEGATIVE_TC_IDX
+};
+
+struct tet_testlist tet_testlist[] = {
+    {utc_webkit2_ewk_popup_menu_item_is_label_get_positive, POSITIVE_TC_IDX},
+    {utc_webkit2_ewk_popup_menu_item_is_label_get_negative, NEGATIVE_TC_IDX},
+    {NULL, 0}
+};
+
+static Ewk_View_Smart_Class smartClass()
+{
+    static Ewk_View_Smart_Class smart = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("tcwebkit2");
+    return smart;
+}
+
+static void onLoadFinished(void* data, Evas_Object* obj, void* eventInfo)
+{
+    tet_infoline("====== onLoadFinished ======\n");
+    ecore_main_loop_quit();
+}
+
+static void startup(void)
+{
+    tet_infoline("====== startup ======\n");
+
+    g_type_init();
+    elm_init(0, NULL);
+
+    elm_config_preferred_engine_set("opengl_x11");
+
+    window = elm_win_add(NULL, "TC Launcher", ELM_WIN_BASIC);
+    elm_win_title_set(window, "TC Launcher");
+    evas_object_show(window);
+
+    Evas *evas = evas_object_evas_get(window);
+
+    ewkViewSmartClass = smartClass();
+    ewk_view_smart_class_set(&ewkViewSmartClass);
+    evasSmartClass = evas_smart_class_new(&ewkViewSmartClass.sc);
+    Ewk_Context *context = ewk_context_default_get();
+    webview = ewk_view_smart_add(evas, evasSmartClass, context);
+
+    evas_object_resize(webview, 800, 600);
+    evas_object_show(webview);
+
+    evas_object_smart_callback_add(webview, "load,finished", onLoadFinished, 0);
+}
+
+static void cleanup(void)
+{
+    evas_object_smart_callback_del(webview, "load,finished", onLoadFinished);
+    evas_smart_free(evasSmartClass);
+    evas_object_del(webview);
+}
+
+static void mouseClick(int x, int y)
+{
+    Evas *evas = evas_object_evas_get(window);
+    evas_event_feed_mouse_move(evas, x, y, 0, 0);
+    evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+    evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+}
+
+static Eina_Bool onTimeout(void* data)
+{
+    ecore_main_loop_quit();
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool popupMenuShow(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selected_index)
+{
+    tet_infoline("====== popup_menu_show ======\n");
+
+    Ewk_Popup_Menu_Item *item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 0));
+    Eina_Bool isLabel = ewk_popup_menu_item_is_label_get(item);
+
+    item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 2));
+    Eina_Bool label = ewk_popup_menu_item_is_label_get(item);
+
+    dts_check_eq(TESTED_FUN_NAME, label && !isLabel, EINA_TRUE, POS_STRING_FAIL);
+
+    return EINA_TRUE;
+}
+
+/**
+* @brief Checking whether popup item is label
+*/
+static void utc_webkit2_ewk_popup_menu_item_is_label_get_positive(void)
+{
+    static const char selectHTML[] =
+        "<body>"
+        "<select>"
+        "<option>one</option>"
+        "<option disabled>two</option>"
+        "<optgroup label=\"label\"></optgroup>"
+        "</select>"
+        "</body>";
+
+    ewkViewSmartClass.popup_menu_show = popupMenuShow;
+    ewk_view_html_string_load(webview, selectHTML, 0, 0);
+    ecore_main_loop_begin();
+
+    static const unsigned x = 46;
+    static const unsigned y = 19;
+    mouseClick(x, y);
+
+    static const double timeout = 2;
+    Ecore_Timer *timer = ecore_timer_add(timeout, onTimeout, 0);
+    ecore_main_loop_begin();
+}
+
+/**
+* @brief Checking whether function works properly in case of a null popup item.
+*/
+static void utc_webkit2_ewk_popup_menu_item_is_label_get_negative(void)
+{
+    dts_check_eq(TESTED_FUN_NAME, ewk_popup_menu_item_is_label_get(0), 0, NEG_STRING_FAIL);
+}
diff --git a/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_direction_get_func.c b/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_direction_get_func.c
new file mode 100644 (file)
index 0000000..88c6521
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * WebKit2 EFL
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/**
+ * @file utc_webkit2_ewk_popup_menu_item_text_direction_get_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-27
+ * @brief Tests EWK function ewk_popup_menu_item_text_direction_get()
+ */
+
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Elementary.h>
+#include <tet_api.h>
+
+#define TESTED_FUN_NAME "ewk_popup_menu_item_text_direction_get"
+#define POS_STRING_FAIL "failed in positive test case"
+#define NEG_STRING_FAIL "failed in negative test case"
+
+static Evas_Object* webview;
+static Evas_Object* window;
+static Evas_Smart* evasSmartClass;
+static Ewk_View_Smart_Class ewkViewSmartClass;
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_webkit2_ewk_popup_menu_item_text_direction_get_positive(void);
+static void utc_webkit2_ewk_popup_menu_item_text_direction_get_negative(void);
+
+enum {
+    POSITIVE_TC_IDX = 1,
+    NEGATIVE_TC_IDX
+};
+
+struct tet_testlist tet_testlist[] = {
+    {utc_webkit2_ewk_popup_menu_item_text_direction_get_positive, POSITIVE_TC_IDX},
+    {utc_webkit2_ewk_popup_menu_item_text_direction_get_negative, NEGATIVE_TC_IDX},
+    {NULL, 0}
+};
+
+static Ewk_View_Smart_Class smartClass()
+{
+    static Ewk_View_Smart_Class smart = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("tcwebkit2");
+    return smart;
+}
+
+static void onLoadFinished(void* data, Evas_Object* obj, void* eventInfo)
+{
+    tet_infoline("====== onLoadFinished ======\n");
+    ecore_main_loop_quit();
+}
+
+static void startup(void)
+{
+    tet_infoline("====== startup ======\n");
+
+    g_type_init();
+    elm_init(0, NULL);
+
+    elm_config_preferred_engine_set("opengl_x11");
+
+    window = elm_win_add(NULL, "TC Launcher", ELM_WIN_BASIC);
+    elm_win_title_set(window, "TC Launcher");
+    evas_object_show(window);
+
+    Evas *evas = evas_object_evas_get(window);
+
+    ewkViewSmartClass = smartClass();
+    ewk_view_smart_class_set(&ewkViewSmartClass);
+    evasSmartClass = evas_smart_class_new(&ewkViewSmartClass.sc);
+    Ewk_Context *context = ewk_context_default_get();
+    webview = ewk_view_smart_add(evas, evasSmartClass, context);
+
+    evas_object_resize(webview, 800, 600);
+    evas_object_show(webview);
+
+    evas_object_smart_callback_add(webview, "load,finished", onLoadFinished, 0);
+}
+
+static void cleanup(void)
+{
+    evas_object_smart_callback_del(webview, "load,finished", onLoadFinished);
+    evas_smart_free(evasSmartClass);
+    evas_object_del(webview);
+}
+
+static void mouseClick(int x, int y)
+{
+    Evas *evas = evas_object_evas_get(window);
+    evas_event_feed_mouse_move(evas, x, y, 0, 0);
+    evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+    evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+}
+
+static Eina_Bool onTimeout(void* data)
+{
+    ecore_main_loop_quit();
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool popupMenuShow(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selected_index)
+{
+    tet_infoline("====== popup_menu_show ======\n");
+
+    Ewk_Popup_Menu_Item *item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 0));
+    Eina_Bool isLeftToRightDirection = ewk_popup_menu_item_text_direction_get(item) == EWK_TEXT_DIRECTION_LEFT_TO_RIGHT;
+
+    item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 1));
+    Eina_Bool isRightToLeftDirection = ewk_popup_menu_item_text_direction_get(item) == EWK_TEXT_DIRECTION_RIGHT_TO_LEFT;
+
+    dts_check_eq(TESTED_FUN_NAME, isLeftToRightDirection && isRightToLeftDirection, EINA_TRUE, POS_STRING_FAIL);
+
+    return EINA_TRUE;
+}
+
+/**
+* @brief Checking whether popup item's direction is returned properly.
+*/
+static void utc_webkit2_ewk_popup_menu_item_text_direction_get_positive(void)
+{
+    static const char selectHTML[] =
+        "<body>"
+        "<select>"
+        "<option>one</option>"
+        "<option selected dir=\"rtl\">two</option>"
+        "</select>"
+        "</body>";
+
+    ewkViewSmartClass.popup_menu_show = popupMenuShow;
+    ewk_view_html_string_load(webview, selectHTML, 0, 0);
+    ecore_main_loop_begin();
+
+    static const unsigned x = 46;
+    static const unsigned y = 19;
+    mouseClick(x, y);
+
+    static const double timeout = 2;
+    Ecore_Timer *timer = ecore_timer_add(timeout, onTimeout, 0);
+    ecore_main_loop_begin();
+}
+
+/**
+* @brief Checking whether function works properly in case of a null popup item.
+*/
+static void utc_webkit2_ewk_popup_menu_item_text_direction_get_negative(void)
+{
+    dts_check_eq(TESTED_FUN_NAME, ewk_popup_menu_item_text_direction_get(0), EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, NEG_STRING_FAIL);
+}
diff --git a/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_direction_override_get_func.c b/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_direction_override_get_func.c
new file mode 100644 (file)
index 0000000..c867e80
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * WebKit2 EFL
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/**
+ * @file utc_webkit2_ewk_popup_menu_item_text_direction_override_get_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-27
+ * @brief Tests EWK function ewk_popup_menu_item_text_direction_override_get()
+ */
+
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Elementary.h>
+#include <tet_api.h>
+
+#define TESTED_FUN_NAME "ewk_popup_menu_item_text_direction_override_get"
+#define POS_STRING_FAIL "failed in positive test case"
+#define NEG_STRING_FAIL "failed in negative test case"
+
+static Evas_Object* webview;
+static Evas_Object* window;
+static Evas_Smart* evasSmartClass;
+static Ewk_View_Smart_Class ewkViewSmartClass;
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_webkit2_ewk_popup_menu_item_text_direction_override_get_positive(void);
+static void utc_webkit2_ewk_popup_menu_item_text_direction_override_get_negative(void);
+
+enum {
+    POSITIVE_TC_IDX = 1,
+    NEGATIVE_TC_IDX
+};
+
+struct tet_testlist tet_testlist[] = {
+    {utc_webkit2_ewk_popup_menu_item_text_direction_override_get_positive, POSITIVE_TC_IDX},
+    {utc_webkit2_ewk_popup_menu_item_text_direction_override_get_negative, NEGATIVE_TC_IDX},
+    {NULL, 0}
+};
+
+static Ewk_View_Smart_Class smartClass()
+{
+    static Ewk_View_Smart_Class smart = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("tcwebkit2");
+    return smart;
+}
+
+static void onLoadFinished(void* data, Evas_Object* obj, void* eventInfo)
+{
+    tet_infoline("====== onLoadFinished ======\n");
+    ecore_main_loop_quit();
+}
+
+static void startup(void)
+{
+    tet_infoline("====== startup ======\n");
+
+    g_type_init();
+    elm_init(0, NULL);
+
+    elm_config_preferred_engine_set("opengl_x11");
+
+    window = elm_win_add(NULL, "TC Launcher", ELM_WIN_BASIC);
+    elm_win_title_set(window, "TC Launcher");
+    evas_object_show(window);
+
+    Evas *evas = evas_object_evas_get(window);
+
+    ewkViewSmartClass = smartClass();
+    ewk_view_smart_class_set(&ewkViewSmartClass);
+    evasSmartClass = evas_smart_class_new(&ewkViewSmartClass.sc);
+    Ewk_Context *context = ewk_context_default_get();
+    webview = ewk_view_smart_add(evas, evasSmartClass, context);
+
+    evas_object_resize(webview, 800, 600);
+    evas_object_show(webview);
+
+    evas_object_smart_callback_add(webview, "load,finished", onLoadFinished, 0);
+}
+
+static void cleanup(void)
+{
+    evas_object_smart_callback_del(webview, "load,finished", onLoadFinished);
+    evas_smart_free(evasSmartClass);
+    evas_object_del(webview);
+}
+
+static void mouseClick(int x, int y)
+{
+    Evas *evas = evas_object_evas_get(window);
+    evas_event_feed_mouse_move(evas, x, y, 0, 0);
+    evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+    evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+}
+
+static Eina_Bool onTimeout(void* data)
+{
+    ecore_main_loop_quit();
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool popupMenuShow(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selected_index)
+{
+    tet_infoline("====== popup_menu_show ======\n");
+
+    Ewk_Popup_Menu_Item *item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 0));
+    Eina_Bool isOverrideDirection = ewk_popup_menu_item_text_direction_override_get(item);
+
+    item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 1));
+    Eina_Bool overrideDirection = ewk_popup_menu_item_text_direction_override_get(item);
+
+    dts_check_eq(TESTED_FUN_NAME, overrideDirection && !isOverrideDirection, EINA_TRUE, POS_STRING_FAIL);
+
+    return EINA_TRUE;
+}
+
+/**
+* @brief Checking whether popup item's direction is returned properly.
+*/
+static void utc_webkit2_ewk_popup_menu_item_text_direction_override_get_positive(void)
+{
+    static const char selectHTML[] =
+        "<body>"
+        "<select>"
+        "<option>one</option>"
+        "<option style=\"unicode-bidi: bidi-override\">two</option>"
+        "</select>"
+        "</body>";
+
+    ewkViewSmartClass.popup_menu_show = popupMenuShow;
+    ewk_view_html_string_load(webview, selectHTML, 0, 0);
+    ecore_main_loop_begin();
+
+    static const unsigned x = 46;
+    static const unsigned y = 19;
+    mouseClick(x, y);
+
+    static const double timeout = 2;
+    Ecore_Timer *timer = ecore_timer_add(timeout, onTimeout, 0);
+    ecore_main_loop_begin();
+}
+
+/**
+* @brief Checking whether function works properly in case of a null popup item.
+*/
+static void utc_webkit2_ewk_popup_menu_item_text_direction_override_get_negative(void)
+{
+    dts_check_eq(TESTED_FUN_NAME, ewk_popup_menu_item_text_direction_override_get(0), 0, NEG_STRING_FAIL);
+}
diff --git a/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_get_func.c b/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_text_get_func.c
new file mode 100644 (file)
index 0000000..d4c644c
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * WebKit2 EFL
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/**
+ * @file utc_webkit2_ewk_popup_menu_item_text_get_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-27
+ * @brief Tests EWK function ewk_popup_menu_item_text_get()
+ */
+
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Elementary.h>
+#include <tet_api.h>
+
+#define TESTED_FUN_NAME "ewk_popup_menu_item_text_get"
+#define POS_STRING_FAIL "failed in positive test case"
+#define NEG_STRING_FAIL "failed in negative test case"
+
+static Evas_Object* webview;
+static Evas_Object* window;
+static Evas_Smart* evasSmartClass;
+static Ewk_View_Smart_Class ewkViewSmartClass;
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_webkit2_ewk_popup_menu_item_text_get_positive(void);
+static void utc_webkit2_ewk_popup_menu_item_text_get_negative(void);
+
+enum {
+    POSITIVE_TC_IDX = 1,
+    NEGATIVE_TC_IDX
+};
+
+struct tet_testlist tet_testlist[] = {
+    {utc_webkit2_ewk_popup_menu_item_text_get_positive, POSITIVE_TC_IDX},
+    {utc_webkit2_ewk_popup_menu_item_text_get_negative, NEGATIVE_TC_IDX},
+    {NULL, 0}
+};
+
+static Ewk_View_Smart_Class smartClass()
+{
+    static Ewk_View_Smart_Class smart = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("tcwebkit2");
+    return smart;
+}
+
+static void onLoadFinished(void* data, Evas_Object* obj, void* eventInfo)
+{
+    tet_infoline("====== onLoadFinished ======\n");
+    ecore_main_loop_quit();
+}
+
+static void startup(void)
+{
+    tet_infoline("====== startup ======\n");
+
+    g_type_init();
+    elm_init(0, NULL);
+
+    elm_config_preferred_engine_set("opengl_x11");
+
+    window = elm_win_add(NULL, "TC Launcher", ELM_WIN_BASIC);
+    elm_win_title_set(window, "TC Launcher");
+    evas_object_show(window);
+
+    Evas *evas = evas_object_evas_get(window);
+
+    ewkViewSmartClass = smartClass();
+    ewk_view_smart_class_set(&ewkViewSmartClass);
+    evasSmartClass = evas_smart_class_new(&ewkViewSmartClass.sc);
+    Ewk_Context *context = ewk_context_default_get();
+    webview = ewk_view_smart_add(evas, evasSmartClass, context);
+
+    evas_object_resize(webview, 800, 600);
+    evas_object_show(webview);
+
+    evas_object_smart_callback_add(webview, "load,finished", onLoadFinished, 0);
+}
+
+static void cleanup(void)
+{
+    evas_object_smart_callback_del(webview, "load,finished", onLoadFinished);
+    evas_smart_free(evasSmartClass);
+    evas_object_del(webview);
+}
+
+static void mouseClick(int x, int y)
+{
+    Evas *evas = evas_object_evas_get(window);
+    evas_event_feed_mouse_move(evas, x, y, 0, 0);
+    evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+    evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+}
+
+static Eina_Bool onTimeout(void* data)
+{
+    ecore_main_loop_quit();
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool popupMenuShow(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selected_index)
+{
+    tet_infoline("====== popup_menu_show ======\n");
+
+    Ewk_Popup_Menu_Item *item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 0));
+    dts_check_str_eq(TESTED_FUN_NAME, ewk_popup_menu_item_text_get(item), "one", POS_STRING_FAIL);
+
+    return EINA_TRUE;
+}
+
+/**
+* @brief Checking whether popup item's text is returned properly.
+*/
+static void utc_webkit2_ewk_popup_menu_item_text_get_positive(void)
+{
+    static const char selectHTML[] =
+        "<body>"
+        "<select>"
+        "<option>one</option>"
+        "</select>"
+        "</body>";
+
+    ewkViewSmartClass.popup_menu_show = popupMenuShow;
+    ewk_view_html_string_load(webview, selectHTML, 0, 0);
+    ecore_main_loop_begin();
+
+    static const unsigned x = 46;
+    static const unsigned y = 19;
+    mouseClick(x, y);
+
+    static const double timeout = 2;
+    Ecore_Timer *timer = ecore_timer_add(timeout, onTimeout, 0);
+    ecore_main_loop_begin();
+}
+
+/**
+* @brief Checking whether function works properly in case of a null popup item.
+*/
+static void utc_webkit2_ewk_popup_menu_item_text_get_negative(void)
+{
+    dts_check_eq(TESTED_FUN_NAME, ewk_popup_menu_item_text_get(0), 0, NEG_STRING_FAIL);
+}
diff --git a/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_tooltip_get_func.c b/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_tooltip_get_func.c
new file mode 100644 (file)
index 0000000..54b8a11
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * WebKit2 EFL
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/**
+ * @file utc_webkit2_ewk_popup_menu_item_tooltip_get.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-27
+ * @brief Tests EWK function ewk_popup_menu_item_tooltip_get
+ */
+
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Elementary.h>
+#include <tet_api.h>
+
+#define TESTED_FUN_NAME "ewk_popup_menu_item_tooltip_get"
+#define POS_STRING_FAIL "failed in positive test case"
+#define NEG_STRING_FAIL "failed in negative test case"
+
+static Evas_Object* webview;
+static Evas_Object* window;
+static Evas_Smart* evasSmartClass;
+static Ewk_View_Smart_Class ewkViewSmartClass;
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_webkit2_ewk_popup_menu_item_tooltip_get_positive(void);
+static void utc_webkit2_ewk_popup_menu_item_tooltip_get_negative(void);
+
+enum {
+    POSITIVE_TC_IDX = 1,
+    NEGATIVE_TC_IDX
+};
+
+struct tet_testlist tet_testlist[] = {
+    {utc_webkit2_ewk_popup_menu_item_tooltip_get_positive, POSITIVE_TC_IDX},
+    {utc_webkit2_ewk_popup_menu_item_tooltip_get_negative, NEGATIVE_TC_IDX},
+    {NULL, 0}
+};
+
+static Ewk_View_Smart_Class smartClass()
+{
+    static Ewk_View_Smart_Class smart = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("tcwebkit2");
+    return smart;
+}
+
+static void onLoadFinished(void* data, Evas_Object* obj, void* eventInfo)
+{
+    tet_infoline("====== onLoadFinished ======\n");
+    ecore_main_loop_quit();
+}
+
+static void startup(void)
+{
+    tet_infoline("====== startup ======\n");
+
+    g_type_init();
+    elm_init(0, NULL);
+
+    elm_config_preferred_engine_set("opengl_x11");
+
+    window = elm_win_add(NULL, "TC Launcher", ELM_WIN_BASIC);
+    elm_win_title_set(window, "TC Launcher");
+    evas_object_show(window);
+
+    Evas *evas = evas_object_evas_get(window);
+
+    ewkViewSmartClass = smartClass();
+    ewk_view_smart_class_set(&ewkViewSmartClass);
+    evasSmartClass = evas_smart_class_new(&ewkViewSmartClass.sc);
+    Ewk_Context *context = ewk_context_default_get();
+    webview = ewk_view_smart_add(evas, evasSmartClass, context);
+
+    evas_object_resize(webview, 800, 600);
+    evas_object_show(webview);
+
+    evas_object_smart_callback_add(webview, "load,finished", onLoadFinished, 0);
+}
+
+static void cleanup(void)
+{
+    evas_object_smart_callback_del(webview, "load,finished", onLoadFinished);
+    evas_smart_free(evasSmartClass);
+    evas_object_del(webview);
+}
+
+static void mouseClick(int x, int y)
+{
+    Evas *evas = evas_object_evas_get(window);
+    evas_event_feed_mouse_move(evas, x, y, 0, 0);
+    evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+    evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+}
+
+static Eina_Bool onTimeout(void* data)
+{
+    ecore_main_loop_quit();
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool popupMenuShow(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selected_index)
+{
+    tet_infoline("====== popup_menu_show ======\n");
+
+    Ewk_Popup_Menu_Item *item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 0));
+    dts_check_str_eq(TESTED_FUN_NAME, ewk_popup_menu_item_tooltip_get(item), "tooltip", POS_STRING_FAIL);
+
+    return EINA_TRUE;
+}
+
+/**
+* @brief Checking whether popup item's tooltip is returned.
+*/
+static void utc_webkit2_ewk_popup_menu_item_tooltip_get_positive(void)
+{
+    static const char selectHTML[] =
+        "<body>"
+        "<select>"
+        "<option title=\"tooltip\">one</option>"
+        "</select>"
+        "</body>";
+
+    ewkViewSmartClass.popup_menu_show = popupMenuShow;
+    ewk_view_html_string_load(webview, selectHTML, 0, 0);
+    ecore_main_loop_begin();
+
+    static const unsigned x = 46;
+    static const unsigned y = 19;
+    mouseClick(x, y);
+
+    static const double timeout = 2;
+    Ecore_Timer *timer = ecore_timer_add(timeout, onTimeout, 0);
+    ecore_main_loop_begin();
+}
+
+/**
+* @brief Checking whether function works properly in case of a null popup item.
+*/
+static void utc_webkit2_ewk_popup_menu_item_tooltip_get_negative(void)
+{
+    dts_check_eq(TESTED_FUN_NAME, ewk_popup_menu_item_tooltip_get(0), 0, NEG_STRING_FAIL);
+}
diff --git a/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_type_get_func.c b/TC/unit_test/webkit2/utc_webkit2_ewk_popup_menu_item_type_get_func.c
new file mode 100644 (file)
index 0000000..38f720e
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * WebKit2 EFL
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/**
+ * @file utc_webkit2_ewk_popup_menu_item_type_get_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-27
+ * @brief Tests EWK function ewk_popup_menu_item_type_get()
+ */
+
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Elementary.h>
+#include <tet_api.h>
+
+#define TESTED_FUN_NAME "ewk_popup_menu_item_type_get"
+#define POS_STRING_FAIL "failed in positive test case"
+#define NEG_STRING_FAIL "failed in negative test case"
+
+static Evas_Object* webview;
+static Evas_Object* window;
+static Evas_Smart* evasSmartClass;
+static Ewk_View_Smart_Class ewkViewSmartClass;
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_webkit2_ewk_popup_menu_item_type_get_positive(void);
+static void utc_webkit2_ewk_popup_menu_item_type_get_negative(void);
+
+enum {
+    POSITIVE_TC_IDX = 1,
+    NEGATIVE_TC_IDX
+};
+
+struct tet_testlist tet_testlist[] = {
+    {utc_webkit2_ewk_popup_menu_item_type_get_positive, POSITIVE_TC_IDX},
+    {utc_webkit2_ewk_popup_menu_item_type_get_negative, NEGATIVE_TC_IDX},
+    {NULL, 0}
+};
+
+static Ewk_View_Smart_Class smartClass()
+{
+    static Ewk_View_Smart_Class smart = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("tcwebkit2");
+    return smart;
+}
+
+static void onLoadFinished(void* data, Evas_Object* obj, void* eventInfo)
+{
+    tet_infoline("====== onLoadFinished ======\n");
+    ecore_main_loop_quit();
+}
+
+static void startup(void)
+{
+    tet_infoline("====== startup ======\n");
+
+    g_type_init();
+    elm_init(0, NULL);
+
+    elm_config_preferred_engine_set("opengl_x11");
+
+    window = elm_win_add(NULL, "TC Launcher", ELM_WIN_BASIC);
+    elm_win_title_set(window, "TC Launcher");
+    evas_object_show(window);
+
+    Evas *evas = evas_object_evas_get(window);
+
+    ewkViewSmartClass = smartClass();
+    ewk_view_smart_class_set(&ewkViewSmartClass);
+    evasSmartClass = evas_smart_class_new(&ewkViewSmartClass.sc);
+    Ewk_Context *context = ewk_context_default_get();
+    webview = ewk_view_smart_add(evas, evasSmartClass, context);
+
+    evas_object_resize(webview, 800, 600);
+    evas_object_show(webview);
+
+    evas_object_smart_callback_add(webview, "load,finished", onLoadFinished, 0);
+}
+
+static void cleanup(void)
+{
+    evas_object_smart_callback_del(webview, "load,finished", onLoadFinished);
+    evas_smart_free(evasSmartClass);
+    evas_object_del(webview);
+}
+
+static void mouseClick(int x, int y)
+{
+    Evas *evas = evas_object_evas_get(window);
+    evas_event_feed_mouse_move(evas, x, y, 0, 0);
+    evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+    evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, 0);
+}
+
+static Eina_Bool onTimeout(void* data)
+{
+    ecore_main_loop_quit();
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool popupMenuShow(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selected_index)
+{
+    tet_infoline("====== popup_menu_show ======\n");
+
+    Ewk_Popup_Menu_Item *item = (Ewk_Popup_Menu_Item*)(eina_list_nth(items, 0));
+    dts_check_eq(TESTED_FUN_NAME, ewk_popup_menu_item_type_get(item), EWK_POPUP_MENU_ITEM, POS_STRING_FAIL);
+
+    return EINA_TRUE;
+}
+
+/**
+* @brief Checking whether correct popup item's type is returned.
+*/
+static void utc_webkit2_ewk_popup_menu_item_type_get_positive(void)
+{
+    static const char selectHTML[] =
+        "<body>"
+        "<select>"
+        "<option>one</option>"
+        "</select>"
+        "</body>";
+
+    ewkViewSmartClass.popup_menu_show = popupMenuShow;
+    ewk_view_html_string_load(webview, selectHTML, 0, 0);
+    ecore_main_loop_begin();
+
+    static const unsigned x = 46;
+    static const unsigned y = 19;
+    mouseClick(x, y);
+
+    static const double timeout = 2;
+    Ecore_Timer *timer = ecore_timer_add(timeout, onTimeout, 0);
+    ecore_main_loop_begin();
+}
+
+/**
+* @brief Checking whether function works properly in case of a null popup item.
+*/
+static void utc_webkit2_ewk_popup_menu_item_type_get_negative(void)
+{
+    dts_check_eq(TESTED_FUN_NAME, ewk_popup_menu_item_type_get(0), EWK_POPUP_MENU_UNKNOWN, NEG_STRING_FAIL);
+}