testsuite: Reduce the use of g_assert

Stop using g_assert() in the gtk tests.
This commit is contained in:
Matthias Clasen 2021-04-12 16:12:25 -04:00
parent 4d1075a082
commit 8c156e6b80
47 changed files with 1421 additions and 1423 deletions

View File

@ -28,31 +28,32 @@ test_one_accel (const char *accel,
GdkModifierType mods;
guint *keycodes;
char *label, *name;
gboolean ret;
accel_key = 0;
g_assert (gtk_accelerator_parse_with_keycode (accel,
ret = gtk_accelerator_parse_with_keycode (accel,
gdk_display_get_default (),
&accel_key,
&keycodes,
&mods));
&mods);
g_assert_true (ret);
if (has_keysym)
{
guint accel_key_2;
GdkModifierType mods_2;
g_assert (gtk_accelerator_parse (accel,
&accel_key_2,
&mods_2));
g_assert (accel_key == accel_key_2);
g_assert (mods == mods_2);
ret = gtk_accelerator_parse (accel, &accel_key_2, &mods_2);
g_assert_true (ret);
g_assert_true (accel_key == accel_key_2);
g_assert_true (mods == mods_2);
}
if (has_keysym)
g_assert (accel_key == exp_key);
g_assert (mods == exp_mods);
g_assert (keycodes);
g_assert (keycodes[0] != 0);
g_assert_true (accel_key == exp_key);
g_assert_true (mods == exp_mods);
g_assert_nonnull (keycodes);
g_assert_true (keycodes[0] != 0);
label = gtk_accelerator_get_label_with_keycode (NULL,
accel_key,
@ -123,7 +124,7 @@ accel8 (void)
static void
keysyms (void)
{
g_assert (gdk_keyval_from_name ("KP_7") == GDK_KEY_KP_7);
g_assert_cmpuint (gdk_keyval_from_name ("KP_7"), ==, GDK_KEY_KP_7);
}
int

View File

@ -676,7 +676,7 @@ test_introspection (void)
if (strcmp (expected[i].name, name) == 0)
{
found++;
g_assert (expected[i].owner == owner);
g_assert_true (expected[i].owner == owner);
g_assert_cmpstr (expected[i].name, ==, name);
g_assert_cmpstr (expected[i].params, ==, params ? g_variant_type_peek_string (params) : NULL);
g_assert_cmpstr (expected[i].property, ==, property);
@ -687,7 +687,7 @@ test_introspection (void)
g_error ("Unexpected GtkText action: %s", name);
j++;
}
g_assert (found == G_N_ELEMENTS (expected));
g_assert_cmpuint (found, ==, G_N_ELEMENTS (expected));
g_type_class_unref (class);
}

File diff suppressed because it is too large Load Diff

View File

@ -36,8 +36,8 @@ test_iconview_new (void)
view = gtk_icon_view_new ();
area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
g_assert (GTK_IS_CELL_AREA_BOX (area));
g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == gtk_icon_view_get_item_orientation (GTK_ICON_VIEW (view)));
g_assert_true (GTK_IS_CELL_AREA_BOX (area));
g_assert_true (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == gtk_icon_view_get_item_orientation (GTK_ICON_VIEW (view)));
g_object_ref_sink (view);
g_object_unref (view);
@ -52,7 +52,7 @@ test_iconview_new_with_area (void)
area = gtk_cell_area_box_new ();
view = gtk_icon_view_new_with_area (area);
g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area);
g_assert_true (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area);
g_object_ref_sink (view);
g_object_unref (view);
@ -68,8 +68,8 @@ test_iconview_object_new (void)
area = gtk_cell_area_box_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_HORIZONTAL);
view = g_object_new (GTK_TYPE_ICON_VIEW, "cell-area", area, NULL);
g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area);
g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == gtk_icon_view_get_item_orientation (GTK_ICON_VIEW (view)));
g_assert_true (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area);
g_assert_true (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == gtk_icon_view_get_item_orientation (GTK_ICON_VIEW (view)));
g_object_ref_sink (view);
g_object_unref (view);
@ -85,7 +85,7 @@ test_combobox_new (void)
view = gtk_combo_box_new ();
area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
g_assert (GTK_IS_CELL_AREA_BOX (area));
g_assert_true (GTK_IS_CELL_AREA_BOX (area));
g_object_ref_sink (view);
g_object_unref (view);
@ -117,8 +117,8 @@ my_combo_box_init (MyComboBox *view)
else if (subclass_init == 1)
{
area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
g_assert (GTK_IS_CELL_AREA_BOX (area));
g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL);
g_assert_true (GTK_IS_CELL_AREA_BOX (area));
g_assert_cmpint (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)), ==, GTK_ORIENTATION_HORIZONTAL);
gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_VERTICAL);
}
}
@ -134,8 +134,8 @@ test_combobox_subclass0 (void)
view = g_object_new (my_combo_box_get_type (), NULL);
area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
g_assert (GTK_IS_CELL_AREA_BOX (area));
g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL);
g_assert_true (GTK_IS_CELL_AREA_BOX (area));
g_assert_cmpint (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)), ==, GTK_ORIENTATION_HORIZONTAL);
g_object_ref_sink (view);
g_object_unref (view);
@ -152,8 +152,8 @@ test_combobox_subclass2 (void)
view = g_object_new (my_combo_box_get_type (), NULL);
area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
g_assert (GTK_IS_CELL_AREA_BOX (area));
g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL);
g_assert_true (GTK_IS_CELL_AREA_BOX (area));
g_assert_cmpint (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)), ==, GTK_ORIENTATION_VERTICAL);
g_object_ref_sink (view);
g_object_unref (view);
@ -169,7 +169,7 @@ test_cellview_new (void)
view = gtk_cell_view_new ();
area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
g_assert (GTK_IS_CELL_AREA_BOX (area));
g_assert_true (GTK_IS_CELL_AREA_BOX (area));
g_object_ref_sink (view);
g_object_unref (view);
@ -186,7 +186,7 @@ test_cellview_new_with_context (void)
area = gtk_cell_area_box_new ();
context = gtk_cell_area_create_context (area);
view = gtk_cell_view_new_with_context (area, context);
g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area);
g_assert_true (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area);
g_object_ref_sink (view);
g_object_unref (view);
@ -202,7 +202,7 @@ test_cellview_object_new (void)
area = gtk_cell_area_box_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_HORIZONTAL);
view = g_object_new (GTK_TYPE_CELL_VIEW, "cell-area", area, NULL);
g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area);
g_assert_true (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area);
g_object_ref_sink (view);
g_object_unref (view);
@ -218,7 +218,7 @@ test_column_new (void)
col = gtk_tree_view_column_new ();
area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (col));
g_assert (GTK_IS_CELL_AREA_BOX (area));
g_assert_true (GTK_IS_CELL_AREA_BOX (area));
g_object_ref_sink (col);
g_object_unref (col);
@ -233,7 +233,7 @@ test_column_new_with_area (void)
area = gtk_cell_area_box_new ();
col = gtk_tree_view_column_new_with_area (area);
g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (col)) == area);
g_assert_true (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (col)) == area);
g_object_ref_sink (col);
g_object_unref (col);
@ -249,7 +249,7 @@ test_column_object_new (void)
area = gtk_cell_area_box_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_HORIZONTAL);
col = g_object_new (GTK_TYPE_TREE_VIEW_COLUMN, "cell-area", area, NULL);
g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (col)) == area);
g_assert_true (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (col)) == area);
g_object_ref_sink (col);
g_object_unref (col);
@ -265,7 +265,7 @@ test_completion_new (void)
c = gtk_entry_completion_new ();
area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c));
g_assert (GTK_IS_CELL_AREA_BOX (area));
g_assert_true (GTK_IS_CELL_AREA_BOX (area));
g_object_ref_sink (c);
g_object_unref (c);
@ -280,7 +280,7 @@ test_completion_new_with_area (void)
area = gtk_cell_area_box_new ();
c = gtk_entry_completion_new_with_area (area);
g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c)) == area);
g_assert_true (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c)) == area);
g_object_ref_sink (c);
g_object_unref (c);
@ -296,7 +296,7 @@ test_completion_object_new (void)
area = gtk_cell_area_box_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_HORIZONTAL);
c = g_object_new (GTK_TYPE_ENTRY_COMPLETION, "cell-area", area, NULL);
g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c)) == area);
g_assert_true (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c)) == area);
g_object_ref_sink (c);
g_object_unref (c);

View File

@ -6,7 +6,7 @@ assert_section_is_not_null (GtkCssProvider *provider,
const GError *error,
gpointer unused)
{
g_assert (section != NULL);
g_assert_nonnull (section);
}
static void

View File

@ -14,7 +14,7 @@ main (int argc, char **argv)
display_name = g_getenv ("DISPLAY");
g_unsetenv ("DISPLAY");
has_display = gtk_init_check ();
g_assert (!has_display);
g_assert_false (has_display);
display = gdk_display_open (display_name);

View File

@ -37,12 +37,14 @@ test_property (void)
GtkExpressionWatch *watch;
GtkStringFilter *filter;
guint counter = 0;
gboolean ret;
filter = gtk_string_filter_new (NULL);
expr = gtk_property_expression_new (GTK_TYPE_STRING_FILTER, NULL, "search");
watch = gtk_expression_watch (expr, filter, inc_counter, &counter, NULL);
g_assert (gtk_expression_evaluate (expr, filter, &value));
ret = gtk_expression_evaluate (expr, filter, &value);
g_assert_true (ret);
g_assert_cmpstr (g_value_get_string (&value), ==, NULL);
g_value_unset (&value);
@ -50,7 +52,8 @@ test_property (void)
g_assert_cmpint (counter, ==, 1);
counter = 0;
g_assert (gtk_expression_evaluate (expr, filter , &value));
ret = gtk_expression_evaluate (expr, filter , &value);
g_assert_true (ret);
g_assert_cmpstr (g_value_get_string (&value), ==, "Hello World");
g_value_unset (&value);
@ -92,6 +95,7 @@ test_cclosure (void)
GtkExpressionWatch *watch;
GtkStringFilter *filter;
guint counter = 0;
gboolean ret;
filter = GTK_STRING_FILTER (gtk_string_filter_new (NULL));
pexpr[0] = gtk_property_expression_new (GTK_TYPE_STRING_FILTER, NULL, "search");
@ -106,19 +110,22 @@ test_cclosure (void)
NULL);
watch = gtk_expression_watch (expr, filter, inc_counter, &counter, NULL);
g_assert (gtk_expression_evaluate (expr, filter, &value));
ret = gtk_expression_evaluate (expr, filter, &value);
g_assert_true (ret);
g_assert_cmpstr (g_value_get_string (&value), ==, "OK");
g_value_unset (&value);
gtk_string_filter_set_search (filter, "Hello World");
g_assert_cmpint (counter, ==, 1);
g_assert (gtk_expression_evaluate (expr, filter , &value));
ret = gtk_expression_evaluate (expr, filter , &value);
g_assert_true (ret);
g_assert_cmpstr (g_value_get_string (&value), ==, "OK");
g_value_unset (&value);
gtk_string_filter_set_ignore_case (filter, FALSE);
g_assert_cmpint (counter, ==, 2);
g_assert (gtk_expression_evaluate (expr, filter , &value));
ret = gtk_expression_evaluate (expr, filter , &value);
g_assert_true (ret);
g_assert_cmpstr (g_value_get_string (&value), ==, "OK");
g_value_unset (&value);
@ -126,7 +133,8 @@ test_cclosure (void)
gtk_string_filter_set_ignore_case (filter, TRUE);
gtk_string_filter_set_match_mode (filter, GTK_STRING_FILTER_MATCH_MODE_EXACT);
g_assert_cmpint (counter, ==, 5);
g_assert (gtk_expression_evaluate (expr, filter , &value));
ret = gtk_expression_evaluate (expr, filter , &value);
g_assert_true (ret);
g_assert_cmpstr (g_value_get_string (&value), ==, "OK");
g_value_unset (&value);
@ -149,10 +157,12 @@ test_closure (void)
GValue value = G_VALUE_INIT;
GtkExpression *expr;
GClosure *closure;
gboolean ret;
closure = g_cclosure_new (G_CALLBACK (make_string), NULL, NULL);
expr = gtk_closure_expression_new (G_TYPE_STRING, closure, 0, NULL);
g_assert (gtk_expression_evaluate (expr, NULL, &value));
ret = gtk_expression_evaluate (expr, NULL, &value);
g_assert_true (ret);
g_assert_cmpstr (g_value_get_string (&value), ==, "Hello");
g_value_unset (&value);
@ -585,7 +595,7 @@ test_nested_bind (void)
/* check that the expressions evaluate correctly */
res = gtk_expression_evaluate (filter_expr, NULL, &value);
g_assert_true (res);
g_assert (g_value_get_object (&value) == filter3);
g_assert_true (g_value_get_object (&value) == filter3);
g_value_unset (&value);
res = gtk_expression_evaluate (expr, NULL, &value);

View File

@ -29,7 +29,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
guint ret;
g_assert (object != NULL);
g_assert_nonnull (object);
ret = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
g_object_unref (object);
return ret;
@ -50,7 +50,7 @@ append_digit (GString *s,
if (digit == 0)
return;
g_assert (digit < 10);
g_assert_cmpint (digit, <, 10);
if (s->len)
g_string_append_c (s, ' ');
@ -97,7 +97,7 @@ get_spelled_out (gpointer object)
guint n = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
GString *s;
g_assert (n < 1000000);
g_assert_cmpint (n, <, 1000000);
if (n == 0)
return g_strdup ("Zero");
@ -147,7 +147,7 @@ add (GListStore *store,
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));

View File

@ -30,7 +30,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
guint number;
g_assert (object != NULL);
g_assert_nonnull (object);
number = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
g_object_unref (object);
return number;
@ -64,7 +64,7 @@ add (GListStore *store,
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));
@ -120,7 +120,7 @@ items_changed (GListModel *model,
guint added,
GString *changes)
{
g_assert (removed != 0 || added != 0);
g_assert_true (removed != 0 || added != 0);
if (changes->len)
g_string_append (changes, ", ");

View File

@ -6799,8 +6799,8 @@ test_row_changed (void)
gtk_list_store_set (store, &iter2, 0, 1, -1);
gtk_list_store_set (store, &iter3, 0, 1, -1);
g_assert (row_changed_count == 3);
g_assert (filter_row_changed_count == 0);
g_assert_cmpint (row_changed_count, ==, 3);
g_assert_cmpint (filter_row_changed_count, ==, 0);
row_changed_count = 0;
filter_row_changed_count = 0;
@ -6813,8 +6813,8 @@ test_row_changed (void)
gtk_list_store_set (store, &iter2, 0, 2, -1);
gtk_list_store_set (store, &iter3, 0, 2, -1);
g_assert (row_changed_count == 3);
g_assert (filter_row_changed_count == 3);
g_assert_cmpint (row_changed_count, ==, 3);
g_assert_cmpint (filter_row_changed_count, ==, 3);
gtk_tree_model_unref_node (filter, &fiter1);
gtk_tree_model_unref_node (filter, &fiter2);

View File

@ -30,7 +30,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
guint number;
g_assert (object != NULL);
g_assert_nonnull (object);
number = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
g_object_unref (object);
return number;
@ -70,7 +70,7 @@ splice (GListStore *store,
for (i = 0; i < added; i++)
{
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (numbers[i] != 0);
g_assert_cmpint (numbers[i], !=, 0);
objects[i] = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (objects[i], number_quark, GUINT_TO_POINTER (numbers[i]));
}
@ -89,7 +89,7 @@ insert (GListStore *store,
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));
@ -104,7 +104,7 @@ add (GListStore *store,
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));
@ -170,7 +170,7 @@ items_changed (GListModel *model,
guint added,
GString *changes)
{
g_assert (removed != 0 || added != 0);
g_assert_true (removed != 0 || added != 0);
if (changes->len)
g_string_append (changes, ", ");

View File

@ -29,20 +29,20 @@ floating_tests (void)
GtkWidget *widget = g_object_new (GTK_TYPE_LABEL, NULL);
g_object_connect (widget, "signal::destroy", destroy, NULL, NULL);
g_assert (g_object_is_floating (widget));
g_assert_true (g_object_is_floating (widget));
g_object_ref_sink (widget);
g_assert (!g_object_is_floating (widget));
g_assert_false (g_object_is_floating (widget));
g_object_force_floating (G_OBJECT (widget));
g_assert (g_object_is_floating (widget));
g_assert_true (g_object_is_floating (widget));
g_object_ref_sink (widget);
g_assert (!g_object_is_floating (widget));
g_assert_false (g_object_is_floating (widget));
g_assert (!destroyed);
g_assert_false (destroyed);
g_object_unref (widget);
g_assert (destroyed);
g_assert_true (destroyed);
}
int

View File

