[UT] ewk_shutdown() method test.
[UT] Tetware tests for ewk_set_arguments function and ewk_settings_continuous_spell_checking_change_cb_set function.
Change-Id: I824917dcd82c738d0b6159d51400ce7b0efe37a4
/**
* Queries if continuous spell checking is enabled.
*
- * @return @c EINA_TRUE if continuous spell checking is enabled or @c EINA_FALSE if it's disabled
+ * @return @c EINA_TRUE if continuous spell checking is enabled or @c EINA_FALSE otherwise.
*/
EAPI Eina_Bool ewk_settings_continuous_spell_checking_enabled_get(void);
utc_webkit2_ewk_hit_test_node_value_get_func \
utc_webkit2_ewk_hit_test_result_context_get_func \
utc_webkit2_ewk_hit_test_tag_name_get_func \
+ utc_webkit2_ewk_main_init_func \
+ utc_webkit2_ewk_main_set_arguments_func \
+ utc_webkit2_ewk_main_shutdown_func \
utc_webkit2_ewk_notification_body_get_func \
utc_webkit2_ewk_notification_cached_permission_set_func \
utc_webkit2_ewk_notification_clicked_func \
utc_webkit2_ewk_settings_auto_load_images_get_func \
utc_webkit2_ewk_settings_auto_load_images_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_settings_continuous_spell_checking_enabled_set_func \
utc_webkit2_ewk_settings_default_encoding_get_func \
utc_webkit2_ewk_settings_default_encoding_set_func \
utc_webkit2_ewk_settings_editable_link_behavior_set_func \
/unit_test/webkit2/utc_webkit2_ewk_hit_test_node_value_get_func
/unit_test/webkit2/utc_webkit2_ewk_hit_test_result_context_get_func
/unit_test/webkit2/utc_webkit2_ewk_hit_test_tag_name_get_func
+/unit_test/webkit2/utc_webkit2_ewk_main_init_func
+/unit_test/webkit2/utc_webkit2_ewk_main_set_arguments_func
+/unit_test/webkit2/utc_webkit2_ewk_main_shutdown_func
/unit_test/webkit2/utc_webkit2_ewk_notification_body_get_func
/unit_test/webkit2/utc_webkit2_ewk_notification_cached_permission_set_func
/unit_test/webkit2/utc_webkit2_ewk_notification_clicked_func
/unit_test/webkit2/utc_webkit2_ewk_settings_auto_load_images_get_func
/unit_test/webkit2/utc_webkit2_ewk_settings_auto_load_images_set_func
/unit_test/webkit2/utc_webkit2_ewk_settings_compositing_borders_visible_set_func
+/unit_test/webkit2/utc_webkit2_ewk_settings_continuous_spell_checking_change_cb_set_func
+/unit_test/webkit2/utc_webkit2_ewk_settings_continuous_spell_checking_enabled_get_func
+/unit_test/webkit2/utc_webkit2_ewk_settings_continuous_spell_checking_enabled_set_func
/unit_test/webkit2/utc_webkit2_ewk_settings_default_encoding_get_func
/unit_test/webkit2/utc_webkit2_ewk_settings_default_encoding_set_func
/unit_test/webkit2/utc_webkit2_ewk_settings_editable_link_behavior_set_func
/unit_test/webkit2/utc_webkit2_ewk_settings_font_default_size_set_func
/unit_test/webkit2/utc_webkit2_ewk_settings_javascript_enabled_get_func
/unit_test/webkit2/utc_webkit2_ewk_settings_javascript_enabled_set_func
-/unit_test/webkit2/utc_webkit2_ewk_settings_loads_images_automatically_get_func
-/unit_test/webkit2/utc_webkit2_ewk_settings_loads_images_automatically_set_func
/unit_test/webkit2/utc_webkit2_ewk_settings_load_remote_images_get_func
/unit_test/webkit2/utc_webkit2_ewk_settings_load_remote_images_set_func
-/unit_test/webkit2/utc_webkit2_ewk_settings_plugins_enabled_set_func
+/unit_test/webkit2/utc_webkit2_ewk_settings_loads_images_automatically_get_func
+/unit_test/webkit2/utc_webkit2_ewk_settings_loads_images_automatically_set_func
/unit_test/webkit2/utc_webkit2_ewk_settings_plugins_enabled_get_func
+/unit_test/webkit2/utc_webkit2_ewk_settings_plugins_enabled_set_func
/unit_test/webkit2/utc_webkit2_ewk_settings_private_browsing_enabled_get_func
/unit_test/webkit2/utc_webkit2_ewk_settings_private_browsing_enabled_set_func
/unit_test/webkit2/utc_webkit2_ewk_settings_scripts_window_open_get_func
/unit_test/webkit2/utc_webkit2_ewk_view_theme_set_func
/unit_test/webkit2/utc_webkit2_ewk_view_title_get_func
/unit_test/webkit2/utc_webkit2_ewk_view_url_get_func
-/unit_test/webkit2/utc_webkit2_ewk_view_url_set_func
/unit_test/webkit2/utc_webkit2_ewk_view_url_request_set_func
+/unit_test/webkit2/utc_webkit2_ewk_view_url_set_func
/unit_test/webkit2/utc_webkit2_ewk_view_user_agent_get_func
/unit_test/webkit2/utc_webkit2_ewk_view_user_agent_set_func
+/unit_test/webkit2/utc_webkit2_ewk_view_use_smart_selection_set_func
/unit_test/webkit2/utc_webkit2_ewk_view_vertical_panning_hold_get_func
/unit_test/webkit2/utc_webkit2_ewk_view_vertical_panning_hold_set_func
/unit_test/webkit2/utc_webkit2_ewk_view_visibility_set_func
--- /dev/null
+/*
+ * WebKit 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_webkit_ewk_main_init_func.c
+ * @author Lukasz Gajowy <l.gajowy@samsung.com>
+ * @date 2013-03-20
+ * @brief Tests EWK function ewk_init()
+ */
+
+#define TESTED_FUN_NAME ewk_init
+#define POSITIVE_TEST_FUN_NUM 2
+#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 if the returned reference counter of ewk_init() is greater than 0.
+ */
+POS_TEST_FUN(1)
+{
+ int result = ewk_init();
+
+ //Cleanup so that another test behave properly.
+ ewk_shutdown();
+
+ utc_check_eq(result, 1);
+}
+
+/**
+ * @brief Checks the method behaviour after multiple calls of it.
+ */
+POS_TEST_FUN(2)
+{
+ int refCountsSize = 2;
+ int refCounts[refCountsSize];
+ int i;
+
+ for(i = 0; i < refCountsSize; i++) {
+ refCounts[i] = ewk_init();
+ utc_message("REF_COUNTS_INIT: %d, ITERATOR = %d", refCounts[i], i);
+ }
+
+ //Cleanup so that another test behave properly.
+ for(i = 0; i < refCountsSize; i++) {
+ ewk_shutdown();
+ }
+
+ for(i = 0; i < refCountsSize; i++) {
+ if(refCounts[i] != i + 1){
+ utc_fail();
+ }
+ }
+ utc_pass();
+}
+
+/**
+ * @brief Checks the method behaviour after invoking ewk_shutdown() method.
+ */
+NEG_TEST_FUN(1)
+{
+ ewk_shutdown();
+ int refCount = ewk_init();
+ utc_check_eq(refCount, 0);
+}
--- /dev/null
+/*
+ * WebKit EFL
+ *
+ * Copyrtght (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_webkit_ewk_main_set_arguments_func.c
+ * @author Lukasz Gajowy <l.gajowy@samsung.com>
+ * @date 2013-03-26
+ * @brief Tests EWK function ewk_set_arguments(int argc, char** argv)
+ */
+
+#define TESTED_FUN_NAME ewk_set_arguments
+#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 if the tested method doesn't cause errors when invoked with proper arguments.
+ */
+POS_TEST_FUN(1)
+{
+ char *argv[] = { "xyz", NULL };
+ ewk_set_arguments(1, argv);
+ utc_pass();
+}
+
+/**
+ * @brief Checks if the tested method doesn't cause errors when invoked with 0 and NULL arguments.
+ */
+NEG_TEST_FUN(1)
+{
+ ewk_set_arguments(0, NULL);
+ utc_pass();
+}
--- /dev/null
+/*
+ * Webkit 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_webkit_ewk_main_shutdown_func.c
+ * @author Lukasz Gajowy <l.gajowy@samsung.com>
+ * @date 2013-03-25
+ * @brief Tests EWK function ewk_shutdown()
+ */
+
+#define TESTED_FUN_NAME ewk_shutdown
+#define POSITIVE_TEST_FUN_NUM 2
+#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 ewk_shutdown() returns int value equal to 0.
+ */
+POS_TEST_FUN(1)
+{
+ ewk_init();
+ int refCount = ewk_shutdown();
+ utc_check_eq(refCount, 0);
+}
+
+/**
+ * @brief Checks the behaviour of the method after multiple invocations of it.
+ */
+POS_TEST_FUN(2)
+{
+ int refCountsSize = 2;
+ int refCounts[refCountsSize];
+ int i;
+
+ for(i = 0; i < refCountsSize; i++) {
+ ewk_init();
+ }
+
+ for(i = refCountsSize - 1; i >= 0; i--) {
+ refCounts[i] = ewk_shutdown();
+ utc_message("REF_COUNTS_SHUTDOWN: %d, ITERATOR = %d", refCounts[i], i);
+ }
+
+ for(i = 0; i < refCountsSize; i++) {
+ if(refCounts[i] != i){
+ utc_fail();
+ }
+ }
+ utc_pass();
+}
+
+/**
+ * @brief Checks, whether the method doesn't cause errors.
+ */
+NEG_TEST_FUN(1)
+{
+ ewk_shutdown();
+ utc_pass();
+}
--- /dev/null
+/*
+ * WebKit 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_continuous_spell_checking_change_cb_set_func.c
+ * @author Lukasz Gajowy <l.gajowy@samsung.com>
+ * @date 2013-03-26
+ * @brief Tests EWK function ewk_settings_continuous_spell_checking_change_cb_set(Ewk_Settings_Continuous_Spell_Checking_Change_Cb cb)
+ */
+
+#define TESTED_FUN_NAME ewk_settings_continuous_spell_checking_change_cb_set
+#define POSITIVE_TEST_FUN_NUM 3
+#define NEGATIVE_TEST_FUN_NUM 1
+
+#include "utc_webkit2_ewk.h"
+
+static Ecore_Timer* timeoutTimer = 0;
+static Eina_Bool isSettingEnabled = EINA_FALSE;
+static double defaultTimeoutInSeconds = 0.5;
+
+static void startup(void)
+{
+ utc_webkit2_ewk_test_init();
+}
+
+static void cleanup(void)
+{
+ utc_webkit2_ewk_test_end();
+}
+
+/**
+ * @brief This callback tests whether the client's callback is called when the spell checking setting was changed.
+ * @param flag - the newly set value.
+ */
+static void onSettingChange(Eina_Bool flag)
+{
+ utc_assert_eq(isSettingEnabled, flag);
+ ecore_timer_del(timeoutTimer);
+ timeoutTimer = 0;
+ ecore_main_loop_quit();
+}
+
+/**
+ * @brief Handles the timeout, which may occur in asynchronous tests.
+ */
+static Eina_Bool onTimeout()
+{
+ ecore_main_loop_quit();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+/**
+ * @brief Checks whether ewk_settings_continuous_spell_checking_change_cb_set method properly sets a calback function and whether it is invoked when needed.
+ */
+POS_TEST_FUN(1)
+{
+ ewk_settings_continuous_spell_checking_change_cb_set(onSettingChange);
+ isSettingEnabled = ewk_settings_continuous_spell_checking_enabled_get();
+ isSettingEnabled = !isSettingEnabled;
+ ewk_settings_continuous_spell_checking_enabled_set(isSettingEnabled);
+ timeoutTimer = ecore_timer_add(defaultTimeoutInSeconds, onTimeout, 0);
+ ecore_main_loop_begin();
+ utc_check_eq(timeoutTimer, 0);
+}
+
+/**
+ * @brief Checks whether the callback is invoked when the setting option is not changed.
+ */
+POS_TEST_FUN(2)
+{
+ ewk_settings_continuous_spell_checking_change_cb_set(onSettingChange);
+
+ // The callback shouldn't be called if the setting option is already set.
+ isSettingEnabled = ewk_settings_continuous_spell_checking_enabled_get();
+ ewk_settings_continuous_spell_checking_enabled_set(isSettingEnabled);
+ timeoutTimer = ecore_timer_add(defaultTimeoutInSeconds, onTimeout, 0);
+ ecore_main_loop_begin();
+ utc_check_ne(timeoutTimer, 0);
+}
+
+/**
+ * @brief Checks whether the callback is called after invalidating it.
+ */
+POS_TEST_FUN(3)
+{
+ ewk_settings_continuous_spell_checking_change_cb_set(onSettingChange);
+
+ // The callback shouldn't be called if the user has invalidated it.
+ ewk_settings_continuous_spell_checking_change_cb_set(0);
+ isSettingEnabled = ewk_settings_continuous_spell_checking_enabled_get();
+ isSettingEnabled = !isSettingEnabled;
+ ewk_settings_continuous_spell_checking_enabled_set(isSettingEnabled);
+ timeoutTimer = ecore_timer_add(defaultTimeoutInSeconds, onTimeout, 0);
+ ecore_main_loop_begin();
+ utc_check_ne(timeoutTimer, 0);
+}
+
+/**
+ * @brief Checks whether the method doesn't cause errors.
+ */
+NEG_TEST_FUN(1)
+{
+ ewk_settings_continuous_spell_checking_change_cb_set(0);
+ utc_pass();
+}
--- /dev/null
+/*
+ * WebKit 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_webkit_ewk_settings_continuous_spell_checking_enabled_get_func.c
+ * @author Lukasz Gajowy <l.gajowy@samsung.com>
+ * @date 2013-03-20
+ * @brief Tests EWK function ewk_settings_continuous_spell_checking_enabled_get()
+ */
+
+#define TESTED_FUN_NAME ewk_settings_continuous_spell_checking_enabled_get
+#define POSITIVE_TEST_FUN_NUM 3
+#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 ewk_settings_continuous_spell_checking_enabled_get() returns EINA_TRUE value.
+ */
+POS_TEST_FUN(1)
+{
+ ewk_settings_continuous_spell_checking_enabled_set(EINA_TRUE);
+ utc_check_eq(ewk_settings_continuous_spell_checking_enabled_get(), EINA_TRUE);
+}
+
+/**
+ * @brief Checks whether ewk_settings_continuous_spell_checking_enabled_get() returns EINA_FALSE value.
+ */
+POS_TEST_FUN(2)
+{
+ ewk_settings_continuous_spell_checking_enabled_set(EINA_FALSE);
+ utc_check_eq(ewk_settings_continuous_spell_checking_enabled_get(), EINA_FALSE);
+}
+
+/**
+ * @brief Checks the default setting value.
+ */
+POS_TEST_FUN(3)
+{
+ utc_check_eq(ewk_settings_continuous_spell_checking_enabled_get(), EINA_FALSE);
+}
+
+/**
+ * @brief Checks whether the method doesn't cause errors.
+ */
+NEG_TEST_FUN(1)
+{
+ ewk_settings_continuous_spell_checking_enabled_get();
+ utc_pass();
+}
--- /dev/null
+/*
+ * WebKit 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_webkit_ewk_settings_continuous_spell_checking_enabled_set_func.c
+ * @author Lukasz Gajowy <l.gajowy@samsung.com>
+ * @date 2013-03-20
+ * @brief Tests EWK function ewk_settings_continuous_spell_checking_enabled_set(Eina_Bool enable)
+ */
+
+#define TESTED_FUN_NAME ewk_settings_continuous_spell_checking_enabled_set
+#define POSITIVE_TEST_FUN_NUM 2
+#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 continuous spell checking has been properly enabled.
+ */
+POS_TEST_FUN(1)
+{
+ ewk_settings_continuous_spell_checking_enabled_set(EINA_TRUE);
+ utc_check_eq(ewk_settings_continuous_spell_checking_enabled_get(), EINA_TRUE);
+}
+
+/**
+ * @brief Checks whether continuous spell checking has been properly disabled.
+ */
+POS_TEST_FUN(2)
+{
+ ewk_settings_continuous_spell_checking_enabled_set(EINA_FALSE);
+ utc_check_eq(ewk_settings_continuous_spell_checking_enabled_get(), EINA_FALSE);
+}
+
+/**
+ * @brief Checks whether the method doesn't cause errors.
+ */
+NEG_TEST_FUN(1)
+{
+ ewk_settings_continuous_spell_checking_enabled_set(EINA_FALSE);
+ utc_pass();
+}