utc_webkit2_ewk_settings_private_browsing_enabled_set_func \
utc_webkit2_ewk_settings_scripts_window_open_get_func \
utc_webkit2_ewk_settings_scripts_window_open_set_func \
+ utc_webkit2_ewk_settings_spell_checking_available_languages_get_func \
+ utc_webkit2_ewk_settings_spell_checking_languages_get_func \
+ utc_webkit2_ewk_settings_spell_checking_languages_set_func \
utc_webkit2_ewk_user_media_permission_set_func \
utc_webkit2_ewk_user_media_permission_suspend_func \
utc_webkit2_ewk_view_add_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_settings_scripts_window_open_set_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_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
--- /dev/null
+/**
+ *
+ * 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_spell_checking_available_languages_get_func.c
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-20
+ * @brief Tests EWK function ewk_settings_spell_checking_available_languages_get()
+ */
+
+#define TESTED_FUN_NAME ewk_settings_spell_checking_available_languages_get
+#define POSITIVE_TEST_FUN_NUM 2
+#define NEGATIVE_TEST_FUN_NUM 1
+
+#include <stdio.h>
+#include <string.h>
+#include "utc_webkit2_ewk.h"
+
+static void startup(void)
+{
+ utc_webkit2_ewk_test_init();
+}
+
+static void cleanup(void)
+{
+ utc_webkit2_ewk_test_end();
+}
+
+static Eina_Bool onTimeout(void* data)
+{
+ utc_webkit2_main_loop_quit();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+
+/**
+ * @brief Checks whether ewk_settings_spell_checking_available_languages_get() returns more than 0 languages.
+ */
+POS_TEST_FUN(1)
+{
+ Eina_List *listOfLanguages = ewk_settings_spell_checking_available_languages_get();
+ unsigned languagesCountResult = eina_list_count(listOfLanguages);
+
+ void *actual = 0;
+ EINA_LIST_FREE(listOfLanguages, actual)
+ eina_stringshare_del((const char*)actual);
+
+ utc_check_gt(languagesCountResult, 0);
+}
+
+/**
+* @brief Checking whether function properly returns languages.
+*/
+POS_TEST_FUN(2)
+{
+ Eina_List *availableLanguages = ewk_settings_spell_checking_available_languages_get();
+
+ // No dictionary is available/installed or the SPELLCHECK macro is disabled.
+ if (!availableLanguages)
+ utc_fail();
+
+ unsigned numberOfAvailableLanguages = eina_list_count(availableLanguages);
+
+ // it is assumed that user has at least 2 languages installed.
+ if (numberOfAvailableLanguages < 2) {
+ void *lang = 0;
+ EINA_LIST_FREE(availableLanguages, lang)
+ eina_stringshare_del((const char*)lang);
+ utc_pass();
+ }
+
+ char *languages = NULL;
+ // Helper to create one string with comma separated languages.
+ void *actual = 0;
+ Eina_List *listIterator = 0;
+ EINA_LIST_FOREACH(availableLanguages, listIterator, actual) {
+ if (!languages) {
+ languages = (char*)malloc(strlen(actual) + 1);
+ strcpy(languages, actual);
+ } else {
+ languages = (char*)realloc(languages, strlen(languages) + strlen(actual) + 2);
+ strcat(languages, ",");
+ strcat(languages, actual);
+ }
+ }
+ // Set all available languages.
+ ewk_settings_spell_checking_languages_set(languages);
+
+ // Languages are being loaded on the idler, wait for them.
+ Ecore_Timer *timeoutTimer = 0;
+ static const double defaultTimeoutInSeconds = 2;
+
+ timeoutTimer = ecore_timer_add(defaultTimeoutInSeconds, onTimeout, 0);
+ utc_webkit2_main_loop_begin();
+
+ // Get the languages in use.
+ Eina_List *loadedLanguages = ewk_settings_spell_checking_languages_get();
+ Eina_Bool languagesNumberEqual = eina_list_count(loadedLanguages) == eina_list_count(availableLanguages);
+
+ int languageEqual = 0;
+ void *expected = 0;
+ unsigned i = 0;
+ // Verify whether the loaded languages list is equal to the available languages list.
+ EINA_LIST_FOREACH(loadedLanguages, listIterator, actual) {
+ expected = eina_list_nth(availableLanguages, i++);
+ if ((languageEqual = strcmp((const char*)expected, (const char*)actual)) != 0)
+ break;
+ }
+
+ // Delete the lists.
+ EINA_LIST_FREE(availableLanguages, actual)
+ eina_stringshare_del((const char*)actual);
+
+ EINA_LIST_FREE(loadedLanguages, actual)
+ eina_stringshare_del((const char*)actual);
+
+ free(languages);
+
+ utc_check_eq(languagesNumberEqual && !languageEqual, EINA_TRUE);
+}
+
+/**
+* @brief Checking whether function works properly.
+*/
+NEG_TEST_FUN(1)
+{
+ Eina_List *availableLanguages = ewk_settings_spell_checking_available_languages_get();
+
+ void *lang = 0;
+ EINA_LIST_FREE(availableLanguages, lang)
+ eina_stringshare_del((const char*)lang);
+
+ utc_pass();
+}
--- /dev/null
+/**
+ *
+ * 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_spell_checking_languages_get
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-25
+ * @brief Tests EWK function ewk_settings_spell_checking_languages_get
+ */
+
+#define TESTED_FUN_NAME ewk_settings_spell_checking_languages_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 Checking whether function gets languages.
+*/
+POS_TEST_FUN(1)
+{
+ Eina_List *languages = ewk_settings_spell_checking_languages_get();
+ unsigned languagescount = eina_list_count(languages);
+
+ void *lang = 0;
+ EINA_LIST_FREE(languages, lang)
+ eina_stringshare_del((const char*)lang);
+
+ utc_check_gt(languagescount, 0);
+}
+
+/**
+* @brief Checking whether function works properly.
+*/
+NEG_TEST_FUN(1)
+{
+ Eina_List *languages = ewk_settings_spell_checking_languages_get();
+
+ void *lang = 0;
+ EINA_LIST_FREE(languages, lang)
+ eina_stringshare_del((const char*)lang);
+
+ utc_pass();
+}
--- /dev/null
+/**
+ *
+ * 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_spell_checking_languages_set
+ * @author Krzysztof Czech <k.czech@samsung.com>
+ * @date 2013-03-25
+ * @brief Tests EWK function ewk_settings_spell_checking_languages_set
+ */
+
+#define TESTED_FUN_NAME ewk_settings_spell_checking_languages_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();
+}
+
+static Eina_Bool onTimeout(void* data)
+{
+ utc_webkit2_main_loop_quit();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+/**
+* @brief Checking whether function properly sets languages.
+*/
+POS_TEST_FUN(1)
+{
+ Ecore_Timer *timer = 0;
+ static const char languages[] = "en_HK,en_SG,en_ZA,en_BS,en_GH";
+ static const double defaultTimeout = 2;
+ static const unsigned defaultLanguagesNumber = 5;
+
+ // Set languages
+ ewk_settings_spell_checking_languages_set(languages);
+ timer = ecore_timer_add(2, onTimeout, 0);
+ utc_webkit2_main_loop_begin();
+
+ // Get languages
+ Eina_List *loadedLanguages = ewk_settings_spell_checking_languages_get();
+ if (!loadedLanguages)
+ utc_fail();
+
+ Eina_Bool result = eina_list_count(loadedLanguages) == defaultLanguagesNumber;
+
+ void *actual = 0;
+ EINA_LIST_FREE(loadedLanguages, actual)
+ eina_stringshare_del((const char*)actual);
+
+ utc_check_eq(result, EINA_TRUE);
+}
+
+/**
+* @brief Checking whether function works properly.
+*/
+NEG_TEST_FUN(1)
+{
+ ewk_settings_spell_checking_languages_set(0);
+ utc_pass();
+}