@ -163,8 +163,8 @@ gtk_tree_model_ref_count_unref_node (GtkTreeModel *model,
GtkTreeModelRefCount *ref_model = GTK_TREE_MODEL_REF_COUNT (model);
info = g_hash_table_lookup (ref_model->priv->node_hash, iter->user_data);
g_assert (info != NULL);
g_assert (info->ref_count > 0);
g_assert_nonnull (info);
g_assert_cmpint (info->ref_count, >, 0);
info->ref_count--;
}
@ -238,7 +238,7 @@ check_iter (GtkTreeModelRefCount *ref_model,
NodeInfo *info;
if (may_assert)
g_assert (gtk_tree_store_iter_is_valid (GTK_TREE_STORE (ref_model), iter));
g_assert_true (gtk_tree_store_iter_is_valid (GTK_TREE_STORE (ref_model), iter));
info = g_hash_table_lookup (ref_model->priv->node_hash, iter->user_data);
if (!info)

View File

@ -99,7 +99,7 @@ assert_icon_lookup_size (const char *icon_name,
}
else
{
g_assert (path == NULL);
g_assert_null (path);
}
g_free (path);
@ -131,7 +131,7 @@ assert_icon_lookup_fails (const char *icon_name,
info = gtk_icon_theme_lookup_icon (get_test_icontheme (FALSE), icon_name, NULL, size, 1, direction, flags);
/* We never truly *fail*, but check that we got the image-missing fallback */
g_assert (info != NULL);
g_assert_nonnull (info);
g_assert_cmpstr (gtk_icon_paintable_get_icon_name (info), ==, "image-missing");
}
@ -192,7 +192,7 @@ assert_lookup_order (const char *icon_name,
gtk_set_debug_flags (debug_flags | GTK_DEBUG_ICONTHEME);
g_log_set_writer_func (log_writer, NULL, NULL);
g_assert (lookups == NULL);
g_assert_null (lookups);
if (fallbacks)
{
@ -214,12 +214,12 @@ assert_lookup_order (const char *icon_name,
l = lookups;
while (s != NULL)
{
g_assert (l != NULL);
g_assert_nonnull (l);
g_assert_cmpstr (s, ==, l->data);
s = va_arg (args, char *);
l = l->next;
}
g_assert (l == NULL);
g_assert_null (l);
va_end (args);
g_list_free_full (lookups, g_free);
@ -661,31 +661,31 @@ test_list (void)
theme = get_test_icontheme (TRUE);
icons = gtk_icon_theme_get_icon_names (theme);
g_assert (g_strv_contains ((const char * const *)icons, "size-test"));
g_assert (g_strv_contains ((const char * const *)icons, "simple"));
g_assert (g_strv_contains ((const char * const *)icons, "twosize-fixed"));
g_assert (g_strv_contains ((const char * const *)icons, "twosize"));
g_assert (g_strv_contains ((const char * const *)icons, "only32-symbolic"));
g_assert (g_strv_contains ((const char * const *)icons, "everything"));
g_assert (g_strv_contains ((const char * const *)icons, "everything-rtl"));
g_assert (g_strv_contains ((const char * const *)icons, "everything-symbolic"));
g_assert (g_strv_contains ((const char * const *)icons, "everything-justregular"));
g_assert (g_strv_contains ((const char * const *)icons, "everything-justrtl-rtl"));
g_assert (g_strv_contains ((const char * const *)icons, "everything-symbolic-rtl"));
g_assert (g_strv_contains ((const char * const *)icons, "everything-justsymbolic-symbolic"));
g_assert_true (g_strv_contains ((const char * const *)icons, "size-test"));
g_assert_true (g_strv_contains ((const char * const *)icons, "simple"));
g_assert_true (g_strv_contains ((const char * const *)icons, "twosize-fixed"));
g_assert_true (g_strv_contains ((const char * const *)icons, "twosize"));
g_assert_true (g_strv_contains ((const char * const *)icons, "only32-symbolic"));
g_assert_true (g_strv_contains ((const char * const *)icons, "everything"));
g_assert_true (g_strv_contains ((const char * const *)icons, "everything-rtl"));
g_assert_true (g_strv_contains ((const char * const *)icons, "everything-symbolic"));
g_assert_true (g_strv_contains ((const char * const *)icons, "everything-justregular"));
g_assert_true (g_strv_contains ((const char * const *)icons, "everything-justrtl-rtl"));
g_assert_true (g_strv_contains ((const char * const *)icons, "everything-symbolic-rtl"));
g_assert_true (g_strv_contains ((const char * const *)icons, "everything-justsymbolic-symbolic"));
g_assert (gtk_icon_theme_has_icon (theme, "size-test"));
g_assert (gtk_icon_theme_has_icon (theme, "simple"));
g_assert (gtk_icon_theme_has_icon (theme, "twosize-fixed"));
g_assert (gtk_icon_theme_has_icon (theme, "twosize"));
g_assert (gtk_icon_theme_has_icon (theme, "only32-symbolic"));
g_assert (gtk_icon_theme_has_icon (theme, "everything"));
g_assert (gtk_icon_theme_has_icon (theme, "everything-rtl"));
g_assert (gtk_icon_theme_has_icon (theme, "everything-symbolic"));
g_assert (gtk_icon_theme_has_icon (theme, "everything-justregular"));
g_assert (gtk_icon_theme_has_icon (theme, "everything-justrtl-rtl"));
g_assert (gtk_icon_theme_has_icon (theme, "everything-symbolic-rtl"));
g_assert (gtk_icon_theme_has_icon (theme, "everything-justsymbolic-symbolic"));
g_assert_true (gtk_icon_theme_has_icon (theme, "size-test"));
g_assert_true (gtk_icon_theme_has_icon (theme, "simple"));
g_assert_true (gtk_icon_theme_has_icon (theme, "twosize-fixed"));
g_assert_true (gtk_icon_theme_has_icon (theme, "twosize"));
g_assert_true (gtk_icon_theme_has_icon (theme, "only32-symbolic"));
g_assert_true (gtk_icon_theme_has_icon (theme, "everything"));
g_assert_true (gtk_icon_theme_has_icon (theme, "everything-rtl"));
g_assert_true (gtk_icon_theme_has_icon (theme, "everything-symbolic"));
g_assert_true (gtk_icon_theme_has_icon (theme, "everything-justregular"));
g_assert_true (gtk_icon_theme_has_icon (theme, "everything-justrtl-rtl"));
g_assert_true (gtk_icon_theme_has_icon (theme, "everything-symbolic-rtl"));
g_assert_true (gtk_icon_theme_has_icon (theme, "everything-justsymbolic-symbolic"));
g_strfreev (icons);
}
@ -779,8 +779,8 @@ test_nonsquare_symbolic (void)
/* the original dimensions have been preserved */
gsk_render_node_get_bounds (node, &bounds);
g_assert (bounds.size.width == width);
g_assert (bounds.size.height == height);
g_assert_cmpint (bounds.size.width, ==, width);
g_assert_cmpint (bounds.size.height, ==, height);
gsk_render_node_unref (node);
g_free (path);

View File

@ -119,7 +119,7 @@ test_selection (void)
gtk_widget_show (GTK_WIDGET (list));
g_assert_cmpint (gtk_list_box_get_selection_mode (list), ==, GTK_SELECTION_SINGLE);
g_assert (gtk_list_box_get_selected_row (list) == NULL);
g_assert_null (gtk_list_box_get_selected_row (list));
for (i = 0; i < 100; i++)
{
@ -136,39 +136,39 @@ test_selection (void)
&count);
row = gtk_list_box_get_row_at_index (list, 20);
g_assert (!gtk_list_box_row_is_selected (row));
g_assert_false (gtk_list_box_row_is_selected (row));
gtk_list_box_select_row (list, row);
g_assert (gtk_list_box_row_is_selected (row));
g_assert (callback_row == row);
g_assert_true (gtk_list_box_row_is_selected (row));
g_assert_true (callback_row == row);
g_assert_cmpint (count, ==, 1);
row2 = gtk_list_box_get_selected_row (list);
g_assert (row2 == row);
g_assert_true (row2 == row);
gtk_list_box_unselect_all (list);
row2 = gtk_list_box_get_selected_row (list);
g_assert (row2 == NULL);
g_assert_null (row2);
gtk_list_box_select_row (list, row);
row2 = gtk_list_box_get_selected_row (list);
g_assert (row2 == row);
g_assert_true (row2 == row);
gtk_list_box_set_selection_mode (list, GTK_SELECTION_BROWSE);
gtk_list_box_remove (GTK_LIST_BOX (list), GTK_WIDGET (row));
g_assert (callback_row == NULL);
g_assert_null (callback_row);
g_assert_cmpint (count, ==, 4);
row2 = gtk_list_box_get_selected_row (list);
g_assert (row2 == NULL);
g_assert_null (row2);
row = gtk_list_box_get_row_at_index (list, 20);
gtk_list_box_select_row (list, row);
g_assert (gtk_list_box_row_is_selected (row));
g_assert (callback_row == row);
g_assert_true (gtk_list_box_row_is_selected (row));
g_assert_true (callback_row == row);
g_assert_cmpint (count, ==, 5);
gtk_list_box_set_selection_mode (list, GTK_SELECTION_NONE);
g_assert (!gtk_list_box_row_is_selected (row));
g_assert (callback_row == NULL);
g_assert_false (gtk_list_box_row_is_selected (row));
g_assert_null (callback_row);
g_assert_cmpint (count, ==, 6);
row2 = gtk_list_box_get_selected_row (list);
g_assert (row2 == NULL);
g_assert_null (row2);
row = gtk_list_box_get_row_at_index (list, 20);
index = gtk_list_box_row_get_index (row);
@ -207,7 +207,7 @@ test_multi_selection (void)
gtk_widget_show (GTK_WIDGET (list));
g_assert_cmpint (gtk_list_box_get_selection_mode (list), ==, GTK_SELECTION_SINGLE);
g_assert (gtk_list_box_get_selected_rows (list) == NULL);
g_assert_null (gtk_list_box_get_selected_rows (list));
gtk_list_box_set_selection_mode (list, GTK_SELECTION_MULTIPLE);
@ -232,39 +232,39 @@ test_multi_selection (void)
l = gtk_list_box_get_selected_rows (list);
g_assert_cmpint (g_list_length (l), ==, 100);
g_list_free (l);
g_assert (gtk_list_box_row_is_selected (row));
g_assert_true (gtk_list_box_row_is_selected (row));
gtk_list_box_unselect_all (list);
g_assert_cmpint (count, ==, 2);
l = gtk_list_box_get_selected_rows (list);
g_assert (l == NULL);
g_assert (!gtk_list_box_row_is_selected (row));
g_assert_null (l);
g_assert_false (gtk_list_box_row_is_selected (row));
gtk_list_box_select_row (list, row);
g_assert (gtk_list_box_row_is_selected (row));
g_assert_true (gtk_list_box_row_is_selected (row));
g_assert_cmpint (count, ==, 3);
l = gtk_list_box_get_selected_rows (list);
g_assert_cmpint (g_list_length (l), ==, 1);
g_assert (l->data == row);
g_assert_true (l->data == row);
g_list_free (l);
row2 = gtk_list_box_get_row_at_index (list, 40);
g_assert (!gtk_list_box_row_is_selected (row2));
g_assert_false (gtk_list_box_row_is_selected (row2));
gtk_list_box_select_row (list, row2);
g_assert (gtk_list_box_row_is_selected (row2));
g_assert_true (gtk_list_box_row_is_selected (row2));
g_assert_cmpint (count, ==, 4);
l = gtk_list_box_get_selected_rows (list);
g_assert_cmpint (g_list_length (l), ==, 2);
g_assert (l->data == row);
g_assert (l->next->data == row2);
g_assert_true (l->data == row);
g_assert_true (l->next->data == row2);
g_list_free (l);
gtk_list_box_unselect_row (list, row);
g_assert (!gtk_list_box_row_is_selected (row));
g_assert_false (gtk_list_box_row_is_selected (row));
g_assert_cmpint (count, ==, 5);
l = gtk_list_box_get_selected_rows (list);
g_assert_cmpint (g_list_length (l), ==, 1);
g_assert (l->data == row2);
g_assert_true (l->data == row2);
g_list_free (l);
g_object_unref (list);
@ -321,7 +321,7 @@ test_filter (void)
gtk_widget_show (GTK_WIDGET (list));
g_assert_cmpint (gtk_list_box_get_selection_mode (list), ==, GTK_SELECTION_SINGLE);
g_assert (gtk_list_box_get_selected_row (list) == NULL);
g_assert_null (gtk_list_box_get_selected_row (list));
for (i = 0; i < 100; i++)
{
@ -413,7 +413,7 @@ test_header (void)
gtk_widget_show (GTK_WIDGET (list));
g_assert_cmpint (gtk_list_box_get_selection_mode (list), ==, GTK_SELECTION_SINGLE);
g_assert (gtk_list_box_get_selected_row (list) == NULL);
g_assert_null (gtk_list_box_get_selected_row (list));
for (i = 0; i < 100; i++)
{

View File

@ -125,8 +125,8 @@ check_model (ListStore *fixture,
gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store),
&iter, path);
g_assert (gtk_list_store_iter_is_valid (fixture->store, &iter));
g_assert (iters_equal (&iter, &fixture->iter[new_order[i]]));
g_assert_true (gtk_list_store_iter_is_valid (fixture->store, &iter));
g_assert_true (iters_equal (&iter, &fixture->iter[new_order[i]]));
gtk_tree_path_next (path);
}
@ -145,36 +145,36 @@ list_store_test_insert_high_values (void)
store = gtk_list_store_new (1, G_TYPE_INT);
gtk_list_store_insert (store, &iter, 1234);
g_assert (gtk_list_store_iter_is_valid (store, &iter));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 1);
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_list_store_iter_is_valid (store, &iter));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 1);
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
gtk_list_store_insert (store, &iter2, 765);
g_assert (gtk_list_store_iter_is_valid (store, &iter2));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 2);
g_assert_true (gtk_list_store_iter_is_valid (store, &iter2));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 2);
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -189,36 +189,36 @@ list_store_test_append (void)
store = gtk_list_store_new (1, G_TYPE_INT);
gtk_list_store_append (store, &iter);
g_assert (gtk_list_store_iter_is_valid (store, &iter));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 1);
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_list_store_iter_is_valid (store, &iter));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 1);
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
gtk_list_store_append (store, &iter2);
g_assert (gtk_list_store_iter_is_valid (store, &iter2));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 2);
g_assert_true (gtk_list_store_iter_is_valid (store, &iter2));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 2);
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -233,36 +233,36 @@ list_store_test_prepend (void)
store = gtk_list_store_new (1, G_TYPE_INT);
gtk_list_store_prepend (store, &iter);
g_assert (gtk_list_store_iter_is_valid (store, &iter));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 1);
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_list_store_iter_is_valid (store, &iter));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 1);
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
gtk_list_store_prepend (store, &iter2);
g_assert (gtk_list_store_iter_is_valid (store, &iter2));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 2);
g_assert_true (gtk_list_store_iter_is_valid (store, &iter2));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 2);
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 1));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 1));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -280,40 +280,40 @@ list_store_test_insert_after (void)
gtk_list_store_append (store, &iter2);
gtk_list_store_insert_after (store, &iter3, &iter);
g_assert (gtk_list_store_iter_is_valid (store, &iter3));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 3);
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter3, 1));
g_assert_true (gtk_list_store_iter_is_valid (store, &iter3));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 3);
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter3, 1));
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter_copy, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter_copy, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 1));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter_copy, 2));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 2));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 2));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 2));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 2));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 2));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter3, 1));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter3, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -331,32 +331,32 @@ list_store_test_insert_after_NULL (void)
/* move_after NULL is basically a prepend */
gtk_list_store_insert_after (store, &iter2, NULL);
g_assert (gtk_list_store_iter_is_valid (store, &iter2));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 2);
g_assert_true (gtk_list_store_iter_is_valid (store, &iter2));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 2);
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 1));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 0));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 0));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 1));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -374,43 +374,43 @@ list_store_test_insert_before (void)
gtk_list_store_append (store, &iter2);
gtk_list_store_insert_before (store, &iter3, &iter2);
g_assert (gtk_list_store_iter_is_valid (store, &iter3));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 3);
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter3, 1));
g_assert_true (gtk_list_store_iter_is_valid (store, &iter3));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 3);
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter3, 1));
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter_copy, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter_copy, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 1));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter_copy, 2));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 2));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 2));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 2));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 2));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 2));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter3, 1));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter3, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -428,29 +428,29 @@ list_store_test_insert_before_NULL (void)
/* move_before NULL is basically an append */
gtk_list_store_insert_before (store, &iter2, NULL);
g_assert (gtk_list_store_iter_is_valid (store, &iter2));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 2);
g_assert_true (gtk_list_store_iter_is_valid (store, &iter2));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 2);
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -486,9 +486,9 @@ list_store_test_remove_begin (ListStore *fixture,
gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store), &iter, path);
gtk_tree_path_free (path);
g_assert (gtk_list_store_remove (fixture->store, &iter) == TRUE);
g_assert (!gtk_list_store_iter_is_valid (fixture->store, &fixture->iter[0]));
g_assert (iters_equal (&iter, &fixture->iter[1]));
g_assert_true (gtk_list_store_remove (fixture->store, &iter));
g_assert_false (gtk_list_store_iter_is_valid (fixture->store, &fixture->iter[0]));
g_assert_true (iters_equal (&iter, &fixture->iter[1]));
check_model (fixture, new_order, 0);
}
@ -506,9 +506,9 @@ list_store_test_remove_middle (ListStore *fixture,
gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store), &iter, path);
gtk_tree_path_free (path);
g_assert (gtk_list_store_remove (fixture->store, &iter) == TRUE);
g_assert (!gtk_list_store_iter_is_valid (fixture->store, &fixture->iter[2]));
g_assert (iters_equal (&iter, &fixture->iter[3]));
g_assert_true (gtk_list_store_remove (fixture->store, &iter));
g_assert_false (gtk_list_store_iter_is_valid (fixture->store, &fixture->iter[2]));
g_assert_true (iters_equal (&iter, &fixture->iter[3]));
check_model (fixture, new_order, 2);
}
@ -526,8 +526,8 @@ list_store_test_remove_end (ListStore *fixture,
gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store), &iter, path);
gtk_tree_path_free (path);
g_assert (gtk_list_store_remove (fixture->store, &iter) == FALSE);
g_assert (!gtk_list_store_iter_is_valid (fixture->store, &fixture->iter[4]));
g_assert_false (gtk_list_store_remove (fixture->store, &iter));
g_assert_false (gtk_list_store_iter_is_valid (fixture->store, &fixture->iter[4]));
check_model (fixture, new_order, 4);
}
@ -540,10 +540,10 @@ list_store_test_clear (ListStore *fixture,
gtk_list_store_clear (fixture->store);
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (fixture->store), NULL) == 0);
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (fixture->store), NULL), ==, 0);
for (i = 0; i < 5; i++)
g_assert (!gtk_list_store_iter_is_valid (fixture->store, &fixture->iter[i]));
g_assert_true (!gtk_list_store_iter_is_valid (fixture->store, &fixture->iter[i]));
}
/* reorder */
@ -570,8 +570,8 @@ list_store_test_swap_begin (ListStore *fixture,
GtkTreeIter iter_a;
GtkTreeIter iter_b;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "0"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "1"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "0"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "1"));
gtk_list_store_swap (fixture->store, &iter_a, &iter_b);
check_model (fixture, new_order, -1);
@ -587,8 +587,8 @@ list_store_test_swap_middle_next (ListStore *fixture,
GtkTreeIter iter_a;
GtkTreeIter iter_b;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "2"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "3"));
gtk_list_store_swap (fixture->store, &iter_a, &iter_b);
check_model (fixture, new_order, -1);
@ -604,8 +604,8 @@ list_store_test_swap_middle_apart (ListStore *fixture,
GtkTreeIter iter_a;
GtkTreeIter iter_b;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "1"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "1"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "3"));
gtk_list_store_swap (fixture->store, &iter_a, &iter_b);
check_model (fixture, new_order, -1);
@ -621,8 +621,8 @@ list_store_test_swap_end (ListStore *fixture,
GtkTreeIter iter_a;
GtkTreeIter iter_b;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "3"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "4"));
gtk_list_store_swap (fixture->store, &iter_a, &iter_b);
check_model (fixture, new_order, -1);
@ -645,9 +645,9 @@ list_store_test_swap_single (void)
iter_copy = iter;
gtk_list_store_swap (store, &iter, &iter);
g_assert (iters_equal (&iter, &iter_copy));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert (iters_equal (&iter, &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert_true (iters_equal (&iter, &iter_copy));
g_object_unref (store);
}
@ -664,8 +664,8 @@ list_store_test_move_after_from_start (ListStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "0"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "0"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
gtk_list_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -681,8 +681,8 @@ list_store_test_move_after_next (ListStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
gtk_list_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -698,8 +698,8 @@ list_store_test_move_after_apart (ListStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "1"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "1"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
gtk_list_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -715,8 +715,8 @@ list_store_test_move_after_end (ListStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "4"));
gtk_list_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -732,8 +732,8 @@ list_store_test_move_after_from_end (ListStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "1"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "1"));
gtk_list_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -751,8 +751,8 @@ list_store_test_move_after_change_ends (ListStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "0"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "0"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "4"));
gtk_list_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -767,7 +767,7 @@ list_store_test_move_after_NULL (ListStore *fixture,
GtkTreeIter iter;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
gtk_list_store_move_after (fixture->store, &iter, NULL);
check_model (fixture, new_order, -1);
@ -790,14 +790,14 @@ list_store_test_move_after_single (void)
iter_copy = iter;
gtk_list_store_move_after (store, &iter, NULL);
g_assert (iters_equal (&iter, &iter_copy));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert (iters_equal (&iter, &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert_true (iters_equal (&iter, &iter_copy));
gtk_list_store_move_after (store, &iter, &iter);
g_assert (iters_equal (&iter, &iter_copy));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert (iters_equal (&iter, &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert_true (iters_equal (&iter, &iter_copy));
g_object_unref (store);
}
@ -814,8 +814,8 @@ list_store_test_move_before_next (ListStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "3"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
gtk_list_store_move_before (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -831,8 +831,8 @@ list_store_test_move_before_apart (ListStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "1"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "1"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
gtk_list_store_move_before (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -848,8 +848,8 @@ list_store_test_move_before_to_start (ListStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "0"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "0"));
gtk_list_store_move_before (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -865,8 +865,8 @@ list_store_test_move_before_from_end (ListStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
gtk_list_store_move_before (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -882,8 +882,8 @@ list_store_test_move_before_change_ends (ListStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "0"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "0"));
gtk_list_store_move_before (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -898,7 +898,7 @@ list_store_test_move_before_NULL (ListStore *fixture,
GtkTreeIter iter;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
gtk_list_store_move_before (fixture->store, &iter, NULL);
check_model (fixture, new_order, -1);
@ -921,14 +921,14 @@ list_store_test_move_before_single (void)
iter_copy = iter;
gtk_list_store_move_before (store, &iter, NULL);
g_assert (iters_equal (&iter, &iter_copy));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert (iters_equal (&iter, &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert_true (iters_equal (&iter, &iter_copy));
gtk_list_store_move_before (store, &iter, &iter);
g_assert (iters_equal (&iter, &iter_copy));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert (iters_equal (&iter, &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert_true (iters_equal (&iter, &iter_copy));
g_object_unref (store);
}
@ -944,10 +944,10 @@ list_store_test_iter_previous_invalid (ListStore *fixture,
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (fixture->store), &iter);
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (fixture->store),
&iter) == FALSE);
g_assert (gtk_list_store_iter_is_valid (fixture->store, &iter) == FALSE);
g_assert (iter.stamp == 0);
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (fixture->store),
&iter));
g_assert_false (gtk_list_store_iter_is_valid (fixture->store, &iter));
g_assert_true (iter.stamp == 0);
}
static void
@ -961,10 +961,10 @@ list_store_test_iter_next_invalid (ListStore *fixture,
gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store), &iter, path);
gtk_tree_path_free (path);
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store),
&iter) == FALSE);
g_assert (gtk_list_store_iter_is_valid (fixture->store, &iter) == FALSE);
g_assert (iter.stamp == 0);
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store),
&iter));
g_assert_false (gtk_list_store_iter_is_valid (fixture->store, &iter));
g_assert_true (iter.stamp == 0);
}
static void
@ -974,12 +974,12 @@ list_store_test_iter_children_invalid (ListStore *fixture,
GtkTreeIter iter, child;
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (fixture->store), &iter);
g_assert (gtk_list_store_iter_is_valid (fixture->store, &iter) == TRUE);
g_assert_true (gtk_list_store_iter_is_valid (fixture->store, &iter));
g_assert (gtk_tree_model_iter_children (GTK_TREE_MODEL (fixture->store),
&child, &iter) == FALSE);
g_assert (gtk_list_store_iter_is_valid (fixture->store, &child) == FALSE);
g_assert (child.stamp == 0);
g_assert_false (gtk_tree_model_iter_children (GTK_TREE_MODEL (fixture->store),
&child, &iter));
g_assert_false (gtk_list_store_iter_is_valid (fixture->store, &child));
g_assert_true (child.stamp == 0);
}
static void
@ -989,12 +989,12 @@ list_store_test_iter_nth_child_invalid (ListStore *fixture,
GtkTreeIter iter, child;
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (fixture->store), &iter);
g_assert (gtk_list_store_iter_is_valid (fixture->store, &iter) == TRUE);
g_assert_true (gtk_list_store_iter_is_valid (fixture->store, &iter));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (fixture->store),
&child, &iter, 0) == FALSE);
g_assert (gtk_list_store_iter_is_valid (fixture->store, &child) == FALSE);
g_assert (child.stamp == 0);
g_assert_false (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (fixture->store),
&child, &iter, 0));
g_assert_false (gtk_list_store_iter_is_valid (fixture->store, &child));
g_assert_true (child.stamp == 0);
}
static void
@ -1004,12 +1004,12 @@ list_store_test_iter_parent_invalid (ListStore *fixture,
GtkTreeIter iter, child;
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (fixture->store), &child);
g_assert (gtk_list_store_iter_is_valid (fixture->store, &child) == TRUE);
g_assert_true (gtk_list_store_iter_is_valid (fixture->store, &child));
g_assert (gtk_tree_model_iter_parent (GTK_TREE_MODEL (fixture->store),
&iter, &child) == FALSE);
g_assert (gtk_list_store_iter_is_valid (fixture->store, &iter) == FALSE);
g_assert (iter.stamp == 0);
g_assert_false (gtk_tree_model_iter_parent (GTK_TREE_MODEL (fixture->store),
&iter, &child));
g_assert_false (gtk_list_store_iter_is_valid (fixture->store, &iter));
g_assert_true (iter.stamp == 0);
}

