Пример #1
0
int main(int argc, char** argv)
{
    g_thread_init(NULL);
    gtk_test_init(&argc, &argv, NULL);

    g_test_bug_base("https://bugs.webkit.org/");

    g_test_add("/webkit/keyevent/textfield", KeyEventFixture,
               test_info_new("<html><body><input id=\"in\" type=\"text\">"
                             "<script>document.getElementById('in').focus();"
                             "</script></body></html>", TRUE),
               key_event_fixture_setup,
               test_keypress,
               key_event_fixture_teardown);

    g_test_add("/webkit/keyevent/buttons", KeyEventFixture,
               test_info_new("<html><body><input id=\"in\" type=\"button\">"
                             "<script>document.getElementById('in').focus();"
                             "</script></body></html>", FALSE),
               key_event_fixture_setup,
               test_keypress,
               key_event_fixture_teardown);

    g_test_add("/webkit/keyevent/link", KeyEventFixture,
               test_info_new("<html><body><a href=\"http://www.gnome.org\" id=\"in\">"
                             "LINKY MCLINKERSON</a><script>"
                             "document.getElementById('in').focus();</script>"
                             "</body></html>", FALSE),
               key_event_fixture_setup,
               test_keypress,
               key_event_fixture_teardown);

    return g_test_run();
}
Пример #2
0
int main(int argc, char** argv)
{
    g_thread_init(NULL);
    gtk_test_init(&argc, &argv, NULL);

    g_test_bug_base("https://bugs.webkit.org/");
    const char* selected_span_html = "<html><body>"
        "<span id=\"mainspan\">All work and no play <span>make Jack a dull</span> boy.</span>"
        "<script>document.getSelection().collapse();\n"
        "document.getSelection().selectAllChildren(document.getElementById('mainspan'));\n"
        "</script></body></html>";
    const char* no_selection_html = "<html><body>"
        "<span id=\"mainspan\">All work and no play <span>make Jack a dull</span> boy</span>"
        "<script>document.getSelection().collapse();\n"
        "</script></body></html>";

    g_test_add("/webkit/copyandpaste/selection", CopyAndPasteFixture,
               test_info_new(selected_span_html, "All work and no play make Jack a dull boy."),
               copy_and_paste_fixture_setup,
               test_copy_and_paste,
               copy_and_paste_fixture_teardown);
    g_test_add("/webkit/copyandpaste/no-selection", CopyAndPasteFixture,
               test_info_new(no_selection_html, 0),
               copy_and_paste_fixture_setup,
               test_copy_and_paste,
               copy_and_paste_fixture_teardown);

    return g_test_run();
}
Пример #3
0
int main(int argc, char** argv)
{
    gtk_test_init(&argc, &argv, NULL);

    g_test_bug_base("https://bugs.webkit.org/");

    g_test_add("/webkit/hittestresult/document", HitTestResultFixture, 
               test_info_new("<html><body><h1>WebKitGTK+!</h1></body></html>",
                             WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT),
               hit_test_result_fixture_setup, test_webkit_hit_test_result, hit_test_result_fixture_teardown);
    /* We hardcode all elements to be at 0,0 so that we know where to
     * generate the button events */
    g_test_add("/webkit/hittestresult/image", HitTestResultFixture,
               test_info_new("<html><body><img style='position:absolute; left:0; top:0'src='0xdeadbeef' width=50 height=50></img></body></html>",
                             WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE),
               hit_test_result_fixture_setup, test_webkit_hit_test_result, hit_test_result_fixture_teardown);
    g_test_add("/webkit/hittestresult/editable", HitTestResultFixture,
               test_info_new("<html><body><input style='position:absolute; left:0; top:0' size='35'></input>></body></html>",
                             WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE),
               hit_test_result_fixture_setup, test_webkit_hit_test_result, hit_test_result_fixture_teardown);
    g_test_add("/webkit/hittestresult/link", HitTestResultFixture,
               test_info_new("<html><body><a style='position:absolute; left:0; top:0' href='http://www.example.com'>HELLO WORLD</a></body></html>",
                             WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK),
               hit_test_result_fixture_setup, test_webkit_hit_test_result, hit_test_result_fixture_teardown);
               
    return g_test_run ();
}
int main(int argc, char** argv)
{
    gtk_test_init(&argc, &argv, NULL);

    g_test_bug_base("https://bugs.webkit.org/");


    // We'll test input on a slew of different node types. Key events to
    // text inputs and editable divs should be marked as handled. Key events
    // to buttons and links should not.
    const char* textinput_html = "<html><body><input id=\"in\" type=\"text\">"
        "<script>document.getElementById('in').focus();</script></body></html>";
    const char* button_html = "<html><body><input id=\"in\" type=\"button\">"
        "<script>document.getElementById('in').focus();</script></body></html>";
    const char* link_html = "<html><body><a href=\"http://www.gnome.org\" id=\"in\">"
        "LINKY MCLINKERSON</a><script>document.getElementById('in').focus();</script>"
        "</body></html>";
    const char* div_html = "<html><body><div id=\"in\" contenteditable=\"true\">"
        "<script>document.getElementById('in').focus();</script></body></html>";

    // These are similar to the blocks above, but they should block the first
    // keypress modifying the editable node.
    const char* textinput_html_blocking = "<html><body>"
        "<input id=\"in\" type=\"text\" "
        "onkeypress=\"if (first) {event.preventDefault();first=false;}\">"
        "<script>first = true;\ndocument.getElementById('in').focus();</script>\n"
        "</script></body></html>";
    const char* div_html_blocking = "<html><body>"
        "<div id=\"in\" contenteditable=\"true\" "
        "onkeypress=\"if (first) {event.preventDefault();first=false;}\">"
        "<script>first = true; document.getElementById('in').focus();</script>\n"
        "</script></body></html>";

    g_test_add("/webkit/keyevents/event-textinput", KeyEventFixture,
               test_info_new(textinput_html, TRUE),
               key_event_fixture_setup,
               test_keypress_events,
               key_event_fixture_teardown);
    g_test_add("/webkit/keyevents/event-buttons", KeyEventFixture,
               test_info_new(button_html, FALSE),
               key_event_fixture_setup,
               test_keypress_events,
               key_event_fixture_teardown);
    g_test_add("/webkit/keyevents/event-link", KeyEventFixture,
               test_info_new(link_html, FALSE),
               key_event_fixture_setup,
               test_keypress_events,
               key_event_fixture_teardown);
    g_test_add("/webkit/keyevent/event-div", KeyEventFixture,
               test_info_new(div_html, TRUE),
               key_event_fixture_setup,
               test_keypress_events,
               key_event_fixture_teardown);
    g_test_add("/webkit/keyevent/ime-textinput", KeyEventFixture,
               test_info_new(textinput_html, TRUE),
               key_event_fixture_setup,
               test_ime,
               key_event_fixture_teardown);
    g_test_add("/webkit/keyevent/ime-div", KeyEventFixture,
               test_info_new(div_html, TRUE),
               key_event_fixture_setup,
               test_ime,
               key_event_fixture_teardown);
    g_test_add("/webkit/keyevent/block-textinput", KeyEventFixture,
               test_info_new(textinput_html_blocking, TRUE),
               key_event_fixture_setup,
               test_blocking,
               key_event_fixture_teardown);
    g_test_add("/webkit/keyevent/block-div", KeyEventFixture,
               test_info_new(div_html_blocking, TRUE),
               key_event_fixture_setup,
               test_blocking,
               key_event_fixture_teardown);
#if defined(GDK_WINDOWING_X11)
    g_test_add("/webkit/keyevent/xim-textinput", KeyEventFixture,
               test_info_new(textinput_html, TRUE),
               key_event_fixture_setup,
               test_xim,
               key_event_fixture_teardown);
    g_test_add("/webkit/keyevent/xim-div", KeyEventFixture,
               test_info_new(div_html, TRUE),
               key_event_fixture_setup,
               test_xim,
               key_event_fixture_teardown);
#endif

    return g_test_run();
}