4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * This library is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Lesser General Public License as published by the
8 * Free Software Foundation; either version 2.1 of the License, or (at your option)
11 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 * License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this library; if not, write to the Free Software Foundation, Inc., 51
18 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 * @file utc_webkit2_ewk_context_menu_item_image_url_get_func.c
24 * @author Eunmi Lee <eunmi15.lee@samsung.com>
26 * @brief Tests EWK function ewk_context_menu_item_image_url_get()
29 /* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */
30 #define TESTED_FUN_NAME ewk_context_menu_item_image_url_get
31 #define POSITIVE_TEST_FUN_NUM 1
32 #define NEGATIVE_TEST_FUN_NUM 1
34 #include "utc_webkit2_ewk_context_menu.h"
36 static char* image_path = 0;
39 static void contextmenu_customize_callback(void* data, Evas_Object* webview, void* event_info)
41 utc_message("[contextmenu_customize_callback] :: \n");
42 Ewk_Context_Menu* contextmenu = (Ewk_Context_Menu*)event_info;
44 Ewk_Context_Menu_Item* item = ewk_context_menu_nth_item_get(contextmenu, 0);
46 ewk_context_menu_item_remove(contextmenu, item);
47 item = ewk_context_menu_nth_item_get(contextmenu, 0);
50 ewk_context_menu_item_append_as_action(contextmenu, CUSTOM_CONTEXT_MENU_ITEM_TEST_TAG, "< Item for Test >", EINA_TRUE);
51 ewk_context_menu_item_append_as_action(contextmenu, CUSTOM_CONTEXT_MENU_ITEM_TEST_TAG, "< Item for Test >", EINA_TRUE);
52 ewk_context_menu_item_append_as_action(contextmenu, CUSTOM_CONTEXT_MENU_ITEM_TEST_TAG, "< Item for Test >", EINA_TRUE);
57 static void contextmenu_selected_callback(void* data, Evas_Object* webview, void* event_info)
59 Ewk_Context_Menu_Item* item = (Ewk_Context_Menu_Item*)event_info;
60 const char* image_url = ewk_context_menu_item_image_url_get(item);
62 is_failed = EINA_TRUE;
64 url = strdup(image_url);
66 utc_webkit2_main_loop_quit();
69 /* Startup and cleanup functions */
70 static void startup(void)
72 utc_webkit2_ewk_context_menu_test_init();
73 evas_object_smart_callback_add(test_view.webview, "contextmenu,customize", contextmenu_customize_callback, 0);
74 evas_object_smart_callback_add(test_view.webview, "contextmenu,selected", contextmenu_selected_callback, 0);
75 image_path = generate_full_resource_path("/ewk_context_menu/webkit.png");
78 static void cleanup(void)
80 evas_object_smart_callback_del(test_view.webview, "contextmenu,customize", contextmenu_customize_callback);
81 evas_object_smart_callback_del(test_view.webview, "contextmenu,selected", contextmenu_selected_callback);
86 utc_webkit2_ewk_context_menu_test_end();
90 * @brief Tests whether the getting image url from context menu item is performed properly.
95 utc_webkit2_main_loop_begin();
102 utc_check_str_eq(url, image_path);
106 * @brief Tests whether the function works properly for case Ewk_Context_Menu object is NULL.
110 utc_check_eq(ewk_context_menu_item_image_url_get(NULL), 0);