View File

@ -4,9 +4,12 @@
static void
test_init (void)
{
g_assert (gtk_is_initialized () == FALSE);
g_assert (gtk_init_check ());
g_assert (gtk_is_initialized () == TRUE);
gboolean ret;
g_assert_false (gtk_is_initialized ());
ret = gtk_init_check ();
g_assert_true (ret);
g_assert_true (gtk_is_initialized ());
}
static void

View File

@ -30,7 +30,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
guint number;
g_assert (object != NULL);
g_assert_nonnull (object);
number = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
g_object_unref (object);
return number;
@ -71,7 +71,7 @@ splice (GListStore *store,
for (i = 0; i < added; i++)
{
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (numbers[i] != 0);
g_assert_true (numbers[i] != 0);
objects[i] = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (objects[i], number_quark, GUINT_TO_POINTER (numbers[i]));
}
@ -90,7 +90,7 @@ add (GListStore *store,
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));
@ -141,7 +141,7 @@ items_changed (GListModel *model,
guint added,
GString *changes)
{
g_assert (removed != 0 || added != 0);
g_assert_true (removed != 0 || added != 0);
if (changes->len)
g_string_append (changes, ", ");

View File

@ -549,7 +549,7 @@ test_row_reference_list_remove (void)
gtk_tree_store_remove (GTK_TREE_STORE (model), &iter2);
g_assert (!gtk_tree_model_get_iter_first (model, &iter0));
g_assert_false (gtk_tree_model_get_iter_first (model, &iter0));
gtk_tree_row_reference_free (row_ref);

View File

@ -30,7 +30,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
guint ret;
g_assert (object != NULL);
g_assert_nonnull (object);
ret = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
g_object_unref (object);
return ret;
@ -82,7 +82,7 @@ make_object (guint number)
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));
@ -201,7 +201,7 @@ items_changed (GListModel *model,
guint added,
GString *changes)
{
g_assert (removed != 0 || added != 0);
g_assert_true (removed != 0 || added != 0);
if (changes->len)
g_string_append (changes, ", ");

View File

@ -37,7 +37,7 @@ main_loop_quit_cb (gpointer data)
g_main_context_wakeup (NULL);
g_assert (finalized);
g_assert_true (finalized);
return FALSE;
}
@ -98,7 +98,7 @@ test_finalize_object (gconstpointer data)
}
else
object = g_object_new (test_type, NULL);
g_assert (G_IS_OBJECT (object));
g_assert_true (G_IS_OBJECT (object));
/* Make sure we have the only reference */
if (g_object_is_floating (object))

View File

@ -23,52 +23,52 @@ test_parse (void)
GtkPaperSize *p;
p = gtk_paper_size_new (GTK_PAPER_NAME_A4);
g_assert (p != NULL);
g_assert_nonnull (p);
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_MM), ==, 210);
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_MM), ==, 297);
g_assert_cmpstr (gtk_paper_size_get_name (p), ==, "iso_a4");
g_assert_cmpstr (gtk_paper_size_get_display_name (p), ==, "A4");
g_assert_cmpstr (gtk_paper_size_get_ppd_name (p), ==, "A4");
g_assert (!gtk_paper_size_is_custom (p));
g_assert_false (gtk_paper_size_is_custom (p));
gtk_paper_size_free (p);
p = gtk_paper_size_new (GTK_PAPER_NAME_B5);
g_assert (p != NULL);
g_assert_nonnull (p);
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_MM), ==, 176);
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_MM), ==, 250);
g_assert_cmpstr (gtk_paper_size_get_name (p), ==, "iso_b5");
g_assert_cmpstr (gtk_paper_size_get_display_name (p), ==, "B5");
g_assert_cmpstr (gtk_paper_size_get_ppd_name (p), ==, "ISOB5");
g_assert (!gtk_paper_size_is_custom (p));
g_assert_false (gtk_paper_size_is_custom (p));
gtk_paper_size_free (p);
p = gtk_paper_size_new (GTK_PAPER_NAME_EXECUTIVE);
g_assert (p != NULL);
g_assert_nonnull (p);
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_MM), ==, 184);
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_MM), ==, 266);
g_assert_cmpstr (gtk_paper_size_get_name (p), ==, "na_executive");
g_assert_cmpstr (gtk_paper_size_get_display_name (p), ==, "Executive");
g_assert_cmpstr (gtk_paper_size_get_ppd_name (p), ==, "Executive");
g_assert (!gtk_paper_size_is_custom (p));
g_assert_false (gtk_paper_size_is_custom (p));
gtk_paper_size_free (p);
p = gtk_paper_size_new ("iso_a4_210x297mm");
g_assert (p != NULL);
g_assert_nonnull (p);
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_MM), ==, 210);
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_MM), ==, 297);
g_assert_cmpstr (gtk_paper_size_get_name (p), ==, "iso_a4");
g_assert_cmpstr (gtk_paper_size_get_display_name (p), ==, "A4");
g_assert_cmpstr (gtk_paper_size_get_ppd_name (p), ==, "A4");
g_assert (!gtk_paper_size_is_custom (p));
g_assert_false (gtk_paper_size_is_custom (p));
gtk_paper_size_free (p);
p = gtk_paper_size_new ("custom_w1_20x30in");
g_assert (p != NULL);
g_assert_nonnull (p);
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_INCH), ==, 20);
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_INCH), ==, 30);
g_assert_cmpstr (gtk_paper_size_get_name (p), ==, "custom_w1");
g_assert_cmpstr (gtk_paper_size_get_display_name (p), ==, "custom_w1");
g_assert (gtk_paper_size_is_custom (p));
g_assert_true (gtk_paper_size_is_custom (p));
gtk_paper_size_free (p);
}
@ -82,10 +82,10 @@ test_compare (void)
b = gtk_paper_size_new (GTK_PAPER_NAME_B5);
c = gtk_paper_size_new ("custom_w1_20x30in");
g_assert (gtk_paper_size_is_equal (a1, a2));
g_assert (!gtk_paper_size_is_equal (a1, b));
g_assert (!gtk_paper_size_is_equal (a1, c));
g_assert (!gtk_paper_size_is_equal (b, c));
g_assert_true (gtk_paper_size_is_equal (a1, a2));
g_assert_false (gtk_paper_size_is_equal (a1, b));
g_assert_false (gtk_paper_size_is_equal (a1, c));
g_assert_false (gtk_paper_size_is_equal (b, c));
gtk_paper_size_free (a1);
gtk_paper_size_free (a2);

View File

@ -67,7 +67,7 @@ items_changed (GListModel *model,
guint added,
GString *changes)
{
g_assert (removed != 0 || added != 0);
g_assert_true (removed != 0 || added != 0);
if (changes->len)
g_string_append (changes, ", ");

View File

@ -69,8 +69,8 @@ _count_nodes (GtkTreeRBTree *tree,
if (gtk_tree_rbtree_is_nil (node))
return 0;
g_assert (node->left);
g_assert (node->right);
g_assert_true (node->left);
g_assert_true (node->right);
res = (_count_nodes (tree, node->left) +
_count_nodes (tree, node->right) + 1);
@ -115,11 +115,11 @@ gtk_tree_rbtree_test_dirty (GtkTreeRBTree *tree,
GtkTreeRBNode *node,
int expected_dirtyness)
{
g_assert (node);
g_assert_nonnull (node);
if (expected_dirtyness)
{
g_assert (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_COLUMN_INVALID) ||
g_assert_true (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_COLUMN_INVALID) ||
GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_INVALID) ||
GTK_TREE_RBNODE_FLAG_SET (node->left, GTK_TREE_RBNODE_DESCENDANTS_INVALID) ||
GTK_TREE_RBNODE_FLAG_SET (node->right, GTK_TREE_RBNODE_DESCENDANTS_INVALID) ||
@ -127,14 +127,14 @@ gtk_tree_rbtree_test_dirty (GtkTreeRBTree *tree,
}
else
{
g_assert (!GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_COLUMN_INVALID) &&
g_assert_true (!GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_COLUMN_INVALID) &&
!GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_INVALID));
if (!gtk_tree_rbtree_is_nil (node->left))
g_assert (!GTK_TREE_RBNODE_FLAG_SET (node->left, GTK_TREE_RBNODE_DESCENDANTS_INVALID));
g_assert_true (!GTK_TREE_RBNODE_FLAG_SET (node->left, GTK_TREE_RBNODE_DESCENDANTS_INVALID));
if (!gtk_tree_rbtree_is_nil (node->right))
g_assert (!GTK_TREE_RBNODE_FLAG_SET (node->right, GTK_TREE_RBNODE_DESCENDANTS_INVALID));
g_assert_true (!GTK_TREE_RBNODE_FLAG_SET (node->right, GTK_TREE_RBNODE_DESCENDANTS_INVALID));
if (node->children != NULL)
g_assert (!GTK_TREE_RBNODE_FLAG_SET (node->children->root, GTK_TREE_RBNODE_DESCENDANTS_INVALID));
g_assert_true (!GTK_TREE_RBNODE_FLAG_SET (node->children->root, GTK_TREE_RBNODE_DESCENDANTS_INVALID));
}
if (!gtk_tree_rbtree_is_nil (node->left))
@ -153,15 +153,15 @@ gtk_tree_rbtree_test_structure_helper (GtkTreeRBTree *tree,
{
guint left_blacks, right_blacks;
g_assert (!gtk_tree_rbtree_is_nil (node));
g_assert_false (gtk_tree_rbtree_is_nil (node));
g_assert (node->left != NULL);
g_assert (node->right != NULL);
g_assert (node->parent != NULL);
g_assert_nonnull (node->left);
g_assert_nonnull (node->right);
g_assert_nonnull (node->parent);
if (!gtk_tree_rbtree_is_nil (node->left))
{
g_assert (node->left->parent == node);
g_assert_true (node->left->parent == node);
left_blacks = gtk_tree_rbtree_test_structure_helper (tree, node->left);
}
else
@ -169,7 +169,7 @@ gtk_tree_rbtree_test_structure_helper (GtkTreeRBTree *tree,
if (!gtk_tree_rbtree_is_nil (node->right))
{
g_assert (node->right->parent == node);
g_assert_true (node->right->parent == node);
right_blacks = gtk_tree_rbtree_test_structure_helper (tree, node->right);
}
else
@ -177,13 +177,13 @@ gtk_tree_rbtree_test_structure_helper (GtkTreeRBTree *tree,
if (node->children != NULL)
{
g_assert (node->children->parent_tree == tree);
g_assert (node->children->parent_node == node);
g_assert_true (node->children->parent_tree == tree);
g_assert_true (node->children->parent_node == node);
gtk_tree_rbtree_test_structure (node->children);
}
g_assert (left_blacks == right_blacks);
g_assert_true (left_blacks == right_blacks);
return left_blacks + (GTK_TREE_RBNODE_GET_COLOR (node) == GTK_TREE_RBNODE_BLACK ? 1 : 0);
}
@ -191,11 +191,11 @@ gtk_tree_rbtree_test_structure_helper (GtkTreeRBTree *tree,
static void
gtk_tree_rbtree_test_structure (GtkTreeRBTree *tree)
{
g_assert (tree->root);
g_assert_nonnull (tree->root);
if (gtk_tree_rbtree_is_nil (tree->root))
return;
g_assert (gtk_tree_rbtree_is_nil (tree->root->parent));
g_assert_true (gtk_tree_rbtree_is_nil (tree->root->parent));
gtk_tree_rbtree_test_structure_helper (tree, tree->root);
}
@ -217,12 +217,12 @@ gtk_tree_rbtree_test (GtkTreeRBTree *tree)
gtk_tree_rbtree_test_structure (tmp_tree);
g_assert ((_count_nodes (tmp_tree, tmp_tree->root->left) +
g_assert_true ((_count_nodes (tmp_tree, tmp_tree->root->left) +
_count_nodes (tmp_tree, tmp_tree->root->right) + 1) == tmp_tree->root->count);
gtk_tree_rbtree_test_height (tmp_tree, tmp_tree->root);
gtk_tree_rbtree_test_dirty (tmp_tree, tmp_tree->root, GTK_TREE_RBNODE_FLAG_SET (tmp_tree->root, GTK_TREE_RBNODE_DESCENDANTS_INVALID));
g_assert (count_total (tmp_tree, tmp_tree->root) == tmp_tree->root->total_count);
g_assert_true (count_total (tmp_tree, tmp_tree->root) == tmp_tree->root->total_count);
}
/* gtk_rbtree_print() - unused, for debugging only */
@ -286,7 +286,7 @@ append_elements (GtkTreeRBTree *tree,
GtkTreeRBNode *node;
guint i;
g_assert (depth > 0);
g_assert_cmpint (depth, >, 0);
node = NULL;
depth--;
@ -348,9 +348,9 @@ test_insert_after (void)
{
node = gtk_tree_rbtree_insert_after (tree, node, i, TRUE);
gtk_tree_rbtree_test (tree);
g_assert (tree->root->count == i);
g_assert (tree->root->total_count == i);
g_assert (tree->root->offset == i * (i + 1) / 2);
g_assert_cmpint (tree->root->count, ==, i);
g_assert_cmpint (tree->root->total_count, ==, i);
g_assert_cmpint (tree->root->offset, ==, i * (i + 1) / 2);
}
gtk_tree_rbtree_free (tree);
@ -370,9 +370,9 @@ test_insert_before (void)
{
node = gtk_tree_rbtree_insert_before (tree, node, i, TRUE);
gtk_tree_rbtree_test (tree);
g_assert (tree->root->count == i);
g_assert (tree->root->total_count == i);
g_assert (tree->root->offset == i * (i + 1) / 2);
g_assert_cmpint (tree->root->count, ==, i);
g_assert_cmpint (tree->root->total_count, ==, i);
g_assert_cmpint (tree->root->offset, ==, i * (i + 1) / 2);
}
gtk_tree_rbtree_free (tree);
@ -501,9 +501,9 @@ test_reorder (void)
node != NULL;
node = gtk_tree_rbtree_next (tree, node), i++)
{
g_assert (GTK_TREE_RBNODE_GET_HEIGHT (node) == i);
g_assert_cmpint (GTK_TREE_RBNODE_GET_HEIGHT (node), ==, i);
}
g_assert (i == n);
g_assert_cmpint (i, ==, n);
gtk_tree_rbtree_free (tree);

View File

@ -30,10 +30,10 @@ recent_manager_get_default (void)
GtkRecentManager *manager2;
manager = gtk_recent_manager_get_default ();
g_assert (manager != NULL);
g_assert_nonnull (manager);
manager2 = gtk_recent_manager_get_default ();
g_assert (manager == manager2);
g_assert_true (manager == manager2);
}
static void
@ -93,7 +93,7 @@ recent_manager_add (void)
res = gtk_recent_manager_add_full (manager,
uri,
recent_data);
g_assert (res == TRUE);
g_assert_true (res);
g_slice_free (GtkRecentData, recent_data);
}
@ -183,10 +183,10 @@ recent_manager_has_item (void)
manager = gtk_recent_manager_get_default ();
res = gtk_recent_manager_has_item (manager, "file:///tmp/testrecentdoesnotexist.txt");
g_assert (res == FALSE);
g_assert_false (res);
res = gtk_recent_manager_has_item (manager, uri);
g_assert (res == TRUE);
g_assert_true (res);
}
static void
@ -203,22 +203,20 @@ recent_manager_move_item (void)
"file:///tmp/testrecentdoesnotexist.txt",
uri2,
&error);
g_assert (res == FALSE);
g_assert (error != NULL);
g_assert (error->domain == GTK_RECENT_MANAGER_ERROR);
g_assert (error->code == GTK_RECENT_MANAGER_ERROR_NOT_FOUND);
g_assert_false (res);
g_assert_error (error, GTK_RECENT_MANAGER_ERROR, GTK_RECENT_MANAGER_ERROR_NOT_FOUND);
g_error_free (error);
error = NULL;
res = gtk_recent_manager_move_item (manager, uri, uri2, &error);
g_assert (res == TRUE);
g_assert (error == NULL);
g_assert_true (res);
g_assert_null (error);
res = gtk_recent_manager_has_item (manager, uri);
g_assert (res == FALSE);
g_assert_false (res);
res = gtk_recent_manager_has_item (manager, uri2);
g_assert (res == TRUE);
g_assert_true (res);
}
static void
@ -234,18 +232,16 @@ recent_manager_lookup_item (void)
info = gtk_recent_manager_lookup_item (manager,
"file:///tmp/testrecentdoesnotexist.txt",
&error);
g_assert (info == NULL);
g_assert (error != NULL);
g_assert (error->domain == GTK_RECENT_MANAGER_ERROR);
g_assert (error->code == GTK_RECENT_MANAGER_ERROR_NOT_FOUND);
g_assert_null (info);
g_assert_error (error, GTK_RECENT_MANAGER_ERROR, GTK_RECENT_MANAGER_ERROR_NOT_FOUND);
g_error_free (error);
error = NULL;
info = gtk_recent_manager_lookup_item (manager, uri2, &error);
g_assert (info != NULL);
g_assert (error == NULL);
g_assert_nonnull (info);
g_assert_null (error);
g_assert (gtk_recent_info_has_application (info, "testrecentchooser"));
g_assert_true (gtk_recent_info_has_application (info, "testrecentchooser"));
gtk_recent_info_unref (info);
}
@ -263,20 +259,18 @@ recent_manager_remove_item (void)
res = gtk_recent_manager_remove_item (manager,
"file:///tmp/testrecentdoesnotexist.txt",
&error);
g_assert (res == FALSE);
g_assert (error != NULL);
g_assert (error->domain == GTK_RECENT_MANAGER_ERROR);
g_assert (error->code == GTK_RECENT_MANAGER_ERROR_NOT_FOUND);
g_assert_false (res);
g_assert_error (error, GTK_RECENT_MANAGER_ERROR, GTK_RECENT_MANAGER_ERROR_NOT_FOUND);
g_error_free (error);
/* remove an item that's actually there */
error = NULL;
res = gtk_recent_manager_remove_item (manager, uri2, &error);
g_assert (res == TRUE);
g_assert (error == NULL);
g_assert_true (res);
g_assert_null (error);
res = gtk_recent_manager_has_item (manager, uri2);
g_assert (res == FALSE);
g_assert_false (res);
}
static void
@ -292,7 +286,7 @@ recent_manager_purge (void)
/* purge, add 1, purge again and check that 1 item has been purged */
error = NULL;
n = gtk_recent_manager_purge_items (manager, &error);
g_assert (error == NULL);
g_assert_null (error);
recent_data = g_slice_new0 (GtkRecentData);
recent_data->mime_type = (char *)"text/plain";
@ -303,8 +297,8 @@ recent_manager_purge (void)
error = NULL;
n = gtk_recent_manager_purge_items (manager, &error);
g_assert (error == NULL);
g_assert (n == 1);
g_assert_null (error);
g_assert_cmpint (n, ==, 1);
}
int

