~behda/+junk/udisks2.original

« back to all changes in this revision

Viewing changes to src/tests/testutil.h

  • Committer: behda
  • Date: 2014-05-24 15:15:11 UTC
  • Revision ID: pauvitk@gmail.com-20140524151511-3vtr0uubjewx3z2j
Initial commit of source code and Debian packaging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* this really should be in GLib */
 
2
#include <gio/gio.h>
 
3
 
 
4
#define _g_assert_property_notify(object, property_name)                \
 
5
  do                                                                    \
 
6
    {                                                                   \
 
7
      if (!G_IS_OBJECT (object))                                        \
 
8
        {                                                               \
 
9
          g_assertion_message (G_LOG_DOMAIN,                            \
 
10
                               __FILE__,                                \
 
11
                               __LINE__,                                \
 
12
                               G_STRFUNC,                               \
 
13
                               "Not a GObject instance");               \
 
14
        }                                                               \
 
15
      if (g_object_class_find_property (G_OBJECT_GET_CLASS (object),    \
 
16
                                        property_name) == NULL)         \
 
17
        {                                                               \
 
18
          g_assertion_message (G_LOG_DOMAIN,                            \
 
19
                               __FILE__,                                \
 
20
                               __LINE__,                                \
 
21
                               G_STRFUNC,                               \
 
22
                               "Property " property_name " does not "   \
 
23
                               "exist on object");                      \
 
24
        }                                                               \
 
25
      if (_g_assert_property_notify_run (object, property_name))        \
 
26
        {                                                               \
 
27
          g_assertion_message (G_LOG_DOMAIN,                            \
 
28
                               __FILE__,                                \
 
29
                               __LINE__,                                \
 
30
                               G_STRFUNC,                               \
 
31
                               "Timed out waiting for notification "    \
 
32
                               "on property " property_name);           \
 
33
        }                                                               \
 
34
    }                                                                   \
 
35
  while (FALSE)
 
36
 
 
37
#define _g_assert_signal_received(object, signal_name, callback, user_data) \
 
38
  do                                                                    \
 
39
    {                                                                   \
 
40
      if (!G_IS_OBJECT (object))                                        \
 
41
        {                                                               \
 
42
          g_assertion_message (G_LOG_DOMAIN,                            \
 
43
                               __FILE__,                                \
 
44
                               __LINE__,                                \
 
45
                               G_STRFUNC,                               \
 
46
                               "Not a GObject instance");               \
 
47
        }                                                               \
 
48
      if (g_signal_lookup (signal_name,                                 \
 
49
                           G_TYPE_FROM_INSTANCE (object)) == 0)         \
 
50
        {                                                               \
 
51
          g_assertion_message (G_LOG_DOMAIN,                            \
 
52
                               __FILE__,                                \
 
53
                               __LINE__,                                \
 
54
                               G_STRFUNC,                               \
 
55
                               "Signal `" signal_name "' does not "     \
 
56
                               "exist on object");                      \
 
57
        }                                                               \
 
58
      if (_g_assert_signal_received_run (object, signal_name, callback, user_data)) \
 
59
        {                                                               \
 
60
          g_assertion_message (G_LOG_DOMAIN,                            \
 
61
                               __FILE__,                                \
 
62
                               __LINE__,                                \
 
63
                               G_STRFUNC,                               \
 
64
                               "Timed out waiting for signal `"         \
 
65
                               signal_name "'");                        \
 
66
        }                                                               \
 
67
    }                                                                   \
 
68
  while (FALSE)
 
69
 
 
70
gboolean _g_assert_property_notify_run (gpointer     object,
 
71
                                        const gchar *property_name);
 
72
 
 
73
 
 
74
gboolean _g_assert_signal_received_run (gpointer     object,
 
75
                                        const gchar *signal_name,
 
76
                                        GCallback    callback,
 
77
                                        gpointer     user_data);