Esempio n. 1
0
static void testWebkitAtkGetTextInTable(void)
{
    WebKitWebView* webView;
    AtkObject* obj;
    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, contentsInTable, 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);
    obj = atk_object_ref_accessible_child(obj, 0);
    g_assert(obj);

    /* Tables should not implement AtkText */
    g_assert(G_TYPE_INSTANCE_GET_INTERFACE(obj, ATK_TYPE_TEXT, AtkTextIface) == NULL);

    g_object_unref(obj);
    g_object_unref(webView);
}
Esempio n. 2
0
/**
 * ufo_copyable_copy:
 * @origin: A source object that implements #UfoCopyable interface.
 * @copy: A destination object that implements #UfoCopyable interface.
 *
 * Returns: (transfer full): A copy of the @origin object.
 */
UfoCopyable * ufo_copyable_copy (gpointer origin,
                                 gpointer copy)
{
    if (!origin) return NULL;
    g_return_val_if_fail(UFO_IS_COPYABLE (origin), NULL);

    // call top-level interface implementation
    UfoCopyable *_copy = UFO_COPYABLE_GET_IFACE (origin)->copy (origin, copy);
    UfoCopyableIface *current_iface = G_TYPE_INSTANCE_GET_INTERFACE(origin, UFO_TYPE_COPYABLE, UfoCopyableIface);
    UfoCopyableIface *parent_iface  = g_type_interface_peek_parent(current_iface);

    // call parental interface functions
    int nested_level = 0;
    while (parent_iface && nested_level < MAX_INHERITANCE_DEPTH) {
        current_iface = parent_iface;
        _copy = parent_iface->copy (origin, copy);
        parent_iface  = g_type_interface_peek_parent(current_iface);
    }

    return _copy;
}