View File

@ -33,7 +33,7 @@ test_9d6da33ff5c5e41e3521e1afd63d2d67bc915753 (void)
gtk_widget_set_sensitive (label, TRUE);
gtk_widget_set_sensitive (window, TRUE);
g_assert (gtk_widget_get_sensitive (label));
g_assert_true (gtk_widget_get_sensitive (label));
gtk_window_destroy (GTK_WINDOW (window));
}
@ -51,7 +51,7 @@ test_94f00eb04dd1433cf1cc9a3341f485124e38abd1 (void)
gtk_widget_set_sensitive (label, FALSE);
gtk_widget_set_sensitive (label, TRUE);
g_assert (!gtk_widget_is_sensitive (label));
g_assert_false (gtk_widget_is_sensitive (label));
gtk_window_destroy (GTK_WINDOW (window));
}

View File

@ -11,11 +11,11 @@ capture_widget_destroy (void)
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (searchbar), button);
g_assert (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)) == button);
g_assert_true (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)) == button);
g_object_unref (button);
g_assert (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)) == NULL);
g_assert_null (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)));
g_object_unref (searchbar);
}
@ -31,11 +31,11 @@ capture_widget_unset (void)
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (searchbar), button);
g_assert (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)) == button);
g_assert_true (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)) == button);
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (searchbar), NULL);
g_assert (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)) == NULL);
g_assert_null (gtk_search_bar_get_key_capture_widget (GTK_SEARCH_BAR (searchbar)));
g_object_unref (searchbar);
g_object_unref (button);

View File

@ -30,7 +30,7 @@ get (GListModel *model,
{
guint number;
GObject *object = g_list_model_get_item (model, position);
g_assert (object != NULL);
g_assert_nonnull (object);
number = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
g_object_unref (object);
return number;
@ -82,7 +82,7 @@ make_object (guint number)
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));
@ -197,7 +197,7 @@ items_changed (GListModel *model,
guint added,
GString *changes)
{
g_assert (removed != 0 || added != 0);
g_assert_true (removed != 0 || added != 0);
if (changes->len)
g_string_append (changes, ", ");

View File

@ -29,7 +29,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
guint number;
g_assert (object != NULL);
g_assert_nonnull (object);
number = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
g_object_unref (object);
return number;
@ -62,7 +62,7 @@ make_object (guint number)
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));
@ -151,7 +151,7 @@ items_changed (GListModel *model,
guint added,
GString *changes)
{
g_assert (removed != 0 || added != 0);
g_assert_true (removed != 0 || added != 0);
if (changes->len)
g_string_append (changes, ", ");

View File

@ -36,7 +36,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
guint number;
g_assert (object != NULL);
g_assert_nonnull (object);
number = get_number (object);
g_object_unref (object);
return number;
@ -63,7 +63,7 @@ append_digit (GString *s,
if (digit == 0)
return;
g_assert (digit < 10);
g_assert_cmpint (digit, <, 10);
if (s->len)
g_string_append_c (s, ' ');
@ -110,7 +110,7 @@ get_spelled_out (gpointer object)
guint n = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
GString *s;
g_assert (n < 1000000);
g_assert_cmpint (n, <, 1000000);
if (n == 0)
return g_strdup ("Zero");
@ -160,7 +160,7 @@ add (GListStore *store,
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));

View File

@ -30,7 +30,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
guint number;
g_assert (object != NULL);
g_assert_nonnull (object);
number = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
g_object_unref (object);
return number;
@ -65,7 +65,7 @@ splice (GListStore *store,
for (i = 0; i < added; i++)
{
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (numbers[i] != 0);
g_assert_cmpint (numbers[i], !=, 0);
objects[i] = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (objects[i], number_quark, GUINT_TO_POINTER (numbers[i]));
}
@ -83,7 +83,7 @@ add (GListStore *store,
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));
@ -99,7 +99,7 @@ insert (GListStore *store,
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));
@ -153,7 +153,7 @@ items_changed (GListModel *model,
guint added,
GString *changes)
{
g_assert (removed != 0 || added != 0);
g_assert_true (removed != 0 || added != 0);
if (changes->len)
g_string_append (changes, ", ");
@ -213,7 +213,7 @@ new_model (gpointer model)
GtkSortListModel *result;
GString *changes;
g_assert (model == NULL || G_IS_LIST_MODEL (model));
g_assert_true (model == NULL || G_IS_LIST_MODEL (model));
if (model)
{

View File

@ -765,9 +765,9 @@ check_sort_order (GtkTreeModel *sort_model,
gtk_tree_model_get (sort_model, &siter, 0, &value, -1);
if (sort_order == GTK_SORT_ASCENDING)
g_assert (prev_value <= value);
g_assert_cmpint (prev_value, <=, value);
else
g_assert (prev_value >= value);
g_assert_cmpint (prev_value, >=, value);
prev_value = value;
}
@ -1118,17 +1118,17 @@ iter_test (GtkTreeModel *model)
{
GtkTreeIter a, b;
g_assert (gtk_tree_model_get_iter_first (model, &a));
g_assert_true (gtk_tree_model_get_iter_first (model, &a));
g_assert (gtk_tree_model_iter_next (model, &a));
g_assert (gtk_tree_model_iter_next (model, &a));
g_assert_true (gtk_tree_model_iter_next (model, &a));
g_assert_true (gtk_tree_model_iter_next (model, &a));
b = a;
g_assert (!gtk_tree_model_iter_next (model, &b));
g_assert_false (gtk_tree_model_iter_next (model, &b));
g_assert (gtk_tree_model_iter_previous (model, &a));
g_assert (gtk_tree_model_iter_previous (model, &a));
g_assert_true (gtk_tree_model_iter_previous (model, &a));
g_assert_true (gtk_tree_model_iter_previous (model, &a));
b = a;
g_assert (!gtk_tree_model_iter_previous (model, &b));
g_assert_false (gtk_tree_model_iter_previous (model, &b));
}
static void
@ -1236,57 +1236,57 @@ sort_column_change (void)
column_changed = 0;
g_signal_connect (sorted, "sort-column-changed", G_CALLBACK (sort_column_changed), NULL);
g_assert (!gtk_tree_sortable_has_default_sort_func (GTK_TREE_SORTABLE (sorted)));
g_assert_false (gtk_tree_sortable_has_default_sort_func (GTK_TREE_SORTABLE (sorted)));
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (sorted), sort_func, NULL, NULL);
g_assert (gtk_tree_sortable_has_default_sort_func (GTK_TREE_SORTABLE (sorted)));
g_assert_true (gtk_tree_sortable_has_default_sort_func (GTK_TREE_SORTABLE (sorted)));
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (sorted), 0, sort_func, NULL, NULL);
ret = gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (sorted), &col, &order);
g_assert (column_changed == 0);
g_assert (ret == FALSE);
g_assert (col == GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID);
g_assert (order == GTK_SORT_ASCENDING);
g_assert_cmpint (column_changed, ==, 0);
g_assert_false (ret);
g_assert_cmpint (col, ==, GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID);
g_assert_cmpint (order, ==, GTK_SORT_ASCENDING);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sorted),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_DESCENDING);
ret = gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (sorted), &col, &order);
g_assert (column_changed == 1);
g_assert (ret == FALSE);
g_assert (col == GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID);
g_assert (order == GTK_SORT_DESCENDING);
g_assert_cmpint (column_changed, ==, 1);
g_assert_false (ret);
g_assert_cmpint (col, ==, GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID);
g_assert_cmpint (order, ==, GTK_SORT_DESCENDING);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sorted),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_DESCENDING);
ret = gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (sorted), &col, &order);
g_assert (column_changed == 1);
g_assert (ret == FALSE);
g_assert (col == GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID);
g_assert (order == GTK_SORT_DESCENDING);
g_assert_cmpint (column_changed, ==, 1);
g_assert_false (ret);
g_assert_cmpint (col, ==, GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID);
g_assert_cmpint (order, ==, GTK_SORT_DESCENDING);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sorted),
0, GTK_SORT_DESCENDING);
ret = gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (sorted), &col, &order);
g_assert (column_changed == 2);
g_assert (ret == TRUE);
g_assert (col == 0);
g_assert (order == GTK_SORT_DESCENDING);
g_assert_cmpint (column_changed, ==, 2);
g_assert_true (ret);
g_assert_cmpint (col, ==, 0);
g_assert_cmpint (order, ==, GTK_SORT_DESCENDING);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sorted),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING);
ret = gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (sorted), &col, &order);
g_assert (column_changed == 3);
g_assert (ret == FALSE);
g_assert (col == GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID);
g_assert (order == GTK_SORT_ASCENDING);
g_assert_cmpint (column_changed, ==, 3);
g_assert_false (ret);
g_assert_cmpint (col, ==, GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID);
g_assert_cmpint (order, ==, GTK_SORT_ASCENDING);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sorted),
GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, GTK_SORT_ASCENDING);
ret = gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (sorted), &col, &order);
g_assert (column_changed == 4);
g_assert (ret == FALSE);
g_assert (col == GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID);
g_assert (order == GTK_SORT_ASCENDING);
g_assert_cmpint (column_changed, ==, 4);
g_assert_false (ret);
g_assert_cmpint (col, ==, GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID);
g_assert_cmpint (order, ==, GTK_SORT_ASCENDING);
}
/* main */

View File

@ -78,7 +78,7 @@ test_adjustment_null (void)
adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
gtk_spin_button_configure (GTK_SPIN_BUTTON (spin), NULL, 1.0, 0);
g_assert (adj == gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)));
g_assert_true (adj == gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)));
gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (spin), NULL);
adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));

View File

