* The "text,found" callback will be called with the number of matched string.
*
* @param o view object to find text
- * @param text text to find
+ * @param text text to find, must @b not be @c NULL
* @param options options to find
* @param max_match_count maximum match count to find, unlimited if 0
*
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_selected_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_settings_auto_fitting_set_func \
utc_webkit2_ewk_settings_auto_load_images_get_func \
utc_webkit2_ewk_settings_auto_load_images_set_func \
+ utc_webkit2_ewk_settings_text_autosizing_enabled_get_func \
+ utc_webkit2_ewk_settings_text_autosizing_enabled_set_func \
utc_webkit2_ewk_settings_compositing_borders_visible_set_func \
utc_webkit2_ewk_settings_continuous_spell_checking_change_cb_set_func \
utc_webkit2_ewk_settings_continuous_spell_checking_enabled_get_func \
utc_webkit2_ewk_view_add_with_context_func \
utc_webkit2_ewk_view_back_func \
utc_webkit2_ewk_view_back_possible_func \
+ utc_webkit2_ewk_view_before_unload_confirm_panel_callback_set_func \
+ utc_webkit2_ewk_view_before_unload_confirm_panel_reply_func \
utc_webkit2_ewk_view_command_execute_func \
utc_webkit2_ewk_view_contents_size_get_func \
utc_webkit2_ewk_view_context_get_func \
utc_webkit2_ewk_view_page_visibility_state_set_func \
utc_webkit2_ewk_view_plain_text_get_func \
utc_webkit2_ewk_view_popup_menu_close_func \
+ utc_webkit2_ewk_view_popup_menu_multiple_select_func \
utc_webkit2_ewk_view_popup_menu_select_func \
utc_webkit2_ewk_view_reload_bypass_cache_func \
utc_webkit2_ewk_view_reload_func \
utc_webkit2_ewk_view_stop_func \
utc_webkit2_ewk_view_string_find_func \
utc_webkit2_ewk_view_suspend_func \
+ utc_webkit2_ewk_view_text_matches_count_func \
utc_webkit2_ewk_view_text_zoom_get_func \
utc_webkit2_ewk_view_text_zoom_set_func \
utc_webkit2_ewk_view_theme_get_func \
--- /dev/null
+<html>
+<head>
+<script>
+ function closeIt()
+ {
+ return "You have attempted to leave this page.";
+ }
+ window.onbeforeunload = closeIt;
+ setTimeout("self.close();",1000);
+</script>
+</head>
+<body>
+</body>
+</html>
/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_selected_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_settings_spell_checking_available_languages_get_func
/unit_test/webkit2/utc_webkit2_ewk_settings_spell_checking_languages_get_func
/unit_test/webkit2/utc_webkit2_ewk_settings_spell_checking_languages_set_func
+/unit_test/webkit2/utc_webkit2_ewk_settings_text_autosizing_enabled_get_func
+/unit_test/webkit2/utc_webkit2_ewk_settings_text_autosizing_enabled_set_func
/unit_test/webkit2/utc_webkit2_ewk_user_media_permission_set_func
/unit_test/webkit2/utc_webkit2_ewk_user_media_permission_suspend_func
/unit_test/webkit2/utc_webkit2_ewk_view_add_func
/unit_test/webkit2/utc_webkit2_ewk_view_add_with_context_func
/unit_test/webkit2/utc_webkit2_ewk_view_back_func
/unit_test/webkit2/utc_webkit2_ewk_view_back_possible_func
+/unit_test/webkit2/utc_webkit2_ewk_view_before_unload_confirm_panel_callback_set_func
+/unit_test/webkit2/utc_webkit2_ewk_view_before_unload_confirm_panel_reply_func
/unit_test/webkit2/utc_webkit2_ewk_view_command_execute_func
/unit_test/webkit2/utc_webkit2_ewk_view_contents_size_get_func
/unit_test/webkit2/utc_webkit2_ewk_view_context_get_func
/unit_test/webkit2/utc_webkit2_ewk_view_page_visibility_state_set_func
/unit_test/webkit2/utc_webkit2_ewk_view_plain_text_get_func
/unit_test/webkit2/utc_webkit2_ewk_view_popup_menu_close_func
+/unit_test/webkit2/utc_webkit2_ewk_view_popup_menu_multiple_select_func
/unit_test/webkit2/utc_webkit2_ewk_view_popup_menu_select_func
/unit_test/webkit2/utc_webkit2_ewk_view_reload_bypass_cache_func
/unit_test/webkit2/utc_webkit2_ewk_view_reload_func
/unit_test/webkit2/utc_webkit2_ewk_view_suspend_func
/unit_test/webkit2/utc_webkit2_ewk_view_text_find_func
/unit_test/webkit2/utc_webkit2_ewk_view_text_find_highlight_clear_func
+/unit_test/webkit2/utc_webkit2_ewk_view_text_matches_count_func
/unit_test/webkit2/utc_webkit2_ewk_view_text_zoom_get_func
/unit_test/webkit2/utc_webkit2_ewk_view_text_zoom_set_func
/unit_test/webkit2/utc_webkit2_ewk_view_theme_get_func
--- /dev/null
+/*
+ * 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_selected_get.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-27
+ * @brief Tests EWK function ewk_popup_menu_item_selected_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_selected_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_selected_get_positive(void);
+static void utc_webkit2_ewk_popup_menu_item_selected_get_negative(void);
+
+enum {
+ POSITIVE_TC_IDX = 1,
+ NEGATIVE_TC_IDX
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_webkit2_ewk_popup_menu_item_selected_get_positive, POSITIVE_TC_IDX},
+ {utc_webkit2_ewk_popup_menu_item_selected_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, 1));
+ dts_check_eq(TESTED_FUN_NAME, ewk_popup_menu_item_selected_get(item), EINA_TRUE, POS_STRING_FAIL);
+
+ return EINA_TRUE;
+}
+
+/**
+* @brief Checking whether correct popup item's type is returned.
+*/
+static void utc_webkit2_ewk_popup_menu_item_selected_get_positive(void)
+{
+ static const char selectHTML[] =
+ "<body>"
+ "<select>"
+ "<option>one</option>"
+ "<option selected>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_selected_get_negative(void)
+{
+ dts_check_eq(TESTED_FUN_NAME, ewk_popup_menu_item_selected_get(0), EINA_FALSE, NEG_STRING_FAIL);
+}
--- /dev/null
+/*
+ * 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_settings_text_autosizing_enabled_get_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-05-28
+ * @brief Tests EWK function ewk_settings_text_autosizing_enabled_get
+ */
+
+#define TESTED_FUN_NAME ewk_settings_text_autosizing_enabled_get
+#define POSITIVE_TEST_FUN_NUM 1
+#define NEGATIVE_TEST_FUN_NUM 1
+
+#include "utc_webkit2_ewk.h"
+
+static void startup(void)
+{
+ utc_webkit2_ewk_test_init();
+}
+
+static void cleanup(void)
+{
+ utc_webkit2_ewk_test_end();
+}
+
+/**
+* @brief Checks whether function returns correct value.
+*/
+POS_TEST_FUN(1)
+{
+ Ewk_Settings* settings = ewk_view_settings_get(test_view.webview);
+
+ ewk_settings_text_autosizing_enabled_set(settings, EINA_TRUE);
+ utc_check_eq(ewk_settings_text_autosizing_enabled_get(settings), EINA_TRUE);
+
+ ewk_settings_text_autosizing_enabled_set(settings, EINA_FALSE);
+ utc_check_eq(ewk_settings_text_autosizing_enabled_get(settings), EINA_FALSE);
+}
+
+/**
+* @brief Checks whether functions does not cause errors.
+*/
+NEG_TEST_FUN(1)
+{
+ utc_check_eq(ewk_settings_text_autosizing_enabled_get(0), EINA_FALSE);
+}
--- /dev/null
+/*
+ * 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_settings_text_autosizing_enabled_set_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-05-28
+ * @brief Tests EWK function ewk_settings_text_autosizing_enabled_set
+ */
+
+#define TESTED_FUN_NAME ewk_settings_text_autosizing_enabled_set
+#define POSITIVE_TEST_FUN_NUM 1
+#define NEGATIVE_TEST_FUN_NUM 1
+
+#include "utc_webkit2_ewk.h"
+
+static void startup(void)
+{
+ utc_webkit2_ewk_test_init();
+}
+
+static void cleanup(void)
+{
+ utc_webkit2_ewk_test_end();
+}
+
+/**
+* @brief Checks whether function sets value properly.
+*/
+POS_TEST_FUN(1)
+{
+ Ewk_Settings* settings = ewk_view_settings_get(test_view.webview);
+
+ utc_check_eq(ewk_settings_text_autosizing_enabled_set(settings, EINA_TRUE), EINA_TRUE);
+ utc_check_eq(ewk_settings_text_autosizing_enabled_get(settings), EINA_TRUE);
+
+ utc_check_eq(ewk_settings_text_autosizing_enabled_set(settings, EINA_FALSE), EINA_TRUE);
+ utc_check_eq(ewk_settings_text_autosiznig_enabled_get(settings), EINA_FALSE);
+}
+
+/**
+* @brief Checks whether function works properly.
+*/
+NEG_TEST_FUN(1)
+{
+ utc_check_eq(ewk_settings_text_autosizing_enabled_set(0, EINA_TRUE), EINA_FALSE);
+}
--- /dev/null
+/*
+ * 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_view_before_unload_confirm_panel_callback_set_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-05-28
+ * @brief Tests EWK function ewk_view_before_unload_confirm_panel_callback_set
+ */
+
+#define TESTED_FUN_NAME ewk_view_before_unload_confirm_panel_callback_set
+#define POSITIVE_TEST_FUN_NUM 1
+#define NEGATIVE_TEST_FUN_NUM 1
+
+#include "utc_webkit2_ewk.h"
+
+#define HTML_PAGE "/ewk_view/before_unload_test.html"
+
+static Ecore_Timer* watchTimer;
+static Eina_Bool result;
+
+static void loadURL(const char* url)
+{
+ char* full_path = generate_full_resource_path(url);
+ if (!full_path)
+ utc_fail();
+
+ Eina_Bool result = ewk_view_url_set(test_view.webview, full_path);
+ free(full_path);
+
+ if (!result)
+ utc_fail();
+}
+
+static Eina_Bool onWatchTimerCallback(void* data)
+{
+ utc_message("====== onWatchTimerCallback ======\n");
+ utc_webkit2_main_loop_quit();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void onLoadFinished(void* data, Evas_Object* webview, void* event_info)
+{
+ utc_message("===== onLoadFinished ======\n");
+ watchTimer = ecore_timer_add(20, onWatchTimerCallback, 0);
+}
+
+static void startup(void)
+{
+ utc_webkit2_ewk_test_init();
+ evas_object_smart_callback_add(test_view.webview, "load,finished", onLoadFinished, NULL);
+}
+
+static void cleanup(void)
+{
+ utc_webkit2_ewk_test_end();
+ evas_object_smart_callback_del(test_view.webview, "load,finished", onLoadFinished);
+ ecore_timer_del(watchTimer);
+}
+
+static Eina_Bool beforeUnloadCallback(Evas_Object* o, const char* message, void* userData)
+{
+ utc_message("===== beforeUnloadCallback =====\n");
+ result = EINA_TRUE;
+ utc_webkit2_main_loop_quit();
+}
+
+/**
+* @brief Checks whether functions sets values properly.
+*/
+POS_TEST_FUN(1)
+{
+ ewk_view_before_unload_confirm_panel_callback_set(test_view.webview, beforeUnloadCallback, 0);
+
+ loadURL(HTML_PAGE);
+ utc_webkit2_main_loop_begin();
+
+ utc_check_eq(result, EINA_TRUE);
+}
+
+/**
+* @brief Checks whether function works properly in case of null of a webview.
+*/
+NEG_TEST_FUN(1)
+{
+ ewk_view_before_unload_confirm_panel_callback_set(0, 0, 0);
+ utc_pass();
+}
--- /dev/null
+/*
+ * 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_view_before_unload_confirm_panel_reply_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-05-28
+ * @brief Tests EWK function ewk_view_before_unload_confirm_panel_reply
+ */
+
+#define TESTED_FUN_NAME ewk_view_before_unload_confirm_panel_reply
+#define POSITIVE_TEST_FUN_NUM 1
+#define NEGATIVE_TEST_FUN_NUM 1
+
+#include "utc_webkit2_ewk.h"
+
+#define HTML_PAGE "/ewk_view/before_unload_test.html"
+
+static Ecore_Timer* watchTimer;
+static Eina_Bool result;
+
+static void loadURL(const char* url)
+{
+ char* full_path = generate_full_resource_path(url);
+ if (!full_path)
+ utc_fail();
+
+ Eina_Bool result = ewk_view_url_set(test_view.webview, full_path);
+ free(full_path);
+
+ if (!result)
+ utc_fail();
+}
+
+static Eina_Bool onWatchTimerCallback(void* data)
+{
+ utc_message("====== onWatchTimerCallback ======\n");
+ utc_webkit2_main_loop_quit();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void onLoadFinished(void* data, Evas_Object* webview, void* event_info)
+{
+ utc_message("===== onLoadFinished ======\n");
+ watchTimer = ecore_timer_add(20, onWatchTimerCallback, 0);
+}
+
+static void startup(void)
+{
+ utc_webkit2_ewk_test_init();
+ evas_object_smart_callback_add(test_view.webview, "load,finished", onLoadFinished, NULL);
+}
+
+static void cleanup(void)
+{
+ utc_webkit2_ewk_test_end();
+ evas_object_smart_callback_del(test_view.webview, "load,finished", onLoadFinished);
+ ecore_timer_del(watchTimer);
+}
+
+static Eina_Bool beforeUnloadCallback(Evas_Object* o, const char* message, void* userData)
+{
+ utc_message("===== beforeUnloadCallback =====\n");
+
+ ewk_view_before_unload_confirm_panel_reply(test_view.webview, EINA_TRUE);
+ result = EINA_TRUE;
+
+ utc_webkit2_main_loop_quit();
+}
+
+/**
+* @brief Checks whether function works properly.
+*/
+POS_TEST_FUN(1)
+{
+ ewk_view_before_unload_confirm_panel_callback_set(test_view.webview, beforeUnloadCallback, 0);
+
+ loadURL(HTML_PAGE);
+ utc_webkit2_main_loop_begin();
+
+ utc_check_eq(result, EINA_TRUE);
+}
+
+/**
+* @brief Checks whether function works correctly in case of null of a webview.
+*/
+NEG_TEST_FUN(1)
+{
+ ewk_view_before_unload_confirm_panel_reply(0, EINA_FALSE);
+ utc_pass();
+}
--- /dev/null
+/*
+ * 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_view_popup_menu_multiple_select_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-05-29
+ * @brief Tests EWK function ewk_view_popup_menu_multiple_select()
+ */
+
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Elementary.h>
+#include <tet_api.h>
+
+#define TESTED_FUN_NAME "ewk_view_popup_menu_multiple_select"
+#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_view_popup_menu_multiple_select_positive(void);
+static void utc_webkit2_ewk_view_popup_menu_multiple_select_negative(void);
+
+enum {
+ POSITIVE_TC_IDX = 1,
+ NEGATIVE_TC_IDX
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_webkit2_ewk_view_popup_menu_multiple_select_positive, POSITIVE_TC_IDX},
+ {utc_webkit2_ewk_view_popup_menu_multiple_select_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");
+
+ eina_init();
+
+ 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);
+
+ /*elements = eina_list_append(elements, eina_stringshare_add("one"));
+ elements = eina_list_append(elements, eina_stringshare_add("two"));
+ elements = eina_list_append(elements, eina_stringshare_add("three"));*/
+
+ 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);
+ eina_shutdown();
+}
+
+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 multiplePopupMenuShow(Ewk_View_Smart_Data* smartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items)
+{
+ tet_infoline("====== multiple_popup_menu_show ======\n");
+
+ Eina_Inarray *inarr = eina_inarray_new(sizeof(int), 0);
+ int index = 0;
+ eina_inarray_push(inarr, &index);
+ index = 1;
+ eina_inarray_push(inarr, &index);
+
+ Eina_Bool result = ewk_view_popup_menu_multiple_select(webview, inarr);
+
+ eina_inarray_free(inarr);
+
+ dts_check_eq(TESTED_FUN_NAME, result, EINA_TRUE, POS_STRING_FAIL);
+
+ return EINA_TRUE;
+}
+
+/**
+* @brief Checking whether function works properly.
+*/
+static void utc_webkit2_ewk_view_popup_menu_multiple_select_positive(void)
+{
+ static const char selectHTML[] =
+ "<body>"
+ "<select multiple>"
+ "<option>one</option>"
+ "<option>two</option>"
+ "<option>three</option>"
+ "</select>"
+ "</body>";
+
+ ewkViewSmartClass.multiple_popup_menu_show = multiplePopupMenuShow;
+ 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.
+*/
+static void utc_webkit2_ewk_view_popup_menu_multiple_select_negative(void)
+{
+ dts_check_eq(TESTED_FUN_NAME, ewk_view_popup_menu_multiple_select(0, 0), EINA_FALSE, POS_STRING_FAIL);
+}
--- /dev/null
+/*
+ * 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_view_text_matches_count_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-05-28
+ * @brief Tests EWK function ewk_view_text_matches_count
+ */
+
+#define TESTED_FUN_NAME ewk_view_text_matches_count
+#define POSITIVE_TEST_FUN_NUM 4
+#define NEGATIVE_TEST_FUN_NUM 2
+
+#include "utc_webkit2_ewk.h"
+
+static int matchCount = -1;
+
+static const char textHtml[] =
+ "<html>"
+ "<body>"
+ "one one Two two two three THREE twoTwo text ONE"
+ "</body>"
+ "</html>";
+
+static void onLoadFinished(void* userData, Evas_Object* obj, void* eventInfo)
+{
+ utc_message("=========== onLoadFinished ===========\n");
+ utc_webkit2_main_loop_quit();
+}
+
+static void onTextFound(void* userData, Evas_Object* obj, void* eventInfo)
+{
+ utc_message("\n=========== onTextFound ==============\n");
+ int *result = (int*)userData;
+ unsigned *count = (unsigned*)eventInfo;
+
+ *result = *count;
+}
+
+/* Startup and cleanup functions */
+static void startup(void)
+{
+ utc_webkit2_ewk_test_init();
+ evas_object_smart_callback_add(test_view.webview, "load,finished", onLoadFinished, 0);
+ evas_object_smart_callback_add(test_view.webview, "text,found", onTextFound, &matchCount);
+}
+
+static void cleanup(void)
+{
+ evas_object_smart_callback_del(test_view.webview, "load,finished", onLoadFinished);
+ evas_object_smart_callback_del(test_view.webview, "text,found", onTextFound);
+ utc_webkit2_ewk_test_end();
+}
+
+/**
+* @brief Checking whether correct number of words are returned.
+*/
+POS_TEST_FUN(1)
+{
+ ewk_view_html_string_load(test_view.webview, textHtml, 0, 0);
+ utc_webkit2_main_loop_begin();
+
+ ewk_view_text_matches_count(test_view.webview, "one", EWK_FIND_OPTIONS_NONE, 100);
+ while (matchCount < 0)
+ ecore_main_loop_iterate();
+
+ utc_check_eq(matchCount, 2);
+}
+
+/**
+* @brief Checking whether correct number of words are returned, case insensitive.
+*/
+POS_TEST_FUN(2)
+{
+ matchCount = -1;
+
+ ewk_view_text_matches_count(test_view.webview, "one", EWK_FIND_OPTIONS_CASE_INSENSITIVE, 100);
+ while (matchCount < 0)
+ ecore_main_loop_iterate();
+
+ utc_check_eq(matchCount, 3);
+}
+
+/**
+* @brief Checking whether correct number of words are returned, first occurrence.
+*/
+POS_TEST_FUN(3)
+{
+ matchCount = -1;
+
+ ewk_view_text_matches_count(test_view.webview, "Two", EWK_FIND_OPTIONS_AT_WORD_STARTS, 100);
+ while (matchCount < 0)
+ ecore_main_loop_iterate();
+
+ utc_check_eq(matchCount, 1);
+}
+
+/**
+* @brief Checking whether correct number of words are returned, capital letter at the beginning.
+*/
+POS_TEST_FUN(4)
+{
+ matchCount = -1;
+
+ ewk_view_text_matches_count(test_view.webview, "Two", EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START, 100);
+ while (matchCount < 0)
+ ecore_main_loop_iterate();
+
+ utc_check_eq(matchCount, 2);
+}
+
+/**
+* @brief Checking whether function works properly in case of NULL of a webview.
+*/
+NEG_TEST_FUN(1)
+{
+ utc_check_eq(ewk_view_text_matches_count(0, "one", EWK_FIND_OPTIONS_NONE, 100), EINA_FALSE);
+}
+
+/**
+* @brief Checking whether function works properly in case of NULL of a text.
+*/
+NEG_TEST_FUN(2)
+{
+ utc_check_eq(ewk_view_text_matches_count(test_view.webview, 0, EWK_FIND_OPTIONS_NONE, 100), EINA_FALSE);
+}