diff options
Diffstat (limited to 'tests/test-tpl-observer.c')
-rw-r--r-- | tests/test-tpl-observer.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test-tpl-observer.c b/tests/test-tpl-observer.c new file mode 100644 index 0000000..ea8db70 --- /dev/null +++ b/tests/test-tpl-observer.c @@ -0,0 +1,31 @@ +#include <telepathy-logger/observer.h> + +int +main (int argc, char **argv) +{ + TplObserver *obs, *obs2; + + g_type_init (); + + obs = tpl_observer_new (); + + /* TplObserver is a singleton, be sure both point to the same memory */ + obs2 = tpl_observer_new (); + g_assert (obs == obs2); + + /* unref the second singleton pointer and check that the it is still + * valid: checking correct object ref-counting after each _dup() call */ + g_object_unref (obs2); + g_assert (TPL_IS_OBSERVER (obs)); + + /* it points to the same mem area, it should be still valid */ + g_assert (TPL_IS_OBSERVER (obs2)); + + /* proper disposal for the singleton when no references are present */ + g_object_unref (obs); + g_assert (!TPL_IS_OBSERVER (obs)); + + + return 0; +} + |