@ -61,7 +61,7 @@ items_changed (GListModel *model,
guint added,
GString *changes)
{
g_assert (removed != 0 || added != 0);
g_assert_true (removed != 0 || added != 0);
if (changes->len)
g_string_append (changes, ", ");

View File

@ -51,8 +51,8 @@ test_dialog_basic (void)
GtkWidget *dialog;
dialog = gtk_dialog_new ();
g_assert (GTK_IS_DIALOG (dialog));
g_assert (gtk_dialog_get_content_area (GTK_DIALOG (dialog)) != NULL);
g_assert_true (GTK_IS_DIALOG (dialog));
g_assert_nonnull (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
gtk_window_destroy (GTK_WINDOW (dialog));
}
@ -65,7 +65,7 @@ test_dialog_override_property (void)
dialog = g_object_new (GTK_TYPE_DIALOG,
"use-header-bar", 1,
NULL);
g_assert (GTK_IS_DIALOG (dialog));
g_assert_true (GTK_IS_DIALOG (dialog));
gtk_window_destroy (GTK_WINDOW (dialog));
}
@ -79,7 +79,7 @@ test_message_dialog_basic (void)
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"Do it hard !");
g_assert (GTK_IS_DIALOG (dialog));
g_assert_true (GTK_IS_DIALOG (dialog));
gtk_window_destroy (GTK_WINDOW (dialog));
}
@ -89,7 +89,7 @@ test_about_dialog_basic (void)
GtkWidget *dialog;
dialog = gtk_about_dialog_new ();
g_assert (GTK_IS_ABOUT_DIALOG (dialog));
g_assert_true (GTK_IS_ABOUT_DIALOG (dialog));
gtk_window_destroy (GTK_WINDOW (dialog));
}
@ -99,7 +99,7 @@ test_about_dialog_show (void)
GtkWidget *dialog;
dialog = gtk_about_dialog_new ();
g_assert (GTK_IS_ABOUT_DIALOG (dialog));
g_assert_true (GTK_IS_ABOUT_DIALOG (dialog));
show_and_wait (dialog);
gtk_window_destroy (GTK_WINDOW (dialog));
}
@ -110,7 +110,7 @@ test_info_bar_basic (void)
GtkWidget *infobar;
infobar = gtk_info_bar_new ();
g_assert (GTK_IS_INFO_BAR (infobar));
g_assert_true (GTK_IS_INFO_BAR (infobar));
g_object_unref (g_object_ref_sink (infobar));
}
@ -122,7 +122,7 @@ test_lock_button_basic (void)
permission = g_simple_permission_new (TRUE);
button = gtk_lock_button_new (permission);
g_assert (GTK_IS_LOCK_BUTTON (button));
g_assert_true (GTK_IS_LOCK_BUTTON (button));
g_object_unref (g_object_ref_sink (button));
g_object_unref (permission);
}
@ -133,7 +133,7 @@ test_assistant_basic (void)
GtkWidget *widget;
widget = gtk_assistant_new ();
g_assert (GTK_IS_ASSISTANT (widget));
g_assert_true (GTK_IS_ASSISTANT (widget));
gtk_window_destroy (GTK_WINDOW (widget));
}
@ -143,7 +143,7 @@ test_assistant_show (void)
GtkWidget *widget;
widget = gtk_assistant_new ();
g_assert (GTK_IS_ASSISTANT (widget));
g_assert_true (GTK_IS_ASSISTANT (widget));
show_and_wait (widget);
gtk_window_destroy (GTK_WINDOW (widget));
}
@ -154,7 +154,7 @@ test_scale_button_basic (void)
GtkWidget *widget;
widget = gtk_scale_button_new (0, 100, 10, NULL);
g_assert (GTK_IS_SCALE_BUTTON (widget));
g_assert_true (GTK_IS_SCALE_BUTTON (widget));
g_object_unref (g_object_ref_sink (widget));
}
@ -164,7 +164,7 @@ test_volume_button_basic (void)
GtkWidget *widget;
widget = gtk_volume_button_new ();
g_assert (GTK_IS_VOLUME_BUTTON (widget));
g_assert_true (GTK_IS_VOLUME_BUTTON (widget));
g_object_unref (g_object_ref_sink (widget));
}
@ -174,7 +174,7 @@ test_statusbar_basic (void)
GtkWidget *widget;
widget = gtk_statusbar_new ();
g_assert (GTK_IS_STATUSBAR (widget));
g_assert_true (GTK_IS_STATUSBAR (widget));
g_object_unref (g_object_ref_sink (widget));
}
@ -184,7 +184,7 @@ test_search_bar_basic (void)
GtkWidget *widget;
widget = gtk_search_bar_new ();
g_assert (GTK_IS_SEARCH_BAR (widget));
g_assert_true (GTK_IS_SEARCH_BAR (widget));
g_object_unref (g_object_ref_sink (widget));
}
@ -194,7 +194,7 @@ test_action_bar_basic (void)
GtkWidget *widget;
widget = gtk_action_bar_new ();
g_assert (GTK_IS_ACTION_BAR (widget));
g_assert_true (GTK_IS_ACTION_BAR (widget));
g_object_unref (g_object_ref_sink (widget));
}
@ -204,7 +204,7 @@ test_app_chooser_widget_basic (void)
GtkWidget *widget;
widget = gtk_app_chooser_widget_new (NULL);
g_assert (GTK_IS_APP_CHOOSER_WIDGET (widget));
g_assert_true (GTK_IS_APP_CHOOSER_WIDGET (widget));
g_object_unref (g_object_ref_sink (widget));
}
@ -215,7 +215,7 @@ test_app_chooser_dialog_basic (void)
gboolean done = FALSE;
widget = gtk_app_chooser_dialog_new_for_content_type (NULL, 0, "text/plain");
g_assert (GTK_IS_APP_CHOOSER_DIALOG (widget));
g_assert_true (GTK_IS_APP_CHOOSER_DIALOG (widget));
/* GtkAppChooserDialog bug, if destroyed before spinning
* the main context then app_chooser_online_get_default_ready_cb()
@ -234,7 +234,7 @@ test_color_chooser_dialog_basic (void)
/* This test also tests the internal GtkColorEditor widget */
widget = gtk_color_chooser_dialog_new (NULL, NULL);
g_assert (GTK_IS_COLOR_CHOOSER_DIALOG (widget));
g_assert_true (GTK_IS_COLOR_CHOOSER_DIALOG (widget));
gtk_window_destroy (GTK_WINDOW (widget));
}
@ -245,7 +245,7 @@ test_color_chooser_dialog_show (void)
/* This test also tests the internal GtkColorEditor widget */
widget = gtk_color_chooser_dialog_new (NULL, NULL);
g_assert (GTK_IS_COLOR_CHOOSER_DIALOG (widget));
g_assert_true (GTK_IS_COLOR_CHOOSER_DIALOG (widget));
show_and_wait (widget);
gtk_window_destroy (GTK_WINDOW (widget));
}
@ -273,7 +273,7 @@ test_file_chooser_widget_basic (void)
g_test_log_set_fatal_handler (ignore_gvfs_warning, NULL);
widget = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
g_assert (GTK_IS_FILE_CHOOSER_WIDGET (widget));
g_assert_true (GTK_IS_FILE_CHOOSER_WIDGET (widget));
/* XXX BUG:
*
@ -304,7 +304,7 @@ test_file_chooser_dialog_basic (void)
"_OK", GTK_RESPONSE_OK,
NULL);
g_assert (GTK_IS_FILE_CHOOSER_DIALOG (widget));
g_assert_true (GTK_IS_FILE_CHOOSER_DIALOG (widget));
done = FALSE;
g_timeout_add (100, main_loop_quit_cb, &done);
while (!done)
@ -325,7 +325,7 @@ test_file_chooser_dialog_show (void)
"_OK", GTK_RESPONSE_OK,
NULL);
g_assert (GTK_IS_FILE_CHOOSER_DIALOG (widget));
g_assert_true (GTK_IS_FILE_CHOOSER_DIALOG (widget));
show_and_wait (widget);
gtk_window_destroy (GTK_WINDOW (widget));
}
@ -336,7 +336,7 @@ test_font_button_basic (void)
GtkWidget *widget;
widget = gtk_font_button_new ();
g_assert (GTK_IS_FONT_BUTTON (widget));
g_assert_true (GTK_IS_FONT_BUTTON (widget));
g_object_unref (g_object_ref_sink (widget));
}
@ -346,7 +346,7 @@ test_font_chooser_widget_basic (void)
GtkWidget *widget;
widget = gtk_font_chooser_widget_new ();
g_assert (GTK_IS_FONT_CHOOSER_WIDGET (widget));
g_assert_true (GTK_IS_FONT_CHOOSER_WIDGET (widget));
g_object_unref (g_object_ref_sink (widget));
}
@ -356,7 +356,7 @@ test_font_chooser_dialog_basic (void)
GtkWidget *widget;
widget = gtk_font_chooser_dialog_new ("Choose a font !", NULL);
g_assert (GTK_IS_FONT_CHOOSER_DIALOG (widget));
g_assert_true (GTK_IS_FONT_CHOOSER_DIALOG (widget));
gtk_window_destroy (GTK_WINDOW (widget));
}
@ -366,7 +366,7 @@ test_font_chooser_dialog_show (void)
GtkWidget *widget;
widget = gtk_font_chooser_dialog_new ("Choose a font !", NULL);
g_assert (GTK_IS_FONT_CHOOSER_DIALOG (widget));
g_assert_true (GTK_IS_FONT_CHOOSER_DIALOG (widget));
show_and_wait (widget);
gtk_window_destroy (GTK_WINDOW (widget));
}
@ -378,7 +378,7 @@ test_page_setup_unix_dialog_basic (void)
GtkWidget *widget;
widget = gtk_page_setup_unix_dialog_new ("Setup your Page !", NULL);
g_assert (GTK_IS_PAGE_SETUP_UNIX_DIALOG (widget));
g_assert_true (GTK_IS_PAGE_SETUP_UNIX_DIALOG (widget));
gtk_window_destroy (GTK_WINDOW (widget));
}
@ -388,7 +388,7 @@ test_page_setup_unix_dialog_show (void)
GtkWidget *widget;
widget = gtk_page_setup_unix_dialog_new ("Setup your Page !", NULL);
g_assert (GTK_IS_PAGE_SETUP_UNIX_DIALOG (widget));
g_assert_true (GTK_IS_PAGE_SETUP_UNIX_DIALOG (widget));
show_and_wait (widget);
gtk_window_destroy (GTK_WINDOW (widget));
}
@ -399,7 +399,7 @@ test_print_unix_dialog_basic (void)
GtkWidget *widget;
widget = gtk_print_unix_dialog_new ("Go Print !", NULL);
g_assert (GTK_IS_PRINT_UNIX_DIALOG (widget));
g_assert_true (GTK_IS_PRINT_UNIX_DIALOG (widget));
gtk_window_destroy (GTK_WINDOW (widget));
}
@ -409,7 +409,7 @@ test_print_unix_dialog_show (void)
GtkWidget *widget;
widget = gtk_print_unix_dialog_new ("Go Print !", NULL);
g_assert (GTK_IS_PRINT_UNIX_DIALOG (widget));
g_assert_true (GTK_IS_PRINT_UNIX_DIALOG (widget));
show_and_wait (widget);
gtk_window_destroy (GTK_WINDOW (widget));
}
@ -429,7 +429,7 @@ main (int argc, char **argv)
* to assert that all automated compoenents are properly finalized
* when a given composite widget is destroyed.
*/
g_assert (g_setenv ("GTK_WIDGET_ASSERT_COMPONENTS", "1", TRUE));
g_assert_true (g_setenv ("GTK_WIDGET_ASSERT_COMPONENTS", "1", TRUE));
g_test_add_func ("/template/GtkDialog/basic", test_dialog_basic);
g_test_add_func ("/template/GtkDialog/OverrideProperty", test_dialog_override_property);

View File

@ -201,7 +201,7 @@ load_ui_file (GFile *ui_file,
builder = gtk_builder_new_from_file (ui_path);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_assert (window != NULL);
g_assert_nonnull (window);
gtk_widget_show (window);
@ -235,7 +235,7 @@ load_ui_file (GFile *ui_file,
goto out;
}
g_assert (ref_file != NULL);
g_assert_nonnull (ref_file);
ref_path = g_file_get_path (ref_file);
@ -289,7 +289,7 @@ main (int argc, char **argv)
if (arg_generate)
{
g_assert (argc == 2);
g_assert_cmpint (argc, ==, 2);
ui_file = g_file_new_for_commandline_arg (argv[1]);
@ -299,7 +299,7 @@ main (int argc, char **argv)
}
else
{
g_assert (argc == 3);
g_assert_cmpint (argc, ==, 3);
ui_file = g_file_new_for_commandline_arg (argv[1]);
ref_file = g_file_new_for_commandline_arg (argv[2]);

View File

@ -678,7 +678,7 @@ fill_buffer (GtkTextBuffer *buffer)
pixbuf = gdk_pixbuf_new_from_xpm_data (book_closed_xpm);
texture = gdk_texture_new_for_pixbuf (pixbuf);
g_assert (texture != NULL);
g_assert_nonnull (texture);
for (i = 0; i < 10; i++)
{
@ -816,38 +816,38 @@ test_line_separation (const char* str,
gtk_text_buffer_set_text (buffer, str, -1);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, expected_line_break);
g_assert (gtk_text_iter_ends_line (&iter) || gtk_text_iter_is_end (&iter));
g_assert_true (gtk_text_iter_ends_line (&iter) || gtk_text_iter_is_end (&iter));
g_assert (gtk_text_buffer_get_line_count (buffer) == expected_line_count);
g_assert_cmpint (gtk_text_buffer_get_line_count (buffer), ==, expected_line_count);
on_next_line = gtk_text_iter_forward_line (&iter);
g_assert (expect_next_line == on_next_line);
g_assert_cmpint (expect_next_line, ==, on_next_line);
on_end_iter = gtk_text_iter_is_end (&iter);
g_assert (on_end_iter == expect_end_iter);
g_assert_true (on_end_iter == expect_end_iter);
new_pos = gtk_text_iter_get_offset (&iter);
if (on_next_line)
g_assert (expected_next_line_start == new_pos);
g_assert_cmpint (expected_next_line_start, ==, new_pos);
++expected_line_break;
while (expected_line_break < expected_next_line_start)
{
gtk_text_buffer_get_iter_at_offset (buffer, &iter, expected_line_break);
g_assert (!gtk_text_iter_ends_line (&iter));
g_assert_false (gtk_text_iter_ends_line (&iter));
on_next_line = gtk_text_iter_forward_line (&iter);
g_assert (expect_next_line == on_next_line);
g_assert_cmpint (expect_next_line, ==, on_next_line);
new_pos = gtk_text_iter_get_offset (&iter);
if (on_next_line)
g_assert (expected_next_line_start == new_pos);
g_assert_cmpint (expected_next_line_start, ==, new_pos);
++expected_line_break;
}
@ -880,10 +880,10 @@ split_r_n_separators_test (void)
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 5);
gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
g_assert (gtk_text_iter_ends_line (&iter));
g_assert_true (gtk_text_iter_ends_line (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 3);
g_assert (gtk_text_iter_ends_line (&iter));
g_assert_true (gtk_text_iter_ends_line (&iter));
g_object_unref (buffer);
}
@ -931,14 +931,14 @@ test_backspace (void)
gtk_text_buffer_set_text (buffer, "foo", -1);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 2);
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
g_assert (ret);
g_assert_true (ret);
g_assert_cmpint (1, ==, gtk_text_iter_get_offset (&iter));
g_assert_cmpint (2, ==, gtk_text_buffer_get_char_count (buffer));
gtk_text_buffer_set_text (buffer, "foo", -1);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
g_assert (!ret);
g_assert_true (!ret);
g_assert_cmpint (0, ==, gtk_text_iter_get_offset (&iter));
g_assert_cmpint (3, ==, gtk_text_buffer_get_char_count (buffer));
@ -946,7 +946,7 @@ test_backspace (void)
gtk_text_buffer_set_text (buffer, "foo\r\n\r\nbar", -1);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 5);
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
g_assert (ret);
g_assert_true (ret);
g_assert_cmpint (0, ==, gtk_text_iter_get_line (&iter));
g_assert_cmpint (8, ==, gtk_text_buffer_get_char_count (buffer));
@ -954,21 +954,21 @@ test_backspace (void)
gtk_text_buffer_set_text (buffer, "", -1);
gtk_text_buffer_get_end_iter (buffer, &iter);
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
g_assert (!ret);
g_assert_false (ret);
g_assert_cmpint (0, ==, gtk_text_iter_get_offset (&iter));
g_assert_cmpint (0, ==, gtk_text_buffer_get_char_count (buffer));
gtk_text_buffer_set_text (buffer, "foo\n", -1);
gtk_text_buffer_get_end_iter (buffer, &iter);
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
g_assert (ret);
g_assert_true (ret);
g_assert_cmpint (3, ==, gtk_text_iter_get_offset (&iter));
g_assert_cmpint (3, ==, gtk_text_buffer_get_char_count (buffer));
gtk_text_buffer_set_text (buffer, "foo\r\n", -1);
gtk_text_buffer_get_end_iter (buffer, &iter);
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
g_assert (ret);
g_assert_true (ret);
g_assert_cmpint (3, ==, gtk_text_iter_get_offset (&iter));
g_assert_cmpint (3, ==, gtk_text_buffer_get_char_count (buffer));
@ -1178,25 +1178,25 @@ test_marks (void)
gtk_text_mark_set_visible (mark, TRUE);
gtk_text_buffer_delete_mark (buf1, mark);
g_assert (gtk_text_mark_get_visible (mark));
g_assert (gtk_text_mark_get_left_gravity (mark));
g_assert (!strcmp ("foo", gtk_text_mark_get_name (mark)));
g_assert (gtk_text_mark_get_buffer (mark) == NULL);
g_assert (gtk_text_mark_get_deleted (mark));
g_assert (gtk_text_buffer_get_mark (buf1, "foo") == NULL);
g_assert_true (gtk_text_mark_get_visible (mark));
g_assert_true (gtk_text_mark_get_left_gravity (mark));
g_assert_cmpstr ("foo", ==, gtk_text_mark_get_name (mark));
g_assert_null (gtk_text_mark_get_buffer (mark));
g_assert_true (gtk_text_mark_get_deleted (mark));
g_assert_null (gtk_text_buffer_get_mark (buf1, "foo"));
gtk_text_buffer_get_start_iter (buf2, &iter);
gtk_text_buffer_add_mark (buf2, mark, &iter);
gtk_text_buffer_insert (buf2, &iter, "ewfwefwefwe", -1);
gtk_text_buffer_get_iter_at_mark (buf2, &iter, mark);
g_assert (gtk_text_mark_get_visible (mark));
g_assert (gtk_text_iter_is_start (&iter));
g_assert (gtk_text_mark_get_left_gravity (mark));
g_assert (!strcmp ("foo", gtk_text_mark_get_name (mark)));
g_assert (gtk_text_mark_get_buffer (mark) == buf2);
g_assert (!gtk_text_mark_get_deleted (mark));
g_assert (gtk_text_buffer_get_mark (buf2, "foo") == mark);
g_assert_true (gtk_text_mark_get_visible (mark));
g_assert_true (gtk_text_iter_is_start (&iter));
g_assert_true (gtk_text_mark_get_left_gravity (mark));
g_assert_cmpstr ("foo", ==, gtk_text_mark_get_name (mark));
g_assert_true (gtk_text_mark_get_buffer (mark) == buf2);
g_assert_false (gtk_text_mark_get_deleted (mark));
g_assert_true (gtk_text_buffer_get_mark (buf2, "foo") == mark);
gtk_text_buffer_delete_mark (buf2, mark);
gtk_text_mark_set_visible (mark, FALSE);
@ -1207,25 +1207,25 @@ test_marks (void)
gtk_text_mark_set_visible (mark, TRUE);
gtk_text_buffer_add_mark (buf1, mark, &iter);
g_assert (gtk_text_mark_get_visible (mark));
g_assert (gtk_text_mark_get_buffer (mark) == buf1);
g_assert (!gtk_text_mark_get_deleted (mark));
g_assert (gtk_text_buffer_get_mark (buf1, "blah") == mark);
g_assert (!strcmp ("blah", gtk_text_mark_get_name (mark)));
g_assert_true (gtk_text_mark_get_visible (mark));
g_assert_true (gtk_text_mark_get_buffer (mark) == buf1);
g_assert_false (gtk_text_mark_get_deleted (mark));
g_assert_true (gtk_text_buffer_get_mark (buf1, "blah") == mark);
g_assert_cmpstr ("blah", ==, gtk_text_mark_get_name (mark));
gtk_text_mark_set_visible (mark, FALSE);
gtk_text_buffer_delete_mark (buf1, mark);
g_assert (!gtk_text_mark_get_visible (mark));
g_assert (gtk_text_buffer_get_mark (buf1, "blah") == NULL);
g_assert (gtk_text_mark_get_buffer (mark) == NULL);
g_assert (gtk_text_mark_get_deleted (mark));
g_assert_false (gtk_text_mark_get_visible (mark));
g_assert_null (gtk_text_buffer_get_mark (buf1, "blah"));
g_assert_null (gtk_text_mark_get_buffer (mark));
g_assert_true (gtk_text_mark_get_deleted (mark));
gtk_text_buffer_get_start_iter (buf2, &iter);
gtk_text_buffer_add_mark (buf2, mark, &iter);
g_assert (gtk_text_mark_get_buffer (mark) == buf2);
g_assert (!gtk_text_mark_get_deleted (mark));
g_assert (gtk_text_buffer_get_mark (buf2, "blah") == mark);
g_assert (!strcmp ("blah", gtk_text_mark_get_name (mark)));
g_assert_true (gtk_text_mark_get_buffer (mark) == buf2);
g_assert_false (gtk_text_mark_get_deleted (mark));
g_assert_true (gtk_text_buffer_get_mark (buf2, "blah") == mark);
g_assert_cmpstr ("blah", ==, gtk_text_mark_get_name (mark));
g_object_unref (mark);
g_object_unref (buf1);
@ -1238,10 +1238,10 @@ test_utf8 (void)
gunichar ch;
/* Check UTF8 unknown char thing */
g_assert (GTK_TEXT_UNKNOWN_CHAR_UTF8_LEN == 3);
g_assert (g_utf8_strlen (gtk_text_unknown_char_utf8_gtk_tests_only (), 3) == 1);
g_assert_cmpint (GTK_TEXT_UNKNOWN_CHAR_UTF8_LEN, ==, 3);
g_assert_cmpint (g_utf8_strlen (gtk_text_unknown_char_utf8_gtk_tests_only (), 3), ==, 1);
ch = g_utf8_get_char (gtk_text_unknown_char_utf8_gtk_tests_only ());
g_assert (ch == GTK_TEXT_UNKNOWN_CHAR);
g_assert_true (ch == GTK_TEXT_UNKNOWN_CHAR);
}
static void
@ -1453,7 +1453,7 @@ test_clipboard (void)
check_buffer_contents (buffer, "abcdef");
gtk_text_buffer_get_iter_at_offset (buffer, &start, 3);
g_assert (gtk_text_iter_forward_to_tag_toggle (&start, tag));
g_assert_true (gtk_text_iter_forward_to_tag_toggle (&start, tag));
g_assert_cmpint (4, ==, gtk_text_iter_get_offset (&start));
g_object_unref (buffer);
@ -1472,93 +1472,93 @@ test_get_iter (void)
gtk_text_buffer_set_text (buffer, "ab\nßd\r\nef", -1);
/* Test get_iter_at_line() */
g_assert (gtk_text_buffer_get_iter_at_line (buffer, &iter, 0));
g_assert (gtk_text_iter_is_start (&iter));
g_assert_true (gtk_text_buffer_get_iter_at_line (buffer, &iter, 0));
g_assert_true (gtk_text_iter_is_start (&iter));
g_assert (gtk_text_buffer_get_iter_at_line (buffer, &iter, 1));
g_assert_true (gtk_text_buffer_get_iter_at_line (buffer, &iter, 1));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 3);
g_assert (gtk_text_buffer_get_iter_at_line (buffer, &iter, 2));
g_assert_true (gtk_text_buffer_get_iter_at_line (buffer, &iter, 2));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 7);
g_assert (!gtk_text_buffer_get_iter_at_line (buffer, &iter, 3));
g_assert (gtk_text_iter_is_end (&iter));
g_assert_false (gtk_text_buffer_get_iter_at_line (buffer, &iter, 3));
g_assert_true (gtk_text_iter_is_end (&iter));
/* Test get_iter_at_line_offset() */
g_assert (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 0));
g_assert (gtk_text_iter_is_start (&iter));
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 0));
g_assert_true (gtk_text_iter_is_start (&iter));
g_assert (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 1));
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 1));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 1);
g_assert (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 2));
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 2));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 2);
g_assert (!gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 3));
g_assert_false (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 3));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 2);
g_assert (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 1, 1));
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 1, 1));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 4);
g_assert (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 2, 1));
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 2, 1));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 8);
g_assert (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 2, 2));
g_assert (gtk_text_iter_is_end (&iter));
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 2, 2));
g_assert_true (gtk_text_iter_is_end (&iter));
g_assert (!gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 2, 3));
g_assert (gtk_text_iter_is_end (&iter));
g_assert_false (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 2, 3));
g_assert_true (gtk_text_iter_is_end (&iter));
g_assert (!gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 3, 1));
g_assert (gtk_text_iter_is_end (&iter));
g_assert_false (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 3, 1));
g_assert_true (gtk_text_iter_is_end (&iter));
/* Test get_iter_at_line_index() */
g_assert (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 0));
g_assert (gtk_text_iter_is_start (&iter));
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 0));
g_assert_true (gtk_text_iter_is_start (&iter));
g_assert (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 1));
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 1));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 1);
g_assert (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 2));
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 2));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 2);
g_assert (!gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 3));
g_assert_false (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 3));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 2);
g_assert (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 1, 0));
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 1, 0));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 3);
g_assert (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 1, 2));
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 1, 2));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 4);
g_assert (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 1, 3));
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 1, 3));
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 5);
g_assert (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 2, 2));
g_assert (gtk_text_iter_is_end (&iter));
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 2, 2));
g_assert_true (gtk_text_iter_is_end (&iter));
g_assert (!gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 2, 3));
g_assert (gtk_text_iter_is_end (&iter));
g_assert_false (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 2, 3));
g_assert_true (gtk_text_iter_is_end (&iter));
g_assert (!gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 3, 1));
g_assert (gtk_text_iter_is_end (&iter));
g_assert_false (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 3, 1));
g_assert_true (gtk_text_iter_is_end (&iter));
/* Test get_iter_at_offset() */
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
g_assert (gtk_text_iter_is_start (&iter));
g_assert_true (gtk_text_iter_is_start (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 1);
offset = gtk_text_iter_get_offset (&iter);
@ -1567,16 +1567,16 @@ test_get_iter (void)
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 8);
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 8);
g_assert (!gtk_text_iter_is_end (&iter));
g_assert_false (gtk_text_iter_is_end (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 9);
g_assert (gtk_text_iter_is_end (&iter));
g_assert_true (gtk_text_iter_is_end (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 100);
g_assert (gtk_text_iter_is_end (&iter));
g_assert_true (gtk_text_iter_is_end (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, -1);
g_assert (gtk_text_iter_is_end (&iter));
g_assert_true (gtk_text_iter_is_end (&iter));
g_object_unref (buffer);
}

View File

@ -34,14 +34,14 @@ test_empty_search (void)
/* search from start forward */
gtk_text_buffer_get_start_iter (buffer, &it);
res = gtk_text_iter_forward_search (&it, "", 0, &s, &e, NULL);
g_assert (res);
g_assert_true (res);
g_assert_cmpint (gtk_text_iter_get_offset (&s), ==, gtk_text_iter_get_offset (&e));
g_assert_cmpint (gtk_text_iter_get_offset (&s), ==, 1);
/* search from end backward */
gtk_text_buffer_get_end_iter (buffer, &it);
res = gtk_text_iter_backward_search (&it, "", 0, &s, &e, NULL);
g_assert (res);
g_assert_true (res);
g_assert_cmpint (gtk_text_iter_get_offset (&s), ==, gtk_text_iter_get_offset (&e));
g_assert_cmpint (gtk_text_iter_get_offset (&s), ==, 20);
}
@ -69,7 +69,7 @@ check_found_forward (const char *haystack,
/* search from start forward */
gtk_text_buffer_get_start_iter (buffer, &i);
res = gtk_text_iter_forward_search (&i, needle, flags, &s, &e, NULL);
g_assert (res);
g_assert_true (res);
g_assert_cmpint (expected_start, ==, gtk_text_iter_get_offset (&s));
g_assert_cmpint (expected_end, ==, gtk_text_iter_get_offset (&e));
text = gtk_text_iter_get_text (&s, &e);
@ -99,7 +99,7 @@ check_found_backward (const char *haystack,
/* search from end backward */
gtk_text_buffer_get_end_iter (buffer, &i);
res = gtk_text_iter_backward_search (&i, needle, flags, &s, &e, NULL);
g_assert (res);
g_assert_true (res);
g_assert_cmpint (expected_start, ==, gtk_text_iter_get_offset (&s));
g_assert_cmpint (expected_end, ==, gtk_text_iter_get_offset (&e));
text = gtk_text_iter_get_text (&s, &e);
@ -125,12 +125,12 @@ check_not_found (const char *haystack,
/* search from start forward */
gtk_text_buffer_get_start_iter (buffer, &i);
res = gtk_text_iter_forward_search (&i, needle, flags, &s, &e, NULL);
g_assert (res == FALSE);
g_assert_false (res);
/* search from end backward */
gtk_text_buffer_get_end_iter (buffer, &i);
res = gtk_text_iter_backward_search (&i, needle, flags, &s, &e, NULL);
g_assert (res == FALSE);
g_assert_false (res);
g_object_unref (buffer);
}
@ -287,6 +287,7 @@ test_forward_to_tag_toggle (void)
GtkTextTag *editable_tag;
GtkTextIter iter;
int offset;
gboolean ret;
buffer = gtk_text_buffer_new (NULL);
@ -306,26 +307,31 @@ test_forward_to_tag_toggle (void)
/* Go to the first "on" toggle */
gtk_text_buffer_get_start_iter (buffer, &iter);
g_assert (gtk_text_iter_forward_to_tag_toggle (&iter, NULL));
ret = gtk_text_iter_forward_to_tag_toggle (&iter, NULL);
g_assert_true (ret);
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 1);
/* Go to the last "off" toggle for the bold tag */
g_assert (gtk_text_iter_forward_to_tag_toggle (&iter, bold_tag));
ret = gtk_text_iter_forward_to_tag_toggle (&iter, bold_tag);
g_assert_true (ret);
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 2);
g_assert (!gtk_text_iter_forward_to_tag_toggle (&iter, bold_tag));
ret = gtk_text_iter_forward_to_tag_toggle (&iter, bold_tag);
g_assert_false (ret);
/* Go to the first "on" toggle for the editable tag */
gtk_text_buffer_get_start_iter (buffer, &iter);
g_assert (gtk_text_iter_forward_to_tag_toggle (&iter, editable_tag));
ret = gtk_text_iter_forward_to_tag_toggle (&iter, editable_tag);
g_assert_true (ret);
offset = gtk_text_iter_get_offset (&iter);
g_assert_cmpint (offset, ==, 2);
/* Test with the end iter */
gtk_text_buffer_get_end_iter (buffer, &iter);
g_assert (!gtk_text_iter_forward_to_tag_toggle (&iter, editable_tag));
ret = gtk_text_iter_forward_to_tag_toggle (&iter, editable_tag);
g_assert_false (ret);
g_object_unref (buffer);
}

