--- /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_find_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-20
+ * @brief Tests EWK function ewk_view_text_find()
+ */
+
+/* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */
+#define TESTED_FUN_NAME ewk_view_text_find
+#define POSITIVE_TEST_FUN_NUM 7
+#define NEGATIVE_TEST_FUN_NUM 2
+
+#include "utc_webkit2_ewk.h"
+
+static int matchCount = -1;
+
+static const char textHtml[] =
+ "<html>"
+ "<body>"
+ "one one one two two three THREE twoTwo text"
+ "</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=========== onFoundText ==============\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.
+*
+* No search flags.
+*/
+POS_TEST_FUN(1)
+{
+ ewk_view_html_string_load(test_view.webview, textHtml, 0, 0);
+ utc_webkit2_main_loop_begin();
+
+ ewk_view_text_find(test_view.webview, "one", EWK_FIND_OPTIONS_NONE | EWK_FIND_OPTIONS_SHOW_OVERLAY, 100);
+ while (matchCount < 0)
+ ecore_main_loop_iterate();
+
+ utc_check_eq(matchCount, 3);
+}
+
+/**
+* @brief Checking whether correct number of words are returned.
+*
+* Checking case insensitive searching.
+*/
+POS_TEST_FUN(2)
+{
+ matchCount = -1;
+
+ ewk_view_text_find(test_view.webview, "three", EWK_FIND_OPTIONS_CASE_INSENSITIVE | EWK_FIND_OPTIONS_SHOW_OVERLAY, 100);
+ while (matchCount < 0)
+ ecore_main_loop_iterate();
+
+ utc_check_eq(matchCount, 2);
+}
+
+/**
+* @brief Checking whether correct number of words are returned.
+*
+* Search text only at the beginning of the words
+*/
+POS_TEST_FUN(3)
+{
+ matchCount = -1;
+ ewk_view_text_find(test_view.webview, "two", EWK_FIND_OPTIONS_AT_WORD_STARTS | EWK_FIND_OPTIONS_SHOW_OVERLAY, 100);
+
+ while (matchCount < 0)
+ ecore_main_loop_iterate();
+
+ utc_check_eq(matchCount, 3);
+}
+
+/**
+* @brief Checking whether correct number of words are returned.
+*
+* Treat capital letters in the middle of words as a start word.
+*/
+POS_TEST_FUN(4)
+{
+ matchCount = -1;
+
+ ewk_view_text_find(test_view.webview, "Two", EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START | EWK_FIND_OPTIONS_SHOW_OVERLAY, 100);
+
+ while (matchCount < 0)
+ ecore_main_loop_iterate();
+
+ utc_check_eq(matchCount, 1);
+}
+
+/**
+* @brief Checking whether correct number of words are returned.
+*
+* Search backwards.
+*/
+POS_TEST_FUN(5)
+{
+ matchCount = -1;
+
+ ewk_view_text_find(test_view.webview, "three", EWK_FIND_OPTIONS_BACKWARDS | EWK_FIND_OPTIONS_SHOW_OVERLAY, 100);
+
+ while (matchCount < 0)
+ ecore_main_loop_iterate();
+
+ utc_check_eq(matchCount, 1);
+}
+
+/**
+* @brief Checking whether correct number of words are returned.
+*
+* Show overlay.
+*/
+POS_TEST_FUN(6)
+{
+ matchCount = -1;
+
+ ewk_view_text_find(test_view.webview, "two", EWK_FIND_OPTIONS_SHOW_OVERLAY, 100);
+
+ while (matchCount < 0)
+ ecore_main_loop_iterate();
+
+ utc_check_eq(matchCount, 3);
+}
+
+/**
+* @brief Checking whether correct number of words are returned.
+*
+* Find indicator.
+*/
+POS_TEST_FUN(7)
+{
+ matchCount = -1;
+
+ ewk_view_text_find(test_view.webview, "text", EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR | EWK_FIND_OPTIONS_SHOW_OVERLAY, 100);
+
+ while (matchCount < 0)
+ ecore_main_loop_iterate();
+
+ utc_check_eq(matchCount, 1);
+}
+
+/**
+* @brief Checking whether function returns FALSE in case of NULL of a webview.
+*/
+NEG_TEST_FUN(1)
+{
+ utc_check_eq(ewk_view_text_find(0, "text", EWK_FIND_OPTIONS_SHOW_OVERLAY, 100), EINA_FALSE);
+}
+
+/**
+* @brief Checking whether function returns FALSE in case of NULL of a search text.
+*/
+NEG_TEST_FUN(2)
+{
+ utc_check_eq(ewk_view_text_find(test_view.webview, 0, EWK_FIND_OPTIONS_SHOW_OVERLAY, 100), 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_text_find_highlight_clear_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-20
+ * @brief Tests EWK function ewk_view_text_find_highlight_clear()
+ */
+
+/* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */
+#define TESTED_FUN_NAME ewk_view_text_find_highlight_clear
+#define POSITIVE_TEST_FUN_NUM 1
+#define NEGATIVE_TEST_FUN_NUM 1
+
+#include "utc_webkit2_ewk.h"
+
+/* Startup and cleanup functions */
+static void startup(void)
+{
+ utc_webkit2_ewk_test_init();
+}
+
+static void cleanup(void)
+{
+ utc_webkit2_ewk_test_end();
+}
+
+/**
+* @brief Checking whether function clears text's highlight properly.
+*/
+POS_TEST_FUN(1)
+{
+ utc_check_eq(ewk_view_text_find_highlight_clear(test_view.webview), EINA_TRUE);
+}
+
+/**
+* @brief Checking whether function returns FALSE in case of NULL of a webview.
+*/
+NEG_TEST_FUN(1)
+{
+ utc_check_eq(ewk_view_text_find_highlight_clear(0), EINA_FALSE);
+}