mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-25 18:30:23 -06:00
66c5e398ae
g_assert() can be compiled out, so should not be used for tests
g_assert_true was removed
to fis https://bugs.gnucash.org/show_bug.cgi?id=792008 because
g_assert_true was introduced in glib-2.38 and at the time GnuCash required
only glib-2.26. GnuCash has required glib >= 2.40 since 8acbc41c6
so
g_assert_true can be restored.
29 lines
636 B
C
29 lines
636 B
C
#ifndef GMOCK_GOBJECT_H
|
|
#define GMOCK_GOBJECT_H
|
|
|
|
#include <glib.h>
|
|
#include <glib-object.h>
|
|
|
|
static gpointer
|
|
mock_g_object_new (GType object_type, const gchar *first_property_name, size_t size)
|
|
{
|
|
GTypeQuery query;
|
|
|
|
g_type_query(object_type, &query);
|
|
g_assert_true (size == query.instance_size);
|
|
return g_object_new (object_type, first_property_name);
|
|
}
|
|
|
|
static void
|
|
mock_g_object_unref (gpointer object, size_t size)
|
|
{
|
|
GType object_type = G_OBJECT_TYPE(object);
|
|
GTypeQuery query;
|
|
|
|
g_type_query(object_type, &query);
|
|
g_assert_true (size == query.instance_size);
|
|
g_object_unref(object);
|
|
}
|
|
|
|
#endif
|