Lines Matching defs:fixture
65 static void key_event_fixture_setup(KeyEventFixture* fixture, gconstpointer data)
67 fixture->loop = g_main_loop_new(NULL, TRUE);
69 fixture->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
70 fixture->webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
72 gtk_container_add(GTK_CONTAINER(fixture->window), GTK_WIDGET(fixture->webView));
75 static void key_event_fixture_teardown(KeyEventFixture* fixture, gconstpointer data)
77 gtk_widget_destroy(fixture->window);
78 g_main_loop_unref(fixture->loop);
79 test_info_destroy(fixture->info);
84 KeyEventFixture* fixture = (KeyEventFixture*)data;
85 gboolean handled = GTK_WIDGET_GET_CLASS(fixture->webView)->key_press_event(GTK_WIDGET(fixture->webView), &event->key);
86 g_assert_cmpint(handled, ==, fixture->info->shouldBeHandled);
94 KeyEventFixture* fixture = (KeyEventFixture*)data;
95 gboolean handled = GTK_WIDGET_GET_CLASS(fixture->webView)->key_press_event(GTK_WIDGET(fixture->webView), &event->key);
98 g_main_loop_quit(fixture->loop);
105 KeyEventFixture* fixture = (KeyEventFixture*)data;
108 g_signal_connect(fixture->webView, "key-press-event",
109 G_CALLBACK(key_press_event_cb), fixture);
110 g_signal_connect(fixture->webView, "key-release-event",
111 G_CALLBACK(key_release_event_cb), fixture);
112 if (!gtk_test_widget_send_key(GTK_WIDGET(fixture->webView),
122 KeyEventFixture* fixture = (KeyEventFixture*)data;
123 webkit_web_view_load_string(fixture->webView, fixture->info->page,
128 static void setup_keyevent_test(KeyEventFixture* fixture, gconstpointer data, GCallback load_event_callback)
130 fixture->info = (TestInfo*)data;
131 g_signal_connect(fixture->window, "map-event",
132 G_CALLBACK(map_event_cb), fixture);
134 gtk_widget_show(fixture->window);
135 gtk_widget_show(GTK_WIDGET(fixture->webView));
136 gtk_window_present(GTK_WINDOW(fixture->window));
138 g_signal_connect(fixture->webView, "notify::load-status",
139 load_event_callback, fixture);
141 g_main_loop_run(fixture->loop);
144 static void test_keypress_events(KeyEventFixture* fixture, gconstpointer data)
146 setup_keyevent_test(fixture, data, G_CALLBACK(test_keypress_events_load_status_cb));
181 KeyEventFixture* fixture = (KeyEventFixture*)data;
206 g_main_loop_quit(fixture->loop);
209 static void test_ime(KeyEventFixture* fixture, gconstpointer data)
211 setup_keyevent_test(fixture, data, G_CALLBACK(test_ime_load_status_cb));
216 KeyEventFixture* fixture = (KeyEventFixture*)data;
218 webkit_web_view_get_main_frame(fixture->webView));
221 g_assert(element_text_equal_to(context, fixture->info->text));
222 g_main_loop_quit(fixture->loop);
228 KeyEventFixture* fixture = (KeyEventFixture*)data;
234 fixture->info->text = g_strdup("bc");
235 if (!gtk_test_widget_send_key(GTK_WIDGET(fixture->webView),
238 if (!gtk_test_widget_send_key(GTK_WIDGET(fixture->webView),
241 if (!gtk_test_widget_send_key(GTK_WIDGET(fixture->webView),
245 g_idle_add(verify_contents, fixture);
248 static void test_blocking(KeyEventFixture* fixture, gconstpointer data)
250 setup_keyevent_test(fixture, data, G_CALLBACK(test_blocking_load_status_cb));
256 KeyEventFixture* fixture = (KeyEventFixture*)data;
271 fixture->info->text = g_strdup("debian");
272 if (!gtk_test_widget_send_key(GTK_WIDGET(fixture->webView),
275 if (!gtk_test_widget_send_key(GTK_WIDGET(fixture->webView),
278 if (!gtk_test_widget_send_key(GTK_WIDGET(fixture->webView),
281 if (!gtk_test_widget_send_key(GTK_WIDGET(fixture->webView),
284 if (!gtk_test_widget_send_key(GTK_WIDGET(fixture->webView),
287 if (!gtk_test_widget_send_key(GTK_WIDGET(fixture->webView),
295 g_idle_add(verify_contents, fixture);
298 static void test_xim(KeyEventFixture* fixture, gconstpointer data)
300 setup_keyevent_test(fixture, data, G_CALLBACK(test_xim_load_status_cb));