[gtk/wip/matthiasc/popup2: 93/108] tests: Stop using gtk_window_move
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/popup2: 93/108] tests: Stop using gtk_window_move
- Date: Mon, 25 Mar 2019 21:01:14 +0000 (UTC)
commit 88e6f01ee75a6ebf06b48a62549e2dc0c05e0c06
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Mar 24 21:44:31 2019 -0400
tests: Stop using gtk_window_move
It is going away.
tests/animated-resizing.c | 4 --
tests/meson.build | 1 -
tests/testgtk.c | 48 +----------------
tests/testnotebookdnd.c | 1 -
tests/testxinerama.c | 132 ----------------------------------------------
testsuite/gtk/window.c | 100 +----------------------------------
6 files changed, 2 insertions(+), 284 deletions(-)
---
diff --git a/tests/animated-resizing.c b/tests/animated-resizing.c
index 88c300ef78..dd849a4155 100644
--- a/tests/animated-resizing.c
+++ b/tests/animated-resizing.c
@@ -207,10 +207,6 @@ main(int argc, char **argv)
monitor = gdk_display_get_primary_monitor (display);
gdk_monitor_get_geometry (monitor, &monitor_bounds);
- gtk_window_move (GTK_WINDOW (window),
- monitor_bounds.x + (monitor_bounds.width - window_width) / 2,
- monitor_bounds.y + (monitor_bounds.height - window_height) / 2);
-
gtk_widget_show (window);
gtk_main ();
diff --git a/tests/meson.build b/tests/meson.build
index 71ff372ad7..f9bba09a2f 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -89,7 +89,6 @@ gtk_tests = [
['testtreesort'],
['testverticalcells'],
['treestoretest'],
- ['testxinerama'],
['testgrouping'],
['testtooltips'],
['testexpand'],
diff --git a/tests/testgtk.c b/tests/testgtk.c
index ab22813c20..ab5bf82be7 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -5253,14 +5253,8 @@ size_allocate_callback (GtkWidget *widget,
{
GtkWidget *label = data;
gchar *msg;
- gint x, y;
- gtk_window_get_position (GTK_WINDOW (widget), &x, &y);
-
- msg = g_strdup_printf ("size: %d x %d\n"
- "position: %d, %d",
- allocation->width, allocation->height,
- x, y);
+ msg = g_strdup_printf ("size: %d x %d\n", allocation->width, allocation->height);
gtk_label_set_text (GTK_LABEL (label), msg);
@@ -5333,31 +5327,6 @@ set_size_request_callback (GtkWidget *widget,
w, h);
}
-static void
-set_location_callback (GtkWidget *widget,
- gpointer data)
-{
- gint x, y;
-
- get_ints (data, &x, &y);
-
- gtk_window_move (g_object_get_data (data, "target"), x, y);
-}
-
-static void
-move_to_position_callback (GtkWidget *widget,
- gpointer data)
-{
- gint x, y;
- GtkWindow *window;
-
- window = g_object_get_data (data, "target");
-
- gtk_window_get_position (window, &x, &y);
-
- gtk_window_move (window, x, y);
-}
-
static void
resizable_callback (GtkWidget *widget,
gpointer data)
@@ -5478,20 +5447,6 @@ window_controls (GtkWidget *window)
control_window);
gtk_container_add (GTK_CONTAINER (vbox), button);
- button = gtk_button_new_with_label ("Move");
- g_signal_connect (button,
- "clicked",
- G_CALLBACK (set_location_callback),
- control_window);
- gtk_container_add (GTK_CONTAINER (vbox), button);
-
- button = gtk_button_new_with_label ("Move to current position");
- g_signal_connect (button,
- "clicked",
- G_CALLBACK (move_to_position_callback),
- control_window);
- gtk_container_add (GTK_CONTAINER (vbox), button);
-
button = gtk_check_button_new_with_label ("Allow resize");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_signal_connect (button,
@@ -6613,7 +6568,6 @@ create_main_window (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (window, "main_window");
- gtk_window_move (GTK_WINDOW (window), 50, 20);
gtk_window_set_default_size (GTK_WINDOW (window), -1, 400);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
diff --git a/tests/testnotebookdnd.c b/tests/testnotebookdnd.c
index 13b2806585..543b8186f3 100644
--- a/tests/testnotebookdnd.c
+++ b/tests/testnotebookdnd.c
@@ -79,7 +79,6 @@ window_creation_function (GtkNotebook *source_notebook,
gtk_container_add (GTK_CONTAINER (window), notebook);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
- gtk_window_move (GTK_WINDOW (window), x, y);
gtk_widget_show (window);
return GTK_NOTEBOOK (notebook);
diff --git a/testsuite/gtk/window.c b/testsuite/gtk/window.c
index bb8310c787..186570983e 100644
--- a/testsuite/gtk/window.c
+++ b/testsuite/gtk/window.c
@@ -190,18 +190,13 @@ static void
test_resize_popup (void)
{
GtkWidget *window;
- gint x, y, w, h;
+ gint w, h;
/* testcase for the dnd window */
window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_display (GTK_WINDOW (window), gdk_display_get_default ());
gtk_window_resize (GTK_WINDOW (window), 1, 1);
- gtk_window_move (GTK_WINDOW (window), -99, -99);
-
- gtk_window_get_position (GTK_WINDOW (window), &x, &y);
gtk_window_get_size (GTK_WINDOW (window), &w, &h);
- g_assert_cmpint (x, ==, -99);
- g_assert_cmpint (y, ==, -99);
g_assert_cmpint (w, ==, 1);
g_assert_cmpint (h, ==, 1);
@@ -210,10 +205,7 @@ test_resize_popup (void)
g_timeout_add (200, stop_main, NULL);
gtk_main ();
- gtk_window_get_position (GTK_WINDOW (window), &x, &y);
gtk_window_get_size (GTK_WINDOW (window), &w, &h);
- g_assert_cmpint (x, ==, -99);
- g_assert_cmpint (y, ==, -99);
g_assert_cmpint (w, ==, 1);
g_assert_cmpint (h, ==, 1);
@@ -260,94 +252,6 @@ test_show_hide (void)
gtk_widget_destroy (window);
}
-static void
-test_show_hide2 (void)
-{
- GtkWidget *window;
- gint x, y, w, h, w1, h1;
-
- g_test_bug ("696882");
-
- /* test that hide/show does not affect the size,
- * even when get_position/move is called
- */
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_widget_show (window);
-
- g_timeout_add (100, stop_main, NULL);
- gtk_main ();
-
- gtk_window_get_position (GTK_WINDOW (window), &x, &y);
- gtk_window_get_size (GTK_WINDOW (window), &w, &h);
- gtk_widget_hide (window);
-
- g_timeout_add (100, stop_main, NULL);
- gtk_main ();
-
- gtk_window_get_size (GTK_WINDOW (window), &w1, &h1);
- g_assert_cmpint (w, ==, w1);
- g_assert_cmpint (h, ==, h1);
-
- gtk_window_move (GTK_WINDOW (window), x, y);
- gtk_widget_show (window);
-
- g_timeout_add (100, stop_main, NULL);
- gtk_main ();
-
- gtk_window_get_size (GTK_WINDOW (window), &w1, &h1);
- g_assert_cmpint (w, ==, w1);
- g_assert_cmpint (h, ==, h1);
-
- gtk_widget_destroy (window);
-}
-
-static void
-test_show_hide3 (void)
-{
- GtkWidget *window;
- gint x, y, w, h, w1, h1;
-
- g_test_bug ("696882");
-
- /* test that hide/show does not affect the size,
- * even when get_position/move is called and
- * a default size is set
- */
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
-
- gtk_widget_show (window);
-
- g_timeout_add (100, stop_main, NULL);
- gtk_main ();
-
- gtk_window_get_position (GTK_WINDOW (window), &x, &y);
- gtk_window_get_size (GTK_WINDOW (window), &w, &h);
- gtk_widget_hide (window);
-
- g_timeout_add (100, stop_main, NULL);
- gtk_main ();
-
- gtk_window_get_size (GTK_WINDOW (window), &w1, &h1);
- g_assert_cmpint (w, ==, w1);
- g_assert_cmpint (h, ==, h1);
-
- gtk_window_move (GTK_WINDOW (window), x, y);
- gtk_widget_show (window);
-
- g_timeout_add (100, stop_main, NULL);
- gtk_main ();
-
- gtk_window_get_size (GTK_WINDOW (window), &w1, &h1);
- g_assert_cmpint (w, ==, w1);
- g_assert_cmpint (h, ==, h1);
-
- gtk_widget_destroy (window);
-}
-
int
main (int argc, char *argv[])
{
@@ -366,8 +270,6 @@ main (int argc, char *argv[])
g_test_add_func ("/window/resize", test_resize);
g_test_add_func ("/window/resize-popup", test_resize_popup);
g_test_add_func ("/window/show-hide", test_show_hide);
- g_test_add_func ("/window/show-hide2", test_show_hide2);
- g_test_add_func ("/window/show-hide3", test_show_hide3);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]