gdbus: fix generated code to not warn under -Wfloat-equal

https://bugzilla.gnome.org/show_bug.cgi?id=678333
This commit is contained in:
Dan Winship
2012-06-18 15:31:47 -04:00
parent 599d1a430e
commit 7d0db04223
2 changed files with 40 additions and 2 deletions

View File

@@ -1729,11 +1729,24 @@ on_object_proxy_removed (GDBusObjectManagerClient *manager,
om_data), ==, 1);
}
static void
property_d_changed (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
gboolean *changed = user_data;
*changed = TRUE;
}
static void
om_check_property_and_signal_emission (GMainLoop *loop,
FooiGenBar *skeleton,
FooiGenBar *proxy)
{
gboolean d_changed = FALSE;
guint handler;
/* First PropertiesChanged */
g_assert_cmpint (foo_igen_bar_get_i (skeleton), ==, 0);
g_assert_cmpint (foo_igen_bar_get_i (proxy), ==, 0);
@@ -1742,6 +1755,24 @@ om_check_property_and_signal_emission (GMainLoop *loop,
g_assert_cmpint (foo_igen_bar_get_i (skeleton), ==, 1);
g_assert_cmpint (foo_igen_bar_get_i (proxy), ==, 1);
/* Double-check the gdouble case */
g_assert_cmpfloat (foo_igen_bar_get_d (skeleton), ==, 0.0);
g_assert_cmpfloat (foo_igen_bar_get_d (proxy), ==, 0.0);
foo_igen_bar_set_d (skeleton, 1.0);
_g_assert_property_notify (proxy, "d");
/* Verify that re-setting it to the same value doesn't cause a
* notify on the proxy, by taking advantage of the fact that
* notifications are serialized.
*/
handler = g_signal_connect (proxy, "notify::d",
G_CALLBACK (property_d_changed), &d_changed);
foo_igen_bar_set_d (skeleton, 1.0);
foo_igen_bar_set_i (skeleton, 2);
_g_assert_property_notify (proxy, "i");
g_assert (d_changed == FALSE);
g_signal_handler_disconnect (proxy, handler);
/* Then just a regular signal */
foo_igen_bar_emit_another_signal (skeleton, "word");
_g_assert_signal_received (proxy, "another-signal");