/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to tests/callback.c

* Merge callback system fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "../libssts/SimpleTypeSystem.h"
 
2
#include "callback.h"
 
3
#include "test_macros.h"
 
4
 
 
5
int
 
6
test_callback_test_func1 (SObject * obj, spointer user_data) {
 
7
  return 2;
 
8
}
 
9
 
 
10
spointer
 
11
test_callback_test_func2 (SObject * obj, spointer user_data) {
 
12
 
 
13
  return NULL;
 
14
}
 
15
 
 
16
enum {
 
17
  TEST_CALLBACK1,
 
18
  TEST_CALLBACK2,
 
19
  TEST_CALLBACK_END
 
20
};
 
21
 
 
22
static SCallbackEntry * callback_entries[] = {NULL,};
 
23
 
 
24
int
 
25
test_callback (void) {
 
26
  setup_unit ();
 
27
 
 
28
  SObject * obj = s_object_new ();
 
29
 
 
30
  callback_entries[TEST_CALLBACK1] =
 
31
    s_callback_entry_new ("test1",
 
32
                          test_callback_test_func1,
 
33
                          S_CALLBACK_CALLBACK);
 
34
 
 
35
  callback_entries[TEST_CALLBACK2] =
 
36
    s_callback_entry_new ("test2",
 
37
                          test_callback_test_func2,
 
38
                          S_CALLBACK_CALLBACK);
 
39
 
 
40
  s_object_install_callbacks (obj, TEST_CALLBACK_END, callback_entries);
 
41
 
 
42
  s_object_free (obj);
 
43
 
 
44
  end_unit ();
 
45
}