43 void (*test_signal1) (GTest * test, gint an_int); |
43 void (*test_signal1) (GTest * test, gint an_int); |
44 void (*test_signal2) (GTest * test, gint an_int); |
44 void (*test_signal2) (GTest * test, gint an_int); |
45 void (*test_signal3) (GTest * test, gint an_int); |
45 void (*test_signal3) (GTest * test, gint an_int); |
46 } GTestClass; |
46 } GTestClass; |
47 |
47 |
48 #define G_TYPE_TEST (g_test_get_type ()) |
48 #define G_TYPE_TEST (my_test_get_type ()) |
49 #define G_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest)) |
49 #define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest)) |
50 #define G_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST)) |
50 #define MY_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST)) |
51 #define G_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass)) |
51 #define MY_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass)) |
52 #define G_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST)) |
52 #define MY_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST)) |
53 #define G_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass)) |
53 #define MY_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass)) |
54 |
54 |
55 G_DEFINE_TYPE (GTest, g_test, G_TYPE_OBJECT); |
55 G_DEFINE_TYPE (GTest, my_test, G_TYPE_OBJECT); |
56 |
56 |
57 /* --- variables --- */ |
57 /* --- variables --- */ |
58 static volatile gboolean stopping = FALSE; |
58 static volatile gboolean stopping = FALSE; |
59 static guint test_signal1 = 0; |
59 static guint test_signal1 = 0; |
60 static guint test_signal2 = 0; |
60 static guint test_signal2 = 0; |
67 static gboolean seen_thread1 = FALSE; |
67 static gboolean seen_thread1 = FALSE; |
68 static gboolean seen_thread2 = FALSE; |
68 static gboolean seen_thread2 = FALSE; |
69 |
69 |
70 /* --- functions --- */ |
70 /* --- functions --- */ |
71 static void |
71 static void |
72 g_test_init (GTest * test) |
72 my_test_init (GTest * test) |
73 { |
73 { |
74 //g_print ("init %p\n", test); |
74 //g_print ("init %p\n", test); |
75 |
75 |
76 test->value = 0; |
76 test->value = 0; |
77 test->test_pointer1 = TEST_POINTER1; |
77 test->test_pointer1 = TEST_POINTER1; |
118 break; |
118 break; |
119 } |
119 } |
120 } |
120 } |
121 |
121 |
122 static void |
122 static void |
123 g_test_test_signal2 (GTest *test, |
123 my_test_test_signal2 (GTest *test, |
124 gint an_int) |
124 gint an_int) |
125 { |
125 { |
126 } |
126 } |
127 |
127 |
128 static void |
128 static void |
129 g_test_emit_test_signal1 (GTest *test, |
129 my_test_emit_test_signal1 (GTest *test, |
|
130 gint vint) |
|
131 { |
|
132 g_signal_emit (G_OBJECT (test), test_signal1, 0, vint); |
|
133 } |
|
134 |
|
135 static void |
|
136 my_test_emit_test_signal2 (GTest *test, |
|
137 gint vint) |
|
138 { |
|
139 g_signal_emit (G_OBJECT (test), test_signal2, 0, vint); |
|
140 } |
|
141 |
|
142 static void |
|
143 my_test_emit_test_signal3 (GTest *test, |
130 gint vint) |
144 gint vint) |
131 { |
145 { |
132 g_signal_emit (G_OBJECT (test), test_signal1, 0, vint); |
|
133 } |
|
134 |
|
135 static void |
|
136 g_test_emit_test_signal2 (GTest *test, |
|
137 gint vint) |
|
138 { |
|
139 g_signal_emit (G_OBJECT (test), test_signal2, 0, vint); |
|
140 } |
|
141 |
|
142 static void |
|
143 g_test_emit_test_signal3 (GTest *test, |
|
144 gint vint) |
|
145 { |
|
146 g_signal_emit (G_OBJECT (test), test_signal3, 0, vint); |
146 g_signal_emit (G_OBJECT (test), test_signal3, 0, vint); |
147 } |
147 } |
148 static void |
148 static void |
149 g_test_class_init (GTestClass *klass) |
149 my_test_class_init (GTestClass *klass) |
150 { |
150 { |
151 GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
151 GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
152 |
152 |
153 gobject_class->set_property = g_test_set_property; |
153 gobject_class->set_property = my_test_set_property; |
154 gobject_class->get_property = g_test_get_property; |
154 gobject_class->get_property = my_test_get_property; |
155 |
155 |
156 test_signal1 = g_signal_new ("test-signal1", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, |
156 test_signal1 = g_signal_new ("test-signal1", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, |
157 G_STRUCT_OFFSET (GTestClass, test_signal1), NULL, NULL, |
157 G_STRUCT_OFFSET (GTestClass, test_signal1), NULL, NULL, |
158 g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); |
158 g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); |
159 test_signal2 = g_signal_new ("test-signal2", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, |
159 test_signal2 = g_signal_new ("test-signal2", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, |
166 |
166 |
167 |
167 |
168 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TEST_PROP, |
168 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TEST_PROP, |
169 g_param_spec_int ("test-prop", "Test Prop", "Test property", |
169 g_param_spec_int ("test-prop", "Test Prop", "Test property", |
170 0, 1, 0, G_PARAM_READWRITE)); |
170 0, 1, 0, G_PARAM_READWRITE)); |
171 klass->test_signal2 = g_test_test_signal2; |
171 klass->test_signal2 = my_test_test_signal2; |
172 klass->test_signal3 = g_test_test_signal2; |
172 klass->test_signal3 = my_test_test_signal2; |
173 } |
173 } |
174 |
174 |
175 static inline guint32 |
175 static inline guint32 |
176 quick_rand32 (void) |
176 quick_rand32 (void) |
177 { |
177 { |
278 GThread *thread1, *thread2; |
278 GThread *thread1, *thread2; |
279 GClosure *closure, *closure1; |
279 GClosure *closure, *closure1; |
280 GTest *object; |
280 GTest *object; |
281 guint i; |
281 guint i; |
282 |
282 |
283 #ifdef SYMBIAN |
283 #ifdef __SYMBIAN32__ |
284 g_log_set_handler (NULL, G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL); |
284 g_log_set_handler (NULL, G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL); |
285 g_set_print_handler(mrtPrintHandler); |
285 g_set_print_handler(mrtPrintHandler); |
286 #endif /*SYMBIAN*/ |
286 #endif /*__SYMBIAN32__*/ |
287 |
|
288 g_thread_init (NULL); |
287 g_thread_init (NULL); |
289 |
288 |
290 //g_print ("START: %s\n", argv[0]); |
289 //g_print ("START: %s\n", argv[0]); |
291 |
290 |
292 g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK)); |
291 g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK)); |