View File

@ -74,7 +74,7 @@ run_comparison (gpointer a,
gint64 start, mid, end;
gpointer b;
g_assert (n <= G_MAXSIZE / element_size);
g_assert_cmpint (n, <=, G_MAXSIZE / element_size);
b = g_memdup2 (a, element_size * n);

View File

@ -30,7 +30,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
guint number;
g_assert (object != NULL);
g_assert_nonnull (object);
number = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
g_object_unref (object);
return number;
@ -65,7 +65,7 @@ prepend (GListStore *store,
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
if (step / 10)
object = G_OBJECT (new_store (number - 9 * step / 10, number, step / 10));
@ -119,7 +119,7 @@ items_changed (GListModel *model,
guint added,
GString *changes)
{
g_assert (removed != 0 || added != 0);
g_assert_true (removed != 0 || added != 0);
if (changes->len)
g_string_append (changes, ", ");
@ -226,25 +226,25 @@ test_remove_some (void)
assert_changes (tree, "");
item = g_list_model_get_item (G_LIST_MODEL (tree), 1);
g_assert (G_IS_LIST_MODEL (item));
g_assert_true (G_IS_LIST_MODEL (item));
g_list_store_remove (item, 3);
assert_model (tree, "100 100 100 99 98 96 95 94 93 92 91 90 90 89 88 87 86 85 84 83 82 81 80 80 79 78 77 76 75 74 73 72 71 70 70 69 68 67 66 65 64 63 62 61 60 60 59 58 57 56 55 54 53 52 51 50 50 49 48 47 46 45 44 43 42 41 40 40 39 38 37 36 35 34 33 32 31 30 30 29 28 27 26 25 24 23 22 21 20 20 19 18 17 16 15 14 13 12 11 10 10 9 8 7 6 5 4 3 2 1");
assert_changes (tree, "-5");
item = g_list_model_get_item (G_LIST_MODEL (tree), 0);
g_assert (G_IS_LIST_MODEL (item));
g_assert_true (G_IS_LIST_MODEL (item));
g_list_store_remove (item, 3);
assert_model (tree, "100 100 100 99 98 96 95 94 93 92 91 90 90 89 88 87 86 85 84 83 82 81 80 80 79 78 77 76 75 74 73 72 71 60 60 59 58 57 56 55 54 53 52 51 50 50 49 48 47 46 45 44 43 42 41 40 40 39 38 37 36 35 34 33 32 31 30 30 29 28 27 26 25 24 23 22 21 20 20 19 18 17 16 15 14 13 12 11 10 10 9 8 7 6 5 4 3 2 1");
assert_changes (tree, "33-11");
item = g_list_model_get_item (G_LIST_MODEL (tree), 88);
g_assert (G_IS_LIST_MODEL (item));
g_assert_true (G_IS_LIST_MODEL (item));
g_list_store_remove (item, 9);
assert_model (tree, "100 100 100 99 98 96 95 94 93 92 91 90 90 89 88 87 86 85 84 83 82 81 80 80 79 78 77 76 75 74 73 72 71 60 60 59 58 57 56 55 54 53 52 51 50 50 49 48 47 46 45 44 43 42 41 40 40 39 38 37 36 35 34 33 32 31 30 30 29 28 27 26 25 24 23 22 21 20 20 19 18 17 16 15 14 13 12 11 10 10 9 8 7 6 5 4 3 2");
assert_changes (tree, "-98");
item = g_list_model_get_item (G_LIST_MODEL (tree), 0);
g_assert (G_IS_LIST_MODEL (item));
g_assert_true (G_IS_LIST_MODEL (item));
g_list_store_remove (item, 8);
assert_model (tree, "100 100 100 99 98 96 95 94 93 92 91 90 90 89 88 87 86 85 84 83 82 81 80 80 79 78 77 76 75 74 73 72 71 60 60 59 58 57 56 55 54 53 52 51 50 50 49 48 47 46 45 44 43 42 41 40 40 39 38 37 36 35 34 33 32 31 30 30 29 28 27 26 25 24 23 22 21 20 20 19 18 17 16 15 14 13 12 11");
assert_changes (tree, "88-10");

View File

@ -183,13 +183,13 @@ signal_monitor_generic_handler (SignalMonitor *m,
{
int i, len;
g_assert (new_order != NULL);
g_assert_nonnull (new_order);
len = gtk_tree_model_iter_n_children (model, iter);
g_assert (s->len == len);
g_assert_cmpint (s->len, ==, len);
for (i = 0; i < len; i++)
g_assert (s->new_order[i] == new_order[i]);
g_assert_cmpint (s->new_order[i], ==, new_order[i]);
}
s = g_queue_pop_tail (m->queue);
@ -299,7 +299,7 @@ signal_monitor_free (SignalMonitor *m)
void
signal_monitor_assert_is_empty (SignalMonitor *m)
{
g_assert (g_queue_is_empty (m->queue));
g_assert_true (g_queue_is_empty (m->queue));
}
void

View File

@ -118,7 +118,7 @@ test_navigation (void)
p = gtk_tree_path_new_from_indices (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1);
q = gtk_tree_path_copy (p);
g_assert (gtk_tree_path_compare (p, q) == 0);
g_assert_true (gtk_tree_path_compare (p, q) == 0);
gtk_tree_path_next (q);
pi = gtk_tree_path_get_indices (p);
qi = gtk_tree_path_get_indices (q);
@ -126,39 +126,39 @@ test_navigation (void)
g_assert_cmpint (pi[i], ==, qi[i]);
g_assert_cmpint (qi[9], ==, pi[9] + 1);
g_assert (!gtk_tree_path_is_ancestor (p, q));
g_assert (!gtk_tree_path_is_ancestor (q, p));
g_assert (!gtk_tree_path_is_descendant (p, q));
g_assert (!gtk_tree_path_is_descendant (q, p));
g_assert_false (gtk_tree_path_is_ancestor (p, q));
g_assert_false (gtk_tree_path_is_ancestor (q, p));
g_assert_false (gtk_tree_path_is_descendant (p, q));
g_assert_false (gtk_tree_path_is_descendant (q, p));
res = gtk_tree_path_prev (q);
g_assert (res);
g_assert (gtk_tree_path_compare (p, q) == 0);
g_assert_true (res);
g_assert_true (gtk_tree_path_compare (p, q) == 0);
g_assert (!gtk_tree_path_is_ancestor (p, q));
g_assert (!gtk_tree_path_is_ancestor (q, p));
g_assert (!gtk_tree_path_is_descendant (p, q));
g_assert (!gtk_tree_path_is_descendant (q, p));
g_assert_false (gtk_tree_path_is_ancestor (p, q));
g_assert_false (gtk_tree_path_is_ancestor (q, p));
g_assert_false (gtk_tree_path_is_descendant (p, q));
g_assert_false (gtk_tree_path_is_descendant (q, p));
gtk_tree_path_down (q);
g_assert (gtk_tree_path_compare (p, q) < 0);
g_assert_true (gtk_tree_path_compare (p, q) < 0);
g_assert (gtk_tree_path_is_ancestor (p, q));
g_assert (!gtk_tree_path_is_ancestor (q, p));
g_assert (!gtk_tree_path_is_descendant (p, q));
g_assert (gtk_tree_path_is_descendant (q, p));
g_assert_true (gtk_tree_path_is_ancestor (p, q));
g_assert_false (gtk_tree_path_is_ancestor (q, p));
g_assert_false (gtk_tree_path_is_descendant (p, q));
g_assert_true (gtk_tree_path_is_descendant (q, p));
res = gtk_tree_path_prev (q);
g_assert (!res);
g_assert_false (res);
res = gtk_tree_path_up (q);
g_assert (res);
g_assert (gtk_tree_path_compare (p, q) == 0);
g_assert_true (res);
g_assert_true (gtk_tree_path_compare (p, q) == 0);
g_assert_cmpint (gtk_tree_path_get_depth (q), ==, 10);
res = gtk_tree_path_up (q);
g_assert (res);
g_assert_true (res);
g_assert_cmpint (gtk_tree_path_get_depth (q), ==, 9);
gtk_tree_path_free (p);

View File

@ -87,7 +87,7 @@ add (GListStore *store,
GObject *object;
/* 0 cannot be differentiated from NULL, so don't use it */
g_assert (number != 0);
g_assert_cmpint (number, !=, 0);
object = g_object_new (G_TYPE_OBJECT, NULL);
g_object_set_qdata (object, number_quark, GUINT_TO_POINTER (number));

View File

@ -128,8 +128,8 @@ check_model (TreeStore *fixture,
gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store),
&iter, path);
g_assert (gtk_tree_store_iter_is_valid (fixture->store, &iter));
g_assert (iters_equal (&iter, &fixture->iter[new_order[i]]));
g_assert_true (gtk_tree_store_iter_is_valid (fixture->store, &iter));
g_assert_true (iters_equal (&iter, &fixture->iter[new_order[i]]));
gtk_tree_path_next (path);
}
@ -148,36 +148,36 @@ tree_store_test_insert_high_values (void)
store = gtk_tree_store_new (1, G_TYPE_INT);
gtk_tree_store_insert (store, &iter, NULL, 1234);
g_assert (gtk_tree_store_iter_is_valid (store, &iter));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 1);
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_store_iter_is_valid (store, &iter));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 1);
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
gtk_tree_store_insert (store, &iter2, NULL, 765);
g_assert (gtk_tree_store_iter_is_valid (store, &iter2));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 2);
g_assert_true (gtk_tree_store_iter_is_valid (store, &iter2));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 2);
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -192,36 +192,36 @@ tree_store_test_append (void)
store = gtk_tree_store_new (1, G_TYPE_INT);
gtk_tree_store_append (store, &iter, NULL);
g_assert (gtk_tree_store_iter_is_valid (store, &iter));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 1);
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_store_iter_is_valid (store, &iter));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 1);
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
gtk_tree_store_append (store, &iter2, NULL);
g_assert (gtk_tree_store_iter_is_valid (store, &iter2));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 2);
g_assert_true (gtk_tree_store_iter_is_valid (store, &iter2));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 2);
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -236,36 +236,36 @@ tree_store_test_prepend (void)
store = gtk_tree_store_new (1, G_TYPE_INT);
gtk_tree_store_prepend (store, &iter, NULL);
g_assert (gtk_tree_store_iter_is_valid (store, &iter));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 1);
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_store_iter_is_valid (store, &iter));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 1);
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
gtk_tree_store_prepend (store, &iter2, NULL);
g_assert (gtk_tree_store_iter_is_valid (store, &iter2));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 2);
g_assert_true (gtk_tree_store_iter_is_valid (store, &iter2));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 2);
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 1));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 1));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -283,40 +283,40 @@ tree_store_test_insert_after (void)
gtk_tree_store_append (store, &iter2, NULL);
gtk_tree_store_insert_after (store, &iter3, NULL, &iter);
g_assert (gtk_tree_store_iter_is_valid (store, &iter3));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 3);
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter3, 1));
g_assert_true (gtk_tree_store_iter_is_valid (store, &iter3));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 3);
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter3, 1));
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter_copy, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter_copy, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 1));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter_copy, 2));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 2));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 2));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 2));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 2));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 2));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter3, 1));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter3, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -334,32 +334,32 @@ tree_store_test_insert_after_NULL (void)
/* move_after NULL is basically a prepend */
gtk_tree_store_insert_after (store, &iter2, NULL, NULL);
g_assert (gtk_tree_store_iter_is_valid (store, &iter2));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 2);
g_assert_true (gtk_tree_store_iter_is_valid (store, &iter2));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 2);
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 1));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 0));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 0));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 1));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -377,43 +377,43 @@ tree_store_test_insert_before (void)
gtk_tree_store_append (store, &iter2, NULL);
gtk_tree_store_insert_before (store, &iter3, NULL, &iter2);
g_assert (gtk_tree_store_iter_is_valid (store, &iter3));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 3);
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter3, 1));
g_assert_true (gtk_tree_store_iter_is_valid (store, &iter3));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 3);
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter3, 1));
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter_copy, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter_copy, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 1));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter_copy, 2));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter_copy, 2));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 2));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 2));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 2));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 2));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter3, &iter_copy));
g_assert (iter_position (store, &iter3, 1));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter3, &iter_copy));
g_assert_true (iter_position (store, &iter3, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -431,29 +431,29 @@ tree_store_test_insert_before_NULL (void)
/* move_before NULL is basically an append */
gtk_tree_store_insert_before (store, &iter2, NULL, NULL);
g_assert (gtk_tree_store_iter_is_valid (store, &iter2));
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 2);
g_assert_true (gtk_tree_store_iter_is_valid (store, &iter2));
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL), ==, 2);
/* Walk over the model */
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter_copy));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert (iters_equal (&iter2, &iter_copy));
g_assert (iter_position (store, &iter2, 1));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &iter_copy, NULL, 1));
g_assert_true (iters_equal (&iter2, &iter_copy));
g_assert_true (iter_position (store, &iter2, 1));
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert (iters_equal (&iter, &iter_copy));
g_assert (iter_position (store, &iter, 0));
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (iter_position (store, &iter, 0));
g_assert (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_assert_false (gtk_tree_model_iter_previous (GTK_TREE_MODEL (store), &iter_copy));
g_object_unref (store);
}
@ -489,9 +489,9 @@ tree_store_test_remove_begin (TreeStore *fixture,
gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store), &iter, path);
gtk_tree_path_free (path);
g_assert (gtk_tree_store_remove (fixture->store, &iter) == TRUE);
g_assert (!gtk_tree_store_iter_is_valid (fixture->store, &fixture->iter[0]));
g_assert (iters_equal (&iter, &fixture->iter[1]));
g_assert_true (gtk_tree_store_remove (fixture->store, &iter) == TRUE);
g_assert_false (gtk_tree_store_iter_is_valid (fixture->store, &fixture->iter[0]));
g_assert_true (iters_equal (&iter, &fixture->iter[1]));
check_model (fixture, new_order, 0);
}
@ -509,9 +509,9 @@ tree_store_test_remove_middle (TreeStore *fixture,
gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store), &iter, path);
gtk_tree_path_free (path);
g_assert (gtk_tree_store_remove (fixture->store, &iter) == TRUE);
g_assert (!gtk_tree_store_iter_is_valid (fixture->store, &fixture->iter[2]));
g_assert (iters_equal (&iter, &fixture->iter[3]));
g_assert_true (gtk_tree_store_remove (fixture->store, &iter));
g_assert_false (gtk_tree_store_iter_is_valid (fixture->store, &fixture->iter[2]));
g_assert_true (iters_equal (&iter, &fixture->iter[3]));
check_model (fixture, new_order, 2);
}
@ -529,8 +529,8 @@ tree_store_test_remove_end (TreeStore *fixture,
gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store), &iter, path);
gtk_tree_path_free (path);
g_assert (gtk_tree_store_remove (fixture->store, &iter) == FALSE);
g_assert (!gtk_tree_store_iter_is_valid (fixture->store, &fixture->iter[4]));
g_assert_false (gtk_tree_store_remove (fixture->store, &iter));
g_assert_false (gtk_tree_store_iter_is_valid (fixture->store, &fixture->iter[4]));
check_model (fixture, new_order, 4);
}
@ -543,10 +543,10 @@ tree_store_test_clear (TreeStore *fixture,
gtk_tree_store_clear (fixture->store);
g_assert (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (fixture->store), NULL) == 0);
g_assert_cmpint (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (fixture->store), NULL), ==, 0);
for (i = 0; i < 5; i++)
g_assert (!gtk_tree_store_iter_is_valid (fixture->store, &fixture->iter[i]));
g_assert_false (gtk_tree_store_iter_is_valid (fixture->store, &fixture->iter[i]));
}
/* reorder */
@ -573,8 +573,8 @@ tree_store_test_swap_begin (TreeStore *fixture,
GtkTreeIter iter_a;
GtkTreeIter iter_b;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "0"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "1"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "0"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "1"));
gtk_tree_store_swap (fixture->store, &iter_a, &iter_b);
check_model (fixture, new_order, -1);
@ -590,8 +590,8 @@ tree_store_test_swap_middle_next (TreeStore *fixture,
GtkTreeIter iter_a;
GtkTreeIter iter_b;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "2"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "3"));
gtk_tree_store_swap (fixture->store, &iter_a, &iter_b);
check_model (fixture, new_order, -1);
@ -607,8 +607,8 @@ tree_store_test_swap_middle_apart (TreeStore *fixture,
GtkTreeIter iter_a;
GtkTreeIter iter_b;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "1"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "1"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "3"));
gtk_tree_store_swap (fixture->store, &iter_a, &iter_b);
check_model (fixture, new_order, -1);
@ -624,8 +624,8 @@ tree_store_test_swap_end (TreeStore *fixture,
GtkTreeIter iter_a;
GtkTreeIter iter_b;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "3"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_a, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter_b, "4"));
gtk_tree_store_swap (fixture->store, &iter_a, &iter_b);
check_model (fixture, new_order, -1);
@ -648,9 +648,9 @@ tree_store_test_swap_single (void)
iter_copy = iter;
gtk_tree_store_swap (store, &iter, &iter);
g_assert (iters_equal (&iter, &iter_copy));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert (iters_equal (&iter, &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert_true (iters_equal (&iter, &iter_copy));
g_object_unref (store);
}
@ -667,8 +667,8 @@ tree_store_test_move_after_from_start (TreeStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "0"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "0"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
gtk_tree_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -684,8 +684,8 @@ tree_store_test_move_after_next (TreeStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
gtk_tree_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -701,8 +701,8 @@ tree_store_test_move_after_apart (TreeStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "1"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "1"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
gtk_tree_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -718,8 +718,8 @@ tree_store_test_move_after_end (TreeStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "4"));
gtk_tree_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -735,8 +735,8 @@ tree_store_test_move_after_from_end (TreeStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "1"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "1"));
gtk_tree_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -754,8 +754,8 @@ tree_store_test_move_after_change_ends (TreeStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "0"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "0"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "4"));
gtk_tree_store_move_after (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -770,7 +770,7 @@ tree_store_test_move_after_NULL (TreeStore *fixture,
GtkTreeIter iter;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
gtk_tree_store_move_after (fixture->store, &iter, NULL);
check_model (fixture, new_order, -1);
@ -793,14 +793,14 @@ tree_store_test_move_after_single (void)
iter_copy = iter;
gtk_tree_store_move_after (store, &iter, NULL);
g_assert (iters_equal (&iter, &iter_copy));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert (iters_equal (&iter, &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert_true (iters_equal (&iter, &iter_copy));
gtk_tree_store_move_after (store, &iter, &iter);
g_assert (iters_equal (&iter, &iter_copy));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert (iters_equal (&iter, &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert_true (iters_equal (&iter, &iter_copy));
g_object_unref (store);
}
@ -817,8 +817,8 @@ tree_store_test_move_before_next (TreeStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "3"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
gtk_tree_store_move_before (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -834,8 +834,8 @@ tree_store_test_move_before_apart (TreeStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "1"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "1"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "3"));
gtk_tree_store_move_before (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -851,8 +851,8 @@ tree_store_test_move_before_to_start (TreeStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "0"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "0"));
gtk_tree_store_move_before (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -868,8 +868,8 @@ tree_store_test_move_before_from_end (TreeStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "2"));
gtk_tree_store_move_before (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -885,8 +885,8 @@ tree_store_test_move_before_change_ends (TreeStore *fixture,
GtkTreeIter iter;
GtkTreeIter position;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "0"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "4"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &position, "0"));
gtk_tree_store_move_before (fixture->store, &iter, &position);
check_model (fixture, new_order, -1);
@ -901,7 +901,7 @@ tree_store_test_move_before_NULL (TreeStore *fixture,
GtkTreeIter iter;
g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
g_assert_true (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (fixture->store), &iter, "2"));
gtk_tree_store_move_before (fixture->store, &iter, NULL);
check_model (fixture, new_order, -1);
@ -924,14 +924,14 @@ tree_store_test_move_before_single (void)
iter_copy = iter;
gtk_tree_store_move_before (store, &iter, NULL);
g_assert (iters_equal (&iter, &iter_copy));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert (iters_equal (&iter, &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert_true (iters_equal (&iter, &iter_copy));
gtk_tree_store_move_before (store, &iter, &iter);
g_assert (iters_equal (&iter, &iter_copy));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert (iters_equal (&iter, &iter_copy));
g_assert_true (iters_equal (&iter, &iter_copy));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter));
g_assert_true (iters_equal (&iter, &iter_copy));
g_object_unref (store);
}
@ -947,10 +947,10 @@ tree_store_test_iter_previous_invalid (TreeStore *fixture,
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (fixture->store), &iter);
g_assert (gtk_tree_model_iter_previous (GTK_TREE_MODEL (fixture->store),
g_assert_true (gtk_tree_model_iter_previous (GTK_TREE_MODEL (fixture->store),
&iter) == FALSE);
g_assert (gtk_tree_store_iter_is_valid (fixture->store, &iter) == FALSE);
g_assert (iter.stamp == 0);
g_assert_false (gtk_tree_store_iter_is_valid (fixture->store, &iter));
g_assert_cmpint (iter.stamp, ==, 0);
}
static void
@ -964,10 +964,10 @@ tree_store_test_iter_next_invalid (TreeStore *fixture,
gtk_tree_model_get_iter (GTK_TREE_MODEL (fixture->store), &iter, path);
gtk_tree_path_free (path);
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store),
&iter) == FALSE);
g_assert (gtk_tree_store_iter_is_valid (fixture->store, &iter) == FALSE);
g_assert (iter.stamp == 0);
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (fixture->store),
&iter));
g_assert_false (gtk_tree_store_iter_is_valid (fixture->store, &iter));
g_assert_cmpint (iter.stamp, ==, 0);
}
static void
@ -977,12 +977,12 @@ tree_store_test_iter_children_invalid (TreeStore *fixture,
GtkTreeIter iter, child;
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (fixture->store), &iter);
g_assert (gtk_tree_store_iter_is_valid (fixture->store, &iter) == TRUE);
g_assert_true (gtk_tree_store_iter_is_valid (fixture->store, &iter));
g_assert (gtk_tree_model_iter_children (GTK_TREE_MODEL (fixture->store),
&child, &iter) == FALSE);
g_assert (gtk_tree_store_iter_is_valid (fixture->store, &child) == FALSE);
g_assert (child.stamp == 0);
g_assert_false (gtk_tree_model_iter_children (GTK_TREE_MODEL (fixture->store),
&child, &iter));
g_assert_false (gtk_tree_store_iter_is_valid (fixture->store, &child));
g_assert_cmpint (child.stamp, ==, 0);
}
static void
@ -992,12 +992,12 @@ tree_store_test_iter_nth_child_invalid (TreeStore *fixture,
GtkTreeIter iter, child;
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (fixture->store), &iter);
g_assert (gtk_tree_store_iter_is_valid (fixture->store, &iter) == TRUE);
g_assert_true (gtk_tree_store_iter_is_valid (fixture->store, &iter));
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (fixture->store),
&child, &iter, 0) == FALSE);
g_assert (gtk_tree_store_iter_is_valid (fixture->store, &child) == FALSE);
g_assert (child.stamp == 0);
g_assert_false (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (fixture->store),
&child, &iter, 0));
g_assert_false (gtk_tree_store_iter_is_valid (fixture->store, &child));
g_assert_cmpint (child.stamp, ==, 0);
}
static void
@ -1007,12 +1007,12 @@ tree_store_test_iter_parent_invalid (TreeStore *fixture,
GtkTreeIter iter, child;
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (fixture->store), &child);
g_assert (gtk_tree_store_iter_is_valid (fixture->store, &child) == TRUE);
g_assert_true (gtk_tree_store_iter_is_valid (fixture->store, &child));
g_assert (gtk_tree_model_iter_parent (GTK_TREE_MODEL (fixture->store),
&iter, &child) == FALSE);
g_assert (gtk_tree_store_iter_is_valid (fixture->store, &iter) == FALSE);
g_assert (iter.stamp == 0);
g_assert_false (gtk_tree_model_iter_parent (GTK_TREE_MODEL (fixture->store),
&iter, &child));
g_assert_false (gtk_tree_store_iter_is_valid (fixture->store, &iter));
g_assert_cmpint (iter.stamp, ==, 0);
}
/* specific bugs */

