Title: [100747] trunk/Source/WebKit/gtk
Revision
100747
Author
ma...@webkit.org
Date
2011-11-18 03:46:18 -0800 (Fri, 18 Nov 2011)

Log Message

[GTK] Accessibility API tests failing because of using non-WebKit GtkWidgets
https://bugs.webkit.org/show_bug.cgi?id=72708

Reviewed by Xan Lopez.

Do not use non-WebKit GtkWidget's in unit tests, to avoid problems
when GTK's accessibility implementation is not being loaded.

* tests/testatk.c:
(testWebkitAtkParentForRootObject): Use a dummy WebKitWebView
widget as the parent container needed for this unit test.
(testWebkitAtkSetParentForObject): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebKit/gtk/ChangeLog (100746 => 100747)


--- trunk/Source/WebKit/gtk/ChangeLog	2011-11-18 11:41:10 UTC (rev 100746)
+++ trunk/Source/WebKit/gtk/ChangeLog	2011-11-18 11:46:18 UTC (rev 100747)
@@ -1,3 +1,18 @@
+2011-11-18  Mario Sanchez Prada  <msanc...@igalia.com>
+
+        [GTK] Accessibility API tests failing because of using non-WebKit GtkWidgets
+        https://bugs.webkit.org/show_bug.cgi?id=72708
+
+        Reviewed by Xan Lopez.
+
+        Do not use non-WebKit GtkWidget's in unit tests, to avoid problems
+        when GTK's accessibility implementation is not being loaded.
+
+        * tests/testatk.c:
+        (testWebkitAtkParentForRootObject): Use a dummy WebKitWebView
+        widget as the parent container needed for this unit test.
+        (testWebkitAtkSetParentForObject): Ditto.
+
 2011-11-17  Martin Robinson  <mrobin...@igalia.com>
 
         [GTK] Remove the last remaining WebKit1 gtkdoc warnings

Modified: trunk/Source/WebKit/gtk/tests/testatk.c (100746 => 100747)


--- trunk/Source/WebKit/gtk/tests/testatk.c	2011-11-18 11:41:10 UTC (rev 100746)
+++ trunk/Source/WebKit/gtk/tests/testatk.c	2011-11-18 11:46:18 UTC (rev 100747)
@@ -1612,33 +1612,23 @@
     gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation);
     webkit_web_view_load_string(webView, contents, 0, 0, 0);
 
-    /* We need a parent for the webview to check top-down and
-       bottom-up navigation among them, so create a box for it. */
-#ifdef GTK_API_VERSION_2
-    GtkWidget* box = gtk_vbox_new(FALSE, 0);
-#else
-    GtkWidget* box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
-#endif
-    g_object_ref_sink(box);
-    gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(webView), FALSE, FALSE, 0);
+    /* We need a parent container widget for the webview so use
+       another (dummy) webView as that container. */
+    GtkWidget* parentContainer = webkit_web_view_new();
+    g_object_ref_sink(parentContainer);
+    gtk_container_add(GTK_CONTAINER(parentContainer), GTK_WIDGET(webView));
 
-    AtkObject* axBox = gtk_widget_get_accessible (box);
-    g_assert(ATK_IS_OBJECT(axBox));
+    AtkObject* axParent = gtk_widget_get_accessible (parentContainer);
+    g_assert(ATK_IS_OBJECT(axParent));
 
-    AtkObject* axBoxChild = atk_object_ref_accessible_child(axBox, 0);
-    g_assert(axBoxChild);
-
     AtkObject* axRoot = gtk_widget_get_accessible(GTK_WIDGET(webView));
     g_assert(ATK_IS_OBJECT(axRoot));
 
-    /* The box's child should be the AtkObject for the WebView's root. */
-    g_assert(axBoxChild == axRoot);
+    /* Check that the parent for the webView's accessibility object is
+       the the accessibility object for the webview's parent widget. */
+    g_assert(atk_object_get_parent(axRoot) == axParent);
 
-    /* Bottom-up navigation should match top-down one. */
-    g_assert(atk_object_get_parent(axBoxChild) == axBox);
-
-    g_object_unref(axBoxChild);
-    g_object_unref(box);
+    g_object_unref(parentContainer);
 }
 
 static void testWebkitAtkSetParentForObject()
@@ -1648,35 +1638,37 @@
     gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation);
     webkit_web_view_load_string(webView, contents, 0, 0, 0);
 
-    /* Put the webview in a window to check the normal behaviour keeps
-       working as expected when the webview is inside a container. */
-    GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-    g_object_ref_sink(window);
-    gtk_container_add(GTK_CONTAINER(window), webView);
+    /* Put the webview in a parent container widget check the normal
+       behaviour keeps working as expected when the webview is inside
+       a container. We use a dummy webView for that in order not to
+       need any ATK implementation other than WebKit's one. */
+    GtkWidget* parentContainer = webkit_web_view_new();
+    g_object_ref_sink(parentContainer);
+    gtk_container_add(GTK_CONTAINER(parentContainer), GTK_WIDGET(webView));
 
     AtkObject* axRoot = gtk_widget_get_accessible(GTK_WIDGET(webView));
     g_assert(ATK_IS_OBJECT(axRoot));
 
-    AtkObject* axWindow = gtk_widget_get_accessible(window);
-    g_assert(ATK_IS_OBJECT(axWindow));
+    AtkObject* axParent = gtk_widget_get_accessible(parentContainer);
+    g_assert(ATK_IS_OBJECT(axParent));
 
-    /* The parent of the root object is the window's a11y object. */
-    g_assert(atk_object_get_parent(axRoot) == axWindow);
+    /* The parent of the root object is the parent container's a11y object. */
+    g_assert(atk_object_get_parent(axRoot) == axParent);
 
-    /* We now need to use something as a an alternative parent for
-       the a11y object associated with the root of the DOM tree. */
-    GtkWidget* button = gtk_button_new();
-    g_object_ref_sink(button);
+    /* We now need to use another AtkObject as a an alternative parent
+       for the a11y object associated with the root of the DOM tree. */
+    GtkWidget* alternativeParent = webkit_web_view_new();
+    g_object_ref_sink(alternativeParent);
 
-    AtkObject* axButton = gtk_widget_get_accessible (button);
-    g_assert(ATK_IS_OBJECT(axButton));
+    AtkObject* axAlternativeParent = gtk_widget_get_accessible (alternativeParent);
+    g_assert(ATK_IS_OBJECT(axAlternativeParent));
 
     /* Manually set the button's a11y object as the parent and check. */
-    atk_object_set_parent(axRoot, axButton);
-    g_assert(atk_object_get_parent(axRoot) == axButton);
+    atk_object_set_parent(axRoot, axAlternativeParent);
+    g_assert(atk_object_get_parent(axRoot) == axAlternativeParent);
 
-    g_object_unref(button);
-    g_object_unref(window);
+    g_object_unref(alternativeParent);
+    g_object_unref(parentContainer);
 }
 
 int main(int argc, char** argv)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to