summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-10-15 06:07:12 +0200
committerTimm Bäder <mail@baedert.org>2020-10-22 17:46:33 +0200
commit0dae1f48fd94ca1eed7187d1ca1f896418f33194 (patch)
tree65e5ca439c6444890b3c2f028f491e9be896031f
parentc7dbb8ef91fe9e195055f242b3330b6c658accb5 (diff)
downloadgtk+-0dae1f48fd94ca1eed7187d1ca1f896418f33194.tar.gz
listbox test: Only compare values for rows we have
This shouldn't happen, but don't compare 100 values if we didnt' get 100 values from the listbox.
-rw-r--r--testsuite/gtk/listbox.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/testsuite/gtk/listbox.c b/testsuite/gtk/listbox.c
index a5c895235c..815cf4b031 100644
--- a/testsuite/gtk/listbox.c
+++ b/testsuite/gtk/listbox.c
@@ -26,6 +26,7 @@ check_sorted (GtkListBox *list)
GtkWidget *row, *label;
int res[100];
int index, value;
+ int n_rows = 0;
int i;
for (row = gtk_widget_get_first_child (GTK_WIDGET (list));
@@ -39,10 +40,11 @@ check_sorted (GtkListBox *list)
label = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row));
value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label), "data"));
res[index] = value;
+ n_rows++;
}
- for (i = 1; i < 100; i++)
- g_assert (res[i - 1] <= res[i]);
+ for (i = 1; i < n_rows; i++)
+ g_assert_cmpint (res[i - 1], <=, res[i]);
}
static void