[webkit-help] Need help on how to build and run AccessibilityTestServer.cpp

xiaoxu xiaoxulian at qq.com
Thu Apr 7 23:18:28 PDT 2016


Hi all,
I want to know how the browser work, so I try to compile and run the file AccessibilityTestServer.cpp.
But I don't know how to build this file, is there any notes on how to use the test files?


This file location is  /Tools/TestWebKitAPI/Tests/WebKit2Gtk/AccessibilityTestServer.cpp.


The content of this file is this:
#include "config.h"


#include <gtk/gtk.h>
#include <webkit2/webkit2.h>


static void loadChangedCallback(WebKitWebView*, WebKitLoadEvent loadEvent, gpointer)
{
    // Send a message to the parent process when we're ready.
    if (loadEvent == WEBKIT_LOAD_FINISHED)
        g_print("OK");
}


int main(int argc, char** argv)
{
    // Make sure that the ATK bridge is loaded.
    g_setenv("GTK_MODULES", "atk-bridge", TRUE);


    gtk_init(&argc, &argv);


    WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
    webkit_web_view_load_html(webView,
        "<html>"
        "  <body>"
        "   <h1>This is a test</h1>"
        "   <p>This is a paragraph with some plain text.</p>"
        "   <p>This paragraph contains <a href=\"http://www.webkitgtk.org\">a link</a> in the middle.</p>"
        "  </body>"
        "</html>",
        0);


    GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(webView));
    gtk_widget_show_all(window);


    g_signal_connect(window, "delete-event", G_CALLBACK(gtk_main_quit), 0);
    g_signal_connect(webView, "load-changed", G_CALLBACK(loadChangedCallback), 0);


    gtk_main();
}

------------------
Xiaoxu Lian 廉晓旭tel:18601749056
xiaoxulian at qq.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-help/attachments/20160408/a5ce40fd/attachment.html>


More information about the webkit-help mailing list