Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_web_tc1.c
1 /*
2  * Tested interface: AtkObject
3  *
4  * Tested AtkObject: EailWeb
5  *
6  * Description: Test AtkObject interface
7  *
8  * Test input: accessible object representing EailWeb
9  *
10  * Expected test result: test should return 0 (success)
11  */
12
13 #include <Elementary.h>
14 #include <atk/atk.h>
15
16 #include "eail_test_utils.h"
17
18 INIT_TEST("EailWeb")
19
20 static void
21 _do_test(AtkObject *obj)
22 {
23    int child_count = 0;
24
25    atk_object_set_description(obj, "test");
26    g_assert_cmpstr(atk_object_get_description(obj), ==, "test");
27
28    atk_object_set_name(obj, "test name");
29    g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");
30
31    child_count =  atk_object_get_n_accessible_children(obj);
32    g_assert(child_count == 0);
33
34    eailu_test_atk_focus(obj, TRUE);
35
36    _printf("DONE. All WEB tests passed successfully \n");
37    eailu_test_code_called = 1;
38 }
39
40 static void
41 _default_web_content_set(Evas_Object *web)
42 {
43 #ifdef HAVE_ELEMENTARY_WEB
44    Evas_Object *view, *frame;
45    const char contents[] = ""
46        "<html>\n"
47        "  <head>\n"
48        "    <title>Nothing to see here, move along</title>\n"
49        "  </head>\n"
50        "  <body>\n"
51        "    <a href=\"http://www.enlightenment.org\" target=\"_blank\">E</a>\n"
52        "    <br />\n"
53        "    <a href=\"http://www.google.com\" target=\"_blank\">Google</a>\n"
54        "    <br />\n"
55        "  </body>\n"
56        "</html>\n";
57
58    view = elm_web_webkit_view_get(web);
59    frame = ewk_view_frame_main_get(view);
60    ewk_frame_contents_set(frame, contents, sizeof(contents) - 1, "text/html",
61                           "UTF-8", NULL);
62 #else
63    _printf("Webview could not be initialized - NO WEBKIT SUPPORT ON PLATFORM\n");
64    _printf("However still raw web widget implementation CAN be tested \n");
65    (void) web;
66 #endif
67 }
68
69 static void
70 _init_webview(Evas_Object *win)
71 {
72    Evas_Object *web;//, *box;
73
74    web = elm_web_add(win);
75    evas_object_size_hint_weight_set(web, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
76    evas_object_size_hint_align_set(web, EVAS_HINT_FILL, 0.5);
77    _default_web_content_set(web);
78
79    evas_object_show(web);
80 }
81
82 EAPI_MAIN int
83 elm_main(int argc, char **argv)
84 {
85    Evas_Object *win;
86
87    win = eailu_create_test_window_with_glib_init(NULL, _on_focus_in);
88    _init_webview(win);
89
90    evas_object_show(win);
91
92    elm_run();
93    elm_shutdown();
94
95    /* exit code */
96    return 0;
97 }
98 ELM_MAIN()