GnuCash  5.6-150-g038405b370+
gmock-qofinstance.cpp
1 #include <glib.h>
2 
3 #include <gmock/gmock.h>
4 
5 #include <qofinstance.h>
6 #include <qofinstance-p.h>
7 
8 
9 G_DEFINE_TYPE(QofInstance, qof_instance, G_TYPE_OBJECT)
10 
11 static void
12 qof_instance_init (QofInstance *inst)
13 {
14  // function is unused, initialization is done in the constructor of the derived mock class
15 }
16 
17 static void
18 qof_instance_class_init(QofInstanceClass *klass)
19 {
20  // function is unused, class functions are defined in C++ code
21 }
22 
23 // This is a reimplementation of the function from qofinstance.cpp
24 void
25 qof_instance_get (const QofInstance *inst, const gchar *first_prop, ...)
26 {
27  va_list ap;
28  ASSERT_TRUE (QOF_IS_INSTANCE (inst));
29 
30  va_start (ap, first_prop);
31  g_object_get_valist (G_OBJECT (inst), first_prop, ap);
32  va_end (ap);
33 }
34 
35 // This is a reimplementation of the function from qofinstance.cpp
36 // without calling qof_instance_set_dirty()
37 void
38 qof_instance_set (QofInstance *inst, const gchar *first_prop, ...)
39 {
40  va_list ap;
41  ASSERT_TRUE (QOF_IS_INSTANCE (inst));
42 
43  va_start (ap, first_prop);
44  g_object_set_valist (G_OBJECT (inst), first_prop, ap);
45  va_end (ap);
46 }
47 
void qof_instance_get(const QofInstance *inst, const gchar *first_prop,...)
Wrapper for g_object_get.
void qof_instance_set(QofInstance *inst, const gchar *first_prop,...)
Wrapper for g_object_set Group setting multiple parameters in a single begin/commit/rollback.
Object instance holds common fields that most gnucash objects use.