View File

@ -77,6 +77,7 @@ test_bug_539377 (void)
GtkWidget *view;
GtkTreePath *path;
GtkListStore *list_store;
gboolean ret;
/*http://bugzilla.gnome.org/show_bug.cgi?id=539377 */
@ -84,20 +85,24 @@ test_bug_539377 (void)
/* Non-realized view, no model */
view = gtk_tree_view_new ();
g_assert (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (view), 10, 10, &path,
NULL, NULL, NULL) == FALSE);
g_assert (gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (view), 10, 10,
&path, NULL) == FALSE);
ret = gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (view), 10, 10, &path,
NULL, NULL, NULL);
g_assert_false (ret);
ret = gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (view), 10, 10,
&path, NULL);
g_assert_false (ret);
/* Non-realized view, with model */
list_store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_tree_view_set_model (GTK_TREE_VIEW (view),
GTK_TREE_MODEL (list_store));
g_assert (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (view), 10, 10, &path,
NULL, NULL, NULL) == FALSE);
g_assert (gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (view), 10, 10,
&path, NULL) == FALSE);
ret = gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (view), 10, 10, &path,
NULL, NULL, NULL);
g_assert_false (ret);
ret = gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (view), 10, 10,
&path, NULL);
g_assert_false (ret);
g_object_unref (g_object_ref_sink (view));
}

View File

@ -19,9 +19,9 @@ popover (void)
gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), p);
/* GtkButton is a normal widget and thus floating */
g_assert (g_object_is_floating (button));
g_assert_true (g_object_is_floating (button));
/* GtkPopver sinks itself */
g_assert (!g_object_is_floating (p));
g_assert_true (!g_object_is_floating (p));
g_object_weak_ref (G_OBJECT (p), check_finalized, &finalized);
@ -29,7 +29,7 @@ popover (void)
g_object_unref (button);
/* We do NOT unref p since the only reference held to it gets
* removed when the button gets disposed. */
g_assert (finalized);
g_assert_true (finalized);
}
static void
@ -41,8 +41,8 @@ popover2 (void)
gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), p);
g_assert (g_object_is_floating (button));
g_assert (!g_object_is_floating (p));
g_assert_true (g_object_is_floating (button));
g_assert_true (!g_object_is_floating (p));
g_object_weak_ref (G_OBJECT (p), check_finalized, &finalized);
@ -50,7 +50,7 @@ popover2 (void)
gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), NULL);
g_assert (finalized);
g_assert_true (finalized);
g_object_unref (button);
}
@ -62,13 +62,13 @@ filechooserwidget (void)
GtkWidget *w = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_OPEN);
gboolean finalized = FALSE;
g_assert (g_object_is_floating (w));
g_assert_true (g_object_is_floating (w));
g_object_ref_sink (w);
g_object_weak_ref (G_OBJECT (w), check_finalized, &finalized);
g_object_unref (w);
g_assert (finalized);
g_assert_true (finalized);
}
static void
@ -78,12 +78,12 @@ window (void)
gboolean finalized = FALSE;
/* GTK holds a ref */
g_assert (!g_object_is_floating (w));
g_assert_true (!g_object_is_floating (w));
g_object_weak_ref (G_OBJECT (w), check_finalized, &finalized);
gtk_window_destroy (GTK_WINDOW (w));
g_assert (finalized);
g_assert_true (finalized);
}
int

View File

