diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-08-30 14:56:28 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-08-30 14:56:28 +0900 |
commit | 54d44a9bd04cfbed8426614fc69c027a46f41a14 (patch) | |
tree | 34bdf65a6e8d5d6d4016154345d1d803ba0da379 /gtk/tests | |
parent | b3b22c31b997fb85b3319b392a1a69407703184c (diff) | |
parent | 67194ed77b153eb5a7eb6c596f3c20e274b7787a (diff) | |
download | gtk+-native-layout.tar.gz |
Merge branch 'master' into native-layoutnative-layout
Conflicts:
gtk/gtkplug.c
gtk/gtkscrolledwindow.c
Diffstat (limited to 'gtk/tests')
-rw-r--r-- | gtk/tests/builder.c | 22 | ||||
-rw-r--r-- | gtk/tests/testing.c | 9 | ||||
-rw-r--r-- | gtk/tests/treeview-scrolling.c | 8 |
3 files changed, 25 insertions, 14 deletions
diff --git a/gtk/tests/builder.c b/gtk/tests/builder.c index b45cc414f3..e35abd446a 100644 --- a/gtk/tests/builder.c +++ b/gtk/tests/builder.c @@ -352,7 +352,7 @@ test_uimanager_simple (void) children = gtk_container_get_children (GTK_CONTAINER (menubar)); menu = children->data; g_assert (GTK_IS_MENU_ITEM (menu)); - g_assert (strcmp (GTK_WIDGET (menu)->name, "file") == 0); + g_assert (strcmp (gtk_widget_get_name (GTK_WIDGET (menu)), "file") == 0); g_list_free (children); label = G_OBJECT (gtk_bin_get_child (GTK_BIN (menu))); @@ -1009,8 +1009,8 @@ test_children (void) button = gtk_builder_get_object (builder, "button1"); g_assert (button != NULL); g_assert (GTK_IS_BUTTON (button)); - g_assert (GTK_WIDGET(button)->parent != NULL); - g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (GTK_WIDGET (button)->parent)), "window1") == 0); + g_assert (gtk_widget_get_parent (GTK_WIDGET(button)) != NULL); + g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (gtk_widget_get_parent (GTK_WIDGET (button)))), "window1") == 0); gtk_widget_destroy (GTK_WIDGET (window)); g_object_unref (builder); @@ -1027,7 +1027,7 @@ test_children (void) content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); g_assert (vbox != NULL); g_assert (GTK_IS_VBOX (vbox)); - g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (GTK_WIDGET (vbox)->parent)), "dialog1") == 0); + g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (gtk_widget_get_parent (GTK_WIDGET (vbox)))), "dialog1") == 0); g_assert (gtk_container_get_border_width (GTK_CONTAINER (vbox)) == 10); g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (content_area)), "dialog1-vbox") == 0); @@ -1035,7 +1035,7 @@ test_children (void) dialog_action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog)); g_assert (action_area != NULL); g_assert (GTK_IS_HBUTTON_BOX (action_area)); - g_assert (GTK_WIDGET (action_area)->parent != NULL); + g_assert (gtk_widget_get_parent (GTK_WIDGET (action_area)) != NULL); g_assert (gtk_container_get_border_width (GTK_CONTAINER (action_area)) == 20); g_assert (dialog_action_area != NULL); g_assert (gtk_buildable_get_name (GTK_BUILDABLE (action_area)) != NULL); @@ -2292,7 +2292,7 @@ test_add_objects (void) menu = children->data; g_assert (menu != NULL); g_assert (GTK_IS_MENU_ITEM (menu)); - g_assert (strcmp (GTK_WIDGET (menu)->name, "file") == 0); + g_assert (strcmp (gtk_widget_get_name (GTK_WIDGET (menu)), "file") == 0); g_list_free (children); label = G_OBJECT (gtk_bin_get_child (GTK_BIN (menu))); @@ -2319,7 +2319,7 @@ test_add_objects (void) menu = children->data; g_assert (menu != NULL); g_assert (GTK_IS_MENU_ITEM (menu)); - g_assert (strcmp (GTK_WIDGET (menu)->name, "file") == 0); + g_assert (strcmp (gtk_widget_get_name (GTK_WIDGET (menu)), "file") == 0); g_list_free (children); label = G_OBJECT (gtk_bin_get_child (GTK_BIN (menu))); @@ -2333,16 +2333,18 @@ test_add_objects (void) static GtkWidget * get_parent_menubar (GtkWidget *menuitem) { - GtkMenuShell *menu_shell = (GtkMenuShell *)menuitem->parent; + GtkMenuShell *menu_shell; GtkWidget *attach = NULL; + menu_shell = GTK_MENU_SHELL (gtk_widget_get_parent (menuitem)); + g_assert (GTK_IS_MENU_SHELL (menu_shell)); while (menu_shell && !GTK_IS_MENU_BAR (menu_shell)) { if (GTK_IS_MENU (menu_shell) && (attach = gtk_menu_get_attach_widget (GTK_MENU (menu_shell))) != NULL) - menu_shell = (GtkMenuShell *)attach->parent; + menu_shell = GTK_MENU_SHELL (gtk_widget_get_parent (attach)); else menu_shell = NULL; } @@ -2477,7 +2479,7 @@ test_menus (void) item = (GtkWidget *)gtk_builder_get_object (builder, "imagemenuitem1"); custom = (GtkWidget *)gtk_builder_get_object (builder, "custom1"); - g_assert (custom->parent == item); + g_assert (gtk_widget_get_parent (custom) == item); gtk_widget_destroy (GTK_WIDGET (window)); g_object_unref (builder); diff --git a/gtk/tests/testing.c b/gtk/tests/testing.c index 85fadeff9f..c684555c15 100644 --- a/gtk/tests/testing.c +++ b/gtk/tests/testing.c @@ -132,14 +132,18 @@ test_xserver_sync (void) GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test: test_xserver_sync"); GtkWidget *darea = gtk_drawing_area_new (); GtkWidget *child; + GdkWindow *gdk_window; GTimer *gtimer = g_timer_new(); gint sync_is_slower = 0, repeat = 5; child = gtk_bin_get_child (GTK_BIN (window)); + //gdk_window = gtk_widget_get_window (darea); + gtk_widget_set_size_request (darea, 320, 200); gtk_container_add (GTK_CONTAINER (child), darea); gtk_widget_show (darea); gtk_widget_show_now (window); + while (repeat--) { gint i, many = 200; @@ -148,7 +152,8 @@ test_xserver_sync (void) while (gtk_events_pending ()) gtk_main_iteration (); - cr = gdk_cairo_create (darea->window); + gdk_window = gtk_widget_get_window (darea); + cr = gdk_cairo_create (gdk_window); cairo_set_source_rgba (cr, 0, 1, 0, 0.1); /* run a number of consecutive drawing requests, just using drawing queue */ g_timer_start (gtimer); @@ -166,7 +171,7 @@ test_xserver_sync (void) for (i = 0; i < many; i++) { cairo_paint (cr); - gdk_test_render_sync (darea->window); + gdk_test_render_sync (gdk_window); } g_timer_stop (gtimer); sync_time = g_timer_elapsed (gtimer, NULL); diff --git a/gtk/tests/treeview-scrolling.c b/gtk/tests/treeview-scrolling.c index 81dfd8d752..6b2d13c9d9 100644 --- a/gtk/tests/treeview-scrolling.c +++ b/gtk/tests/treeview-scrolling.c @@ -416,6 +416,7 @@ test_position (GtkTreeView *tree_view, /* This is only tested for during test_single() */ model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)); if (gtk_tree_model_iter_n_children (model, NULL) == 1) { + GtkAllocation allocation; GtkTreePath *tmppath; /* Test nothing is dangling at the bottom; read @@ -423,7 +424,8 @@ test_position (GtkTreeView *tree_view, */ /* FIXME: hardcoded width */ - if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree_view), 0, GTK_WIDGET (tree_view)->allocation.height - 30, &tmppath, NULL, NULL, NULL)) { + gtk_widget_get_allocation (GTK_WIDGET (tree_view), &allocation); + if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree_view), 0, allocation.height - 30, &tmppath, NULL, NULL, NULL)) { g_assert_not_reached (); gtk_tree_path_free (tmppath); } @@ -715,6 +717,7 @@ test_editable_position (GtkWidget *tree_view, GtkWidget *editable, GtkTreePath *cursor_path) { + GtkAllocation allocation; GdkRectangle rect; GtkAdjustment *vadj; @@ -724,7 +727,8 @@ test_editable_position (GtkWidget *tree_view, vadj = gtk_tree_view_get_vadjustment (GTK_TREE_VIEW (tree_view)); /* There are all in bin_window coordinates */ - g_assert (editable->allocation.y == rect.y + ((rect.height - editable->allocation.height) / 2)); + gtk_widget_get_allocation (editable, &allocation); + g_assert (allocation.y == rect.y + ((rect.height - allocation.height) / 2)); } static void |