]> Pileus Git - ~andy/gtk/commitdiff
tests: Fix height checks in treeview scrolling test
authorBenjamin Otte <otte@redhat.com>
Mon, 6 Feb 2012 18:50:11 +0000 (19:50 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 6 Feb 2012 19:43:05 +0000 (20:43 +0100)
If things get centered in the scrolling area depens on the height of the
row, too.

gtk/tests/treeview-scrolling.c

index 3e28d4b274425e42a550a05b883e9b234e11c2d3..0c123f9a030ea4446dd0b388afbd1cb63f453c55 100644 (file)
@@ -350,7 +350,7 @@ assert_position_with_align (GtkTreeView  *tree_view,
        case 1:
                /* 0.5 */
                if (pos == POS_TOP
-                   && row_start < gtk_adjustment_get_page_size (vadjustment) / 2) {
+                   && row_start < (gtk_adjustment_get_page_size (vadjustment) - row_height) / 2) {
                        /* For the first half of the top view we can't
                         * center the row in the view, instead we
                         * show the first page.
@@ -358,7 +358,7 @@ assert_position_with_align (GtkTreeView  *tree_view,
                         */
                        g_assert (gtk_adjustment_get_value (vadjustment) == 0);
                } else if (pos == POS_BOTTOM
-                          && row_start >= gtk_adjustment_get_upper (vadjustment) - gtk_adjustment_get_page_size (vadjustment) / 2) {
+                          && row_start + row_height >= gtk_adjustment_get_upper (vadjustment) - (gtk_adjustment_get_page_size (vadjustment) - row_height) / 2) {
                        /* For the last half of the bottom view we
                         * can't center the row in the view, instead
                         * we show the last page.
@@ -375,7 +375,7 @@ assert_position_with_align (GtkTreeView  *tree_view,
                         *      (ie. the row's center is at the
                         *       center of the view).
                         */
-                       gdouble middle = gtk_adjustment_get_page_size (vadjustment) / 2 - row_height / 2;
+                       gdouble middle = (gtk_adjustment_get_page_size (vadjustment) - row_height) / 2.0;
                        g_assert (row_y == ceil (middle) || row_y == floor (middle));
                }
                break;