@ -8,14 +8,14 @@ simple (void)
gtk_box_append (GTK_BOX (box), l);
g_assert (gtk_widget_get_parent (l) == box);
g_assert (gtk_widget_get_prev_sibling (l) == NULL);
g_assert (gtk_widget_get_next_sibling (l) == NULL);
g_assert (gtk_widget_get_first_child (l) == NULL);
g_assert (gtk_widget_get_last_child (l) == NULL);
g_assert_true (gtk_widget_get_parent (l) == box);
g_assert_null (gtk_widget_get_prev_sibling (l));
g_assert_null (gtk_widget_get_next_sibling (l));
g_assert_null (gtk_widget_get_first_child (l));
g_assert_null (gtk_widget_get_last_child (l));
g_assert (gtk_widget_get_first_child (box) == l);
g_assert (gtk_widget_get_last_child (box) == l);
g_assert_true (gtk_widget_get_first_child (box) == l);
g_assert_true (gtk_widget_get_last_child (box) == l);
}
static void
@ -28,16 +28,16 @@ two (void)
gtk_box_append (GTK_BOX (box), l1);
gtk_box_append (GTK_BOX (box), l2);
g_assert (gtk_widget_get_parent (l1) == box);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_parent (l1) == box);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_parent (l2) == box);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
g_assert_true (gtk_widget_get_parent (l2) == box);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_null (gtk_widget_get_next_sibling (l2));
g_assert (gtk_widget_get_first_child (box) == l1);
g_assert (gtk_widget_get_last_child (box) == l2);
g_assert_true (gtk_widget_get_first_child (box) == l1);
g_assert_true (gtk_widget_get_last_child (box) == l2);
}
static void
@ -52,16 +52,16 @@ prepend (void)
/* l2 should now be *before* l1 */
g_assert (gtk_widget_get_parent (l1) == p);
g_assert (gtk_widget_get_prev_sibling (l1) == l2);
g_assert (gtk_widget_get_next_sibling (l1) == NULL);
g_assert_true (gtk_widget_get_parent (l1) == p);
g_assert_true (gtk_widget_get_prev_sibling (l1) == l2);
g_assert_null (gtk_widget_get_next_sibling (l1));
g_assert (gtk_widget_get_parent (l2) == p);
g_assert (gtk_widget_get_prev_sibling (l2) == NULL);
g_assert (gtk_widget_get_next_sibling (l2) == l1);
g_assert_true (gtk_widget_get_parent (l2) == p);
g_assert_null (gtk_widget_get_prev_sibling (l2));
g_assert_true (gtk_widget_get_next_sibling (l2) == l1);
g_assert (gtk_widget_get_first_child (p) == l2);
g_assert (gtk_widget_get_last_child (p) == l1);
g_assert_true (gtk_widget_get_first_child (p) == l2);
g_assert_true (gtk_widget_get_last_child (p) == l1);
}
static void
@ -74,16 +74,16 @@ append (void)
gtk_widget_set_parent (l1, p);
gtk_widget_insert_before (l2, p, NULL);
g_assert (gtk_widget_get_parent (l1) == p);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_parent (l1) == p);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_parent (l2) == p);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
g_assert_true (gtk_widget_get_parent (l2) == p);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_null (gtk_widget_get_next_sibling (l2));
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l2);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l2);
}
static void
@ -97,30 +97,30 @@ insert_after (void)
gtk_widget_set_parent (l1, p);
gtk_widget_set_parent (l3, p);
g_assert (gtk_widget_get_parent (l1) == p);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l3);
g_assert_true (gtk_widget_get_parent (l1) == p);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l3);
g_assert (gtk_widget_get_parent (l3) == p);
g_assert (gtk_widget_get_prev_sibling (l3) == l1);
g_assert (gtk_widget_get_next_sibling (l3) == NULL);
g_assert_true (gtk_widget_get_parent (l3) == p);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l1);
g_assert_null (gtk_widget_get_next_sibling (l3));
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
/* Now add l2 between l1 and l3 */
gtk_widget_insert_after (l2, p, l1);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_parent (l2) == p);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == l3);
g_assert_true (gtk_widget_get_parent (l2) == p);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_true (gtk_widget_get_next_sibling (l2) == l3);
g_assert (gtk_widget_get_prev_sibling (l3) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l2);
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
}
static void
@ -134,30 +134,30 @@ insert_before (void)
gtk_widget_set_parent (l1, p);
gtk_widget_set_parent (l3, p);
g_assert (gtk_widget_get_parent (l1) == p);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l3);
g_assert_true (gtk_widget_get_parent (l1) == p);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l3);
g_assert (gtk_widget_get_parent (l3) == p);
g_assert (gtk_widget_get_prev_sibling (l3) == l1);
g_assert (gtk_widget_get_next_sibling (l3) == NULL);
g_assert_true (gtk_widget_get_parent (l3) == p);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l1);
g_assert_null (gtk_widget_get_next_sibling (l3));
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
/* Now add l2 between l1 and l3 */
gtk_widget_insert_before (l2, p, l3);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_parent (l2) == p);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == l3);
g_assert_true (gtk_widget_get_parent (l2) == p);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_true (gtk_widget_get_next_sibling (l2) == l3);
g_assert (gtk_widget_get_prev_sibling (l3) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l2);
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
}
static void
@ -168,26 +168,26 @@ insert_after_self (void)
gtk_widget_insert_after (l, p, NULL);
g_assert (gtk_widget_get_parent (l) == p);
g_assert (gtk_widget_get_prev_sibling (l) == NULL);
g_assert (gtk_widget_get_next_sibling (l) == NULL);
g_assert (gtk_widget_get_first_child (l) == NULL);
g_assert (gtk_widget_get_last_child (l) == NULL);
g_assert_true (gtk_widget_get_parent (l) == p);
g_assert_null (gtk_widget_get_prev_sibling (l));
g_assert_null (gtk_widget_get_next_sibling (l));
g_assert_null (gtk_widget_get_first_child (l));
g_assert_null (gtk_widget_get_last_child (l));
g_assert (gtk_widget_get_first_child (p) == l);
g_assert (gtk_widget_get_last_child (p) == l);
g_assert_true (gtk_widget_get_first_child (p) == l);
g_assert_true (gtk_widget_get_last_child (p) == l);
/* Insert l after l */
gtk_widget_insert_after (l, p, l);
g_assert (gtk_widget_get_parent (l) == p);
g_assert (gtk_widget_get_prev_sibling (l) == NULL);
g_assert (gtk_widget_get_next_sibling (l) == NULL);
g_assert (gtk_widget_get_first_child (l) == NULL);
g_assert (gtk_widget_get_last_child (l) == NULL);
g_assert_true (gtk_widget_get_parent (l) == p);
g_assert_null (gtk_widget_get_prev_sibling (l));
g_assert_null (gtk_widget_get_next_sibling (l));
g_assert_null (gtk_widget_get_first_child (l));
g_assert_null (gtk_widget_get_last_child (l));
g_assert (gtk_widget_get_first_child (p) == l);
g_assert (gtk_widget_get_last_child (p) == l);
g_assert_true (gtk_widget_get_first_child (p) == l);
g_assert_true (gtk_widget_get_last_child (p) == l);
}
static void
@ -198,26 +198,26 @@ insert_before_self (void)
gtk_widget_insert_before (l, p, NULL);
g_assert (gtk_widget_get_parent (l) == p);
g_assert (gtk_widget_get_prev_sibling (l) == NULL);
g_assert (gtk_widget_get_next_sibling (l) == NULL);
g_assert (gtk_widget_get_first_child (l) == NULL);
g_assert (gtk_widget_get_last_child (l) == NULL);
g_assert_true (gtk_widget_get_parent (l) == p);
g_assert_null (gtk_widget_get_prev_sibling (l));
g_assert_null (gtk_widget_get_next_sibling (l));
g_assert_null (gtk_widget_get_first_child (l));
g_assert_null (gtk_widget_get_last_child (l));
g_assert (gtk_widget_get_first_child (p) == l);
g_assert (gtk_widget_get_last_child (p) == l);
g_assert_true (gtk_widget_get_first_child (p) == l);
g_assert_true (gtk_widget_get_last_child (p) == l);
/* Insert l before l */
gtk_widget_insert_before (l, p, l);
g_assert (gtk_widget_get_parent (l) == p);
g_assert (gtk_widget_get_prev_sibling (l) == NULL);
g_assert (gtk_widget_get_next_sibling (l) == NULL);
g_assert (gtk_widget_get_first_child (l) == NULL);
g_assert (gtk_widget_get_last_child (l) == NULL);
g_assert_true (gtk_widget_get_parent (l) == p);
g_assert_null (gtk_widget_get_prev_sibling (l));
g_assert_null (gtk_widget_get_next_sibling (l));
g_assert_null (gtk_widget_get_first_child (l));
g_assert_null (gtk_widget_get_last_child (l));
g_assert (gtk_widget_get_first_child (p) == l);
g_assert (gtk_widget_get_last_child (p) == l);
g_assert_true (gtk_widget_get_first_child (p) == l);
g_assert_true (gtk_widget_get_last_child (p) == l);
}
static void
@ -231,47 +231,47 @@ reorder_after (void)
gtk_widget_set_parent (l1, p);
gtk_widget_set_parent (l3, p);
g_assert (gtk_widget_get_parent (l1) == p);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l3);
g_assert_true (gtk_widget_get_parent (l1) == p);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l3);
g_assert (gtk_widget_get_parent (l3) == p);
g_assert (gtk_widget_get_prev_sibling (l3) == l1);
g_assert (gtk_widget_get_next_sibling (l3) == NULL);
g_assert_true (gtk_widget_get_parent (l3) == p);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l1);
g_assert_null (gtk_widget_get_next_sibling (l3));
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
/* Now add l2 between l1 and l3 */
gtk_widget_insert_before (l2, p, l3);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_parent (l2) == p);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == l3);
g_assert_true (gtk_widget_get_parent (l2) == p);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_true (gtk_widget_get_next_sibling (l2) == l3);
g_assert (gtk_widget_get_prev_sibling (l3) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l2);
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
/* The order is now l1, l2, l3. Now reorder l3 after l1 so
* the correct order is l1, l3, l2 */
gtk_widget_insert_after (l3, p, l1);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l3);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l3);
g_assert (gtk_widget_get_prev_sibling (l3) == l1);
g_assert (gtk_widget_get_next_sibling (l3) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l1);
g_assert_true (gtk_widget_get_next_sibling (l3) == l2);
g_assert (gtk_widget_get_prev_sibling (l2) == l3);
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l3);
g_assert_null (gtk_widget_get_next_sibling (l2));
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l2);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l2);
}
static void
@ -285,47 +285,47 @@ reorder_before (void)
gtk_widget_set_parent (l1, p);
gtk_widget_set_parent (l3, p);
g_assert (gtk_widget_get_parent (l1) == p);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l3);
g_assert_true (gtk_widget_get_parent (l1) == p);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l3);
g_assert (gtk_widget_get_parent (l3) == p);
g_assert (gtk_widget_get_prev_sibling (l3) == l1);
g_assert (gtk_widget_get_next_sibling (l3) == NULL);
g_assert_true (gtk_widget_get_parent (l3) == p);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l1);
g_assert_null (gtk_widget_get_next_sibling (l3));
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
/* Now add l2 between l1 and l3 */
gtk_widget_insert_before (l2, p, l3);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_parent (l2) == p);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == l3);
g_assert_true (gtk_widget_get_parent (l2) == p);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_true (gtk_widget_get_next_sibling (l2) == l3);
g_assert (gtk_widget_get_prev_sibling (l3) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l2);
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
/* The order is now l1, l2, l3. Now reorder l3 before l2 so
* the correct order is l1, l3, l2 */
gtk_widget_insert_before (l3, p, l2);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l3);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l3);
g_assert (gtk_widget_get_prev_sibling (l3) == l1);
g_assert (gtk_widget_get_next_sibling (l3) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l1);
g_assert_true (gtk_widget_get_next_sibling (l3) == l2);
g_assert (gtk_widget_get_prev_sibling (l2) == l3);
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l3);
g_assert_null (gtk_widget_get_next_sibling (l2));
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l2);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l2);
}
static void
@ -339,47 +339,47 @@ reorder_start (void)
gtk_widget_set_parent (l1, p);
gtk_widget_set_parent (l3, p);
g_assert (gtk_widget_get_parent (l1) == p);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l3);
g_assert_true (gtk_widget_get_parent (l1) == p);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l3);
g_assert (gtk_widget_get_parent (l3) == p);
g_assert (gtk_widget_get_prev_sibling (l3) == l1);
g_assert (gtk_widget_get_next_sibling (l3) == NULL);
g_assert_true (gtk_widget_get_parent (l3) == p);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l1);
g_assert_null (gtk_widget_get_next_sibling (l3));
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
/* Now add l2 between l1 and l3 */
gtk_widget_insert_before (l2, p, l3);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_parent (l2) == p);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == l3);
g_assert_true (gtk_widget_get_parent (l2) == p);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_true (gtk_widget_get_next_sibling (l2) == l3);
g_assert (gtk_widget_get_prev_sibling (l3) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l2);
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
/* The order is now l1, l2, l3. Now reorder l3 to the start so
* the correct order is l3, l1, l2 */
gtk_widget_insert_after (l3, p, NULL);
g_assert (gtk_widget_get_prev_sibling (l1) == l3);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l1) == l3);
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_prev_sibling (l3) == NULL);
g_assert (gtk_widget_get_next_sibling (l3) == l1);
g_assert_null (gtk_widget_get_prev_sibling (l3));
g_assert_true (gtk_widget_get_next_sibling (l3) == l1);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_null (gtk_widget_get_next_sibling (l2));
g_assert (gtk_widget_get_first_child (p) == l3);
g_assert (gtk_widget_get_last_child (p) == l2);
g_assert_true (gtk_widget_get_first_child (p) == l3);
g_assert_true (gtk_widget_get_last_child (p) == l2);
}
static void
@ -393,47 +393,47 @@ reorder_end (void)
gtk_widget_set_parent (l1, p);
gtk_widget_set_parent (l3, p);
g_assert (gtk_widget_get_parent (l1) == p);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l3);
g_assert_true (gtk_widget_get_parent (l1) == p);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l3);
g_assert (gtk_widget_get_parent (l3) == p);
g_assert (gtk_widget_get_prev_sibling (l3) == l1);
g_assert (gtk_widget_get_next_sibling (l3) == NULL);
g_assert_true (gtk_widget_get_parent (l3) == p);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l1);
g_assert_null (gtk_widget_get_next_sibling (l3));
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
/* Now add l2 between l1 and l3 */
gtk_widget_insert_before (l2, p, l3);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_parent (l2) == p);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == l3);
g_assert_true (gtk_widget_get_parent (l2) == p);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_true (gtk_widget_get_next_sibling (l2) == l3);
g_assert (gtk_widget_get_prev_sibling (l3) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l2);
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l3);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l3);
/* The order is now l1, l2, l3. Now reorder l1 to the end so
* the correct order is l2, l3, l1 */
gtk_widget_insert_before (l1, p, NULL);
g_assert (gtk_widget_get_prev_sibling (l1) == l3);
g_assert (gtk_widget_get_next_sibling (l1) == NULL);
g_assert_true (gtk_widget_get_prev_sibling (l1) == l3);
g_assert_null (gtk_widget_get_next_sibling (l1));
g_assert (gtk_widget_get_prev_sibling (l3) == l2);
g_assert (gtk_widget_get_next_sibling (l3) == l1);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l2);
g_assert_true (gtk_widget_get_next_sibling (l3) == l1);
g_assert (gtk_widget_get_prev_sibling (l2) == NULL);
g_assert (gtk_widget_get_next_sibling (l2) == l3);
g_assert_null (gtk_widget_get_prev_sibling (l2));
g_assert_true (gtk_widget_get_next_sibling (l2) == l3);
g_assert (gtk_widget_get_first_child (p) == l2);
g_assert (gtk_widget_get_last_child (p) == l1);
g_assert_true (gtk_widget_get_first_child (p) == l2);
g_assert_true (gtk_widget_get_last_child (p) == l1);
}
static void
@ -446,28 +446,28 @@ same_after (void)
gtk_widget_set_parent (l1, p);
gtk_widget_set_parent (l2, p);
g_assert (gtk_widget_get_parent (l1) == p);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_parent (l1) == p);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_parent (l2) == p);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
g_assert_true (gtk_widget_get_parent (l2) == p);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_null (gtk_widget_get_next_sibling (l2));
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l2);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l2);
/* l2 is already after l1, so this shouldn't change anything! */
gtk_widget_insert_after (l2, p, l1);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_null (gtk_widget_get_next_sibling (l2));
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l2);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l2);
}
static void
@ -480,28 +480,28 @@ same_before (void)
gtk_widget_set_parent (l1, p);
gtk_widget_set_parent (l2, p);
g_assert (gtk_widget_get_parent (l1) == p);
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_parent (l1) == p);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_parent (l2) == p);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
g_assert_true (gtk_widget_get_parent (l2) == p);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_null (gtk_widget_get_next_sibling (l2));
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l2);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l2);
/* l1 is already before l2, so this shouldn't change anything! */
gtk_widget_insert_before (l1, p, l2);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_null (gtk_widget_get_next_sibling (l2));
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_first_child (p) == l1);
g_assert (gtk_widget_get_last_child (p) == l2);
g_assert_true (gtk_widget_get_first_child (p) == l1);
g_assert_true (gtk_widget_get_last_child (p) == l2);
}
static void
@ -520,29 +520,29 @@ no_loop (void)
gtk_widget_insert_after (l1, p, l3);
/* Now: l2 -> l3 -> l1 */
g_assert (gtk_widget_get_prev_sibling (l2) == NULL);
g_assert (gtk_widget_get_next_sibling (l2) == l3);
g_assert (gtk_widget_get_next_sibling (l3) == l1);
g_assert (gtk_widget_get_next_sibling (l1) == NULL);
g_assert (gtk_widget_get_prev_sibling (l1) == l3);
g_assert_null (gtk_widget_get_prev_sibling (l2));
g_assert_true (gtk_widget_get_next_sibling (l2) == l3);
g_assert_true (gtk_widget_get_next_sibling (l3) == l1);
g_assert_null (gtk_widget_get_next_sibling (l1));
g_assert_true (gtk_widget_get_prev_sibling (l1) == l3);
gtk_widget_insert_after (l2, p, l1);
/* Now: l3 -> l1 -> l2 */
g_assert (gtk_widget_get_prev_sibling (l3) == NULL);
g_assert (gtk_widget_get_next_sibling (l3) == l1);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert (gtk_widget_get_prev_sibling (l1) == l3);
g_assert (gtk_widget_get_prev_sibling (l2) == l1);
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
g_assert_null (gtk_widget_get_prev_sibling (l3));
g_assert_true (gtk_widget_get_next_sibling (l3) == l1);
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l1) == l3);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l1);
g_assert_null (gtk_widget_get_next_sibling (l2));
gtk_widget_insert_after (l1, p, NULL);
/* Now: l1 -> l3 -> l2 */
g_assert (gtk_widget_get_prev_sibling (l1) == NULL);
g_assert (gtk_widget_get_next_sibling (l1) == l3);
g_assert (gtk_widget_get_next_sibling (l3) == l2);
g_assert (gtk_widget_get_prev_sibling (l3) == l1);
g_assert (gtk_widget_get_prev_sibling (l2) == l3);
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
g_assert_null (gtk_widget_get_prev_sibling (l1));
g_assert_true (gtk_widget_get_next_sibling (l1) == l3);
g_assert_true (gtk_widget_get_next_sibling (l3) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l3) == l1);
g_assert_true (gtk_widget_get_prev_sibling (l2) == l3);
g_assert_null (gtk_widget_get_next_sibling (l2));
}
static void
@ -552,30 +552,30 @@ reorder_refcount (void)
GtkWidget *l1 = gtk_label_new ("");
GtkWidget *l2 = gtk_label_new ("");
g_assert (g_object_is_floating (l1));
g_assert (G_OBJECT (l1)->ref_count == 1);
g_assert_true (g_object_is_floating (l1));
g_assert_cmpint (G_OBJECT (l1)->ref_count, ==, 1);
gtk_widget_set_parent (l1, p);
g_assert (!g_object_is_floating (l1));
g_assert (G_OBJECT (l1)->ref_count == 1);
g_assert_true (!g_object_is_floating (l1));
g_assert_cmpint (G_OBJECT (l1)->ref_count, ==, 1);
g_assert (g_object_is_floating (l2));
g_assert (G_OBJECT (l2)->ref_count == 1);
g_assert_true (g_object_is_floating (l2));
g_assert_cmpint (G_OBJECT (l2)->ref_count, ==, 1);
gtk_widget_set_parent (l2, p);
g_assert (!g_object_is_floating (l2));
g_assert (G_OBJECT (l2)->ref_count == 1);
g_assert_true (!g_object_is_floating (l2));
g_assert_cmpint (G_OBJECT (l2)->ref_count, ==, 1);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
g_assert_true (gtk_widget_get_next_sibling (l1) == l2);
gtk_widget_insert_before (l2, p, l1);
g_assert (gtk_widget_get_prev_sibling (l1) == l2);
g_assert_true (gtk_widget_get_prev_sibling (l1) == l2);
g_assert (G_OBJECT (l1)->ref_count == 1);
g_assert (G_OBJECT (l2)->ref_count == 1);
g_assert_cmpint (G_OBJECT (l1)->ref_count, ==, 1);
g_assert_cmpint (G_OBJECT (l2)->ref_count, ==, 1);
gtk_widget_unparent (l1);
gtk_widget_unparent (l2);