9 #include "mrt2_glib2_test.h" |
9 #include "mrt2_glib2_test.h" |
10 #endif /*SYMBIAN*/ |
10 #endif /*SYMBIAN*/ |
11 |
11 |
12 |
12 |
13 |
13 |
14 #define G_TYPE_TEST (g_test_get_type ()) |
14 #define G_TYPE_TEST (my_test_get_type ()) |
15 #define G_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest)) |
15 #define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest)) |
16 #define G_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST)) |
16 #define MY_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST)) |
17 #define G_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass)) |
17 #define MY_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass)) |
18 #define G_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST)) |
18 #define MY_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST)) |
19 #define G_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass)) |
19 #define MY_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass)) |
20 |
20 |
21 typedef struct _GTest GTest; |
21 typedef struct _GTest GTest; |
22 typedef struct _GTestClass GTestClass; |
22 typedef struct _GTestClass GTestClass; |
23 |
23 |
24 struct _GTest |
24 struct _GTest |
29 struct _GTestClass |
29 struct _GTestClass |
30 { |
30 { |
31 GObjectClass parent_class; |
31 GObjectClass parent_class; |
32 }; |
32 }; |
33 |
33 |
34 static GType g_test_get_type (void); |
34 static GType my_test_get_type (void); |
35 static volatile gboolean stopping; |
35 static volatile gboolean stopping; |
36 |
36 |
37 static void g_test_class_init (GTestClass * klass); |
37 static void my_test_class_init (GTestClass * klass); |
38 static void g_test_init (GTest * test); |
38 static void my_test_init (GTest * test); |
39 static void g_test_dispose (GObject * object); |
39 static void my_test_dispose (GObject * object); |
40 |
40 |
41 static GObjectClass *parent_class = NULL; |
41 static GObjectClass *parent_class = NULL; |
42 |
42 |
43 static GType |
43 static GType |
44 g_test_get_type (void) |
44 my_test_get_type (void) |
45 { |
45 { |
46 static GType test_type = 0; |
46 static GType test_type = 0; |
47 |
47 |
48 if (!test_type) { |
48 if (!test_type) { |
49 static const GTypeInfo test_info = { |
49 static const GTypeInfo test_info = { |
50 sizeof (GTestClass), |
50 sizeof (GTestClass), |
51 NULL, |
51 NULL, |
52 NULL, |
52 NULL, |
53 (GClassInitFunc) g_test_class_init, |
53 (GClassInitFunc) my_test_class_init, |
54 NULL, |
54 NULL, |
55 NULL, |
55 NULL, |
56 sizeof (GTest), |
56 sizeof (GTest), |
57 0, |
57 0, |
58 (GInstanceInitFunc) g_test_init, |
58 (GInstanceInitFunc) my_test_init, |
59 NULL |
59 NULL |
60 }; |
60 }; |
61 |
61 |
62 test_type = g_type_register_static (G_TYPE_OBJECT, "GTest", |
62 test_type = g_type_register_static (G_TYPE_OBJECT, "GTest", |
63 &test_info, 0); |
63 &test_info, 0); |
64 } |
64 } |
65 return test_type; |
65 return test_type; |
66 } |
66 } |
67 |
67 |
68 static void |
68 static void |
69 g_test_class_init (GTestClass * klass) |
69 my_test_class_init (GTestClass * klass) |
70 { |
70 { |
71 GObjectClass *gobject_class; |
71 GObjectClass *gobject_class; |
72 |
72 |
73 gobject_class = (GObjectClass *) klass; |
73 gobject_class = (GObjectClass *) klass; |
74 |
74 |
75 parent_class = g_type_class_ref (G_TYPE_OBJECT); |
75 parent_class = g_type_class_ref (G_TYPE_OBJECT); |
76 |
76 |
77 gobject_class->dispose = g_test_dispose; |
77 gobject_class->dispose = my_test_dispose; |
78 } |
78 } |
79 |
79 |
80 static void |
80 static void |
81 g_test_init (GTest * test) |
81 my_test_init (GTest * test) |
82 { |
82 { |
83 //g_print ("init %p\n", test); |
83 //g_print ("init %p\n", test); |
84 } |
84 } |
85 |
85 |
86 static void |
86 static void |
87 g_test_dispose (GObject * object) |
87 my_test_dispose (GObject * object) |
88 { |
88 { |
89 GTest *test; |
89 GTest *test; |
90 |
90 |
91 test = G_TEST (object); |
91 test = MY_TEST (object); |
92 |
92 |
93 //g_print ("dispose %p!\n", object); |
93 //g_print ("dispose %p!\n", object); |
94 |
94 |
95 G_OBJECT_CLASS (parent_class)->dispose (object); |
95 G_OBJECT_CLASS (parent_class)->dispose (object); |
96 } |
96 } |
97 |
97 |
98 static void |
98 static void |
99 g_test_do_refcount (GTest * test) |
99 my_test_do_refcount (GTest * test) |
100 { |
100 { |
101 g_object_ref (test); |
101 g_object_ref (test); |
102 g_object_unref (test); |
102 g_object_unref (test); |
103 } |
103 } |
104 |
104 |