Skip to content

Commit

Permalink
tests: Update property notify test for G_PARAM_EXPLICIT_NOTIFY
Browse files Browse the repository at this point in the history
GLib 2.42 is mandatory for some time.
  • Loading branch information
ricotz committed May 27, 2024
1 parent 9688b0c commit 8511971
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 9 additions & 4 deletions tests/objects/property-notify.c-expected
Original file line number Diff line number Diff line change
Expand Up @@ -336,20 +336,25 @@ _vala_main (void)
Foo* foo = NULL;
Foo* _tmp0_;
GValue _tmp1_ = {0};
GValue _tmp2_ = {0};
_tmp0_ = foo_new ();
foo = _tmp0_;
g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::foo", (GCallback) _fail_g_object_notify, NULL);
g_value_init (&_tmp1_, G_TYPE_STRING);
g_value_set_string (&_tmp1_, "foo");
g_object_set_property (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "foo", &_tmp1_);
G_IS_VALUE (&_tmp1_) ? (g_value_unset (&_tmp1_), NULL) : NULL;
foo_set_foo (foo, "foo");
counter = 0;
g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::bar", (GCallback) _count_g_object_notify, NULL);
foo_set_bar (foo, "bar");
_vala_assert (counter == 1, "counter == 1");
counter = 0;
g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::manam", (GCallback) _count_g_object_notify, NULL);
g_value_init (&_tmp1_, G_TYPE_STRING);
g_value_set_string (&_tmp1_, "manam");
g_object_set_property (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "manam", &_tmp1_);
G_IS_VALUE (&_tmp1_) ? (g_value_unset (&_tmp1_), NULL) : NULL;
g_value_init (&_tmp2_, G_TYPE_STRING);
g_value_set_string (&_tmp2_, "manam");
g_object_set_property (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "manam", &_tmp2_);
G_IS_VALUE (&_tmp2_) ? (g_value_unset (&_tmp2_), NULL) : NULL;
_vala_assert (counter == 1, "counter == 1");
_g_object_unref0 (foo);
}
Expand Down
3 changes: 1 addition & 2 deletions tests/objects/property-notify.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ void main () {
var foo = new Foo ();

foo.notify["foo"].connect (fail);
//FIXME Requires --target-glib=2.42 for G_PARAM_EXPLICIT_NOTIFY to be actually added
//foo.set_property ("foo", "foo");
foo.set_property ("foo", "foo");
foo.foo = "foo";

counter = 0;
Expand Down

0 comments on commit 8511971

Please sign in to comment.