summaryrefslogtreecommitdiffstats
path: root/WebKit/gtk/tests
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-09-13 16:35:48 +0100
committerIain Merrick <husky@google.com>2010-09-16 12:10:42 +0100
commit5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306 (patch)
treeddce1aa5e3b6967a69691892e500897558ff8ab6 /WebKit/gtk/tests
parent12bec63ec71e46baba27f0bd9bd9d8067683690a (diff)
downloadexternal_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.zip
external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.gz
external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.bz2
Merge WebKit at r67178 : Initial merge by git.
Change-Id: I57e01163b6866cb029cdadf405a0394a3918bc18
Diffstat (limited to 'WebKit/gtk/tests')
-rw-r--r--WebKit/gtk/tests/testatk.c78
-rw-r--r--WebKit/gtk/tests/testmimehandling.c4
2 files changed, 80 insertions, 2 deletions
diff --git a/WebKit/gtk/tests/testatk.c b/WebKit/gtk/tests/testatk.c
index e159f8a..9930bc2 100644
--- a/WebKit/gtk/tests/testatk.c
+++ b/WebKit/gtk/tests/testatk.c
@@ -46,6 +46,8 @@ static const char* contentsInTableWithHeaders = "<html><body><table><tr><th>foo<
static const char* textWithAttributes = "<html><head><style>.st1 {font-family: monospace; color:rgb(120,121,122);} .st2 {text-decoration:underline; background-color:rgb(80,81,82);}</style></head><body><p style=\"font-size:14; text-align:right;\">This is the <i>first</i><b> sentence of this text.</b></p><p class=\"st1\">This sentence should have an style applied <span class=\"st2\">and this part should have another one</span>.</p><p>x<sub>1</sub><sup>2</sup>=x<sub>2</sub><sup>3</sup></p><p style=\"text-align:center;\">This sentence is the <strike>last</strike> one.</p></body></html>";
+static const char* listsOfItems = "<html><body><ul><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ul><ol><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ol></body></html>";
+
static gboolean bail_out(GMainLoop* loop)
{
if (g_main_loop_is_running(loop))
@@ -843,6 +845,81 @@ static void test_webkit_atk_get_extents(void)
g_object_unref(webView);
}
+static void testWebkitAtkListsOfItems(void)
+{
+ WebKitWebView* webView;
+ AtkObject* obj;
+ AtkObject* uList;
+ AtkObject* oList;
+ AtkObject* item1;
+ AtkObject* item2;
+ AtkObject* item3;
+ GMainLoop* loop;
+
+ webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
+ g_object_ref_sink(webView);
+ GtkAllocation alloc = { 0, 0, 800, 600 };
+ gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
+ webkit_web_view_load_string(webView, listsOfItems, NULL, NULL, NULL);
+ loop = g_main_loop_new(NULL, TRUE);
+
+ g_timeout_add(100, (GSourceFunc)bail_out, loop);
+ g_main_loop_run(loop);
+
+ obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
+ g_assert(obj);
+
+ // Unordered list
+
+ uList = atk_object_ref_accessible_child(obj, 0);
+ g_assert(ATK_OBJECT(uList));
+ g_assert(atk_object_get_role(uList) == ATK_ROLE_LIST);
+ g_assert_cmpint(atk_object_get_n_accessible_children(uList), ==, 3);
+
+ item1 = ATK_TEXT(atk_object_ref_accessible_child(uList, 0));
+ item2 = ATK_TEXT(atk_object_ref_accessible_child(uList, 1));
+ item3 = ATK_TEXT(atk_object_ref_accessible_child(uList, 2));
+
+ g_assert_cmpint(atk_object_get_n_accessible_children(item1), ==, 0);
+ g_assert_cmpint(atk_object_get_n_accessible_children(item2), ==, 1);
+ g_assert_cmpint(atk_object_get_n_accessible_children(item3), ==, 1);
+
+ g_assert_cmpstr(atk_text_get_text(item1, 0, -1), ==, "\342\200\242 text only");
+ g_assert_cmpstr(atk_text_get_text(item2, 0, -1), ==, "\342\200\242 link only");
+ g_assert_cmpstr(atk_text_get_text(item3, 0, -1), ==, "\342\200\242 text and a link");
+
+ g_object_unref(item1);
+ g_object_unref(item2);
+ g_object_unref(item3);
+
+ // Ordered list
+
+ oList = atk_object_ref_accessible_child(obj, 1);
+ g_assert(ATK_OBJECT(oList));
+ g_assert(atk_object_get_role(oList) == ATK_ROLE_LIST);
+ g_assert_cmpint(atk_object_get_n_accessible_children(oList), ==, 3);
+
+ item1 = ATK_TEXT(atk_object_ref_accessible_child(oList, 0));
+ item2 = ATK_TEXT(atk_object_ref_accessible_child(oList, 1));
+ item3 = ATK_TEXT(atk_object_ref_accessible_child(oList, 2));
+
+ g_assert_cmpstr(atk_text_get_text(item1, 0, -1), ==, "1 text only");
+ g_assert_cmpstr(atk_text_get_text(item2, 0, -1), ==, "2 link only");
+ g_assert_cmpstr(atk_text_get_text(item3, 0, -1), ==, "3 text and a link");
+
+ g_assert_cmpint(atk_object_get_n_accessible_children(item1), ==, 0);
+ g_assert_cmpint(atk_object_get_n_accessible_children(item2), ==, 1);
+ g_assert_cmpint(atk_object_get_n_accessible_children(item3), ==, 1);
+
+ g_object_unref(item1);
+ g_object_unref(item2);
+ g_object_unref(item3);
+
+ g_object_unref(uList);
+ g_object_unref(oList);
+ g_object_unref(webView);
+}
+
int main(int argc, char** argv)
{
g_thread_init(NULL);
@@ -860,6 +937,7 @@ int main(int argc, char** argv)
g_test_add_func("/webkit/atk/getHeadersInTable", testWebkitAtkGetHeadersInTable);
g_test_add_func("/webkit/atk/textAttributes", testWebkitAtkTextAttributes);
g_test_add_func("/webkit/atk/get_extents", test_webkit_atk_get_extents);
+ g_test_add_func("/webkit/atk/listsOfItems", testWebkitAtkListsOfItems);
return g_test_run ();
}
diff --git a/WebKit/gtk/tests/testmimehandling.c b/WebKit/gtk/tests/testmimehandling.c
index 2ab0257..3a0eded 100644
--- a/WebKit/gtk/tests/testmimehandling.c
+++ b/WebKit/gtk/tests/testmimehandling.c
@@ -125,7 +125,7 @@ static gboolean mime_type_policy_decision_requested_cb(WebKitWebView* view, WebK
g_assert_cmpstr(mime_type, ==, "text/plain");
g_assert(webkit_web_view_can_show_mime_type(view, mime_type));
} else if (g_str_equal(type, "ogg")) {
- g_assert_cmpstr(mime_type, ==, "audio/ogg");
+ g_assert_cmpstr(mime_type, ==, "audio/x-vorbis+ogg");
g_assert(webkit_web_view_can_show_mime_type(view, mime_type));
}
@@ -172,7 +172,7 @@ static void test_mime_text()
static void test_mime_ogg()
{
- test_mime_type("pdf");
+ test_mime_type("ogg");
}
int main(int argc, char** argv)