static void load_status_cb(WebKitWebView* webView, GParamSpec* spec, gpointer data) { CopyAndPasteFixture* fixture = (CopyAndPasteFixture*)data; WebKitLoadStatus status = webkit_web_view_get_load_status(webView); if (status != WEBKIT_LOAD_FINISHED) return; GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_clipboard_clear(clipboard); webkit_web_view_copy_clipboard(webView); gchar* text = gtk_clipboard_wait_for_text(clipboard); g_assert(text || !fixture->info->expectedContent); g_assert(!text || !strcmp(text, fixture->info->expectedContent)); g_free(text); // Verify that the markup starts with the proper content-type meta tag prefix. GtkSelectionData* selectionData = gtk_clipboard_wait_for_contents(clipboard, gdk_atom_intern("text/html", FALSE)); if (selectionData) { static const char* markupPrefix = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">"; char* markup = g_strndup((const char*) gtk_selection_data_get_data(selectionData), gtk_selection_data_get_length(selectionData)); g_assert(strlen(markupPrefix) <= strlen(markup)); g_assert(!strncmp(markupPrefix, markup, strlen(markupPrefix))); g_free(markup); } g_assert(!gtk_clipboard_wait_is_uris_available(clipboard)); g_assert(!gtk_clipboard_wait_is_image_available(clipboard)); g_main_loop_quit(fixture->loop); }
static void load_status_cb(WebKitWebView* webView, GParamSpec* spec, gpointer data) { CopyAndPasteFixture* fixture = (CopyAndPasteFixture*)data; WebKitLoadStatus status = webkit_web_view_get_load_status(webView); if (status != WEBKIT_LOAD_FINISHED) return; GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_clipboard_clear(clipboard); webkit_web_view_copy_clipboard(webView); gchar* text = gtk_clipboard_wait_for_text(clipboard); g_assert(text || !fixture->info->expectedContent); g_assert(!text || !strcmp(text, fixture->info->expectedContent)); g_free(text); g_assert(!gtk_clipboard_wait_is_uris_available(clipboard)); g_assert(!gtk_clipboard_wait_is_image_available(clipboard)); g_main_loop_quit(fixture->loop); }
static VALUE rg_wait_is_image_available_p(VALUE self) { return CBOOL2RVAL(gtk_clipboard_wait_is_image_available(_SELF(self))); }