2008-06-13 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / tests / apps / component-app.c
1 #include <gmodule.h>
2 #include <atk/atk.h>
3 #include <my-atk.h>
4
5 static gchar *tdata_path = NULL;
6
7 static AtkComponent *comps[] = {NULL, NULL, NULL};
8 static const AtkRectangle extents[] = {{0,0,30,20}, {40,30,30,40}, {0,0,70,70}};
9 static const AtkLayer layers[] = {ATK_LAYER_WINDOW, ATK_LAYER_WIDGET, ATK_LAYER_MDI};
10 static const guint zorders[] = {0, G_MININT, 100};
11 static const gboolean extent_may_changed[] = {TRUE, FALSE, TRUE};
12
13 G_MODULE_EXPORT void
14 test_init (gchar *path)
15 {
16   int i;
17
18   if (path == NULL)
19      g_error("No test data path provided");
20   tdata_path = path;
21
22   g_type_init();
23   for(i = 0; i < sizeof(comps) / sizeof(comps[0]); i++)
24     {
25       MyAtkComponent *mycomp = MY_ATK_COMPONENT(g_object_new(MY_TYPE_ATK_COMPONENT, NULL));
26         
27       mycomp->extent = extents[i];
28       mycomp->is_extent_may_changed = extent_may_changed[i];
29       mycomp->layer = layers[i];
30       mycomp->zorder = zorders[i];
31       
32       comps[i] = ATK_COMPONENT(mycomp);
33     }
34     atk_object_set_parent((AtkObject*)comps[0],(AtkObject*)comps[2]);
35     atk_object_set_parent((AtkObject*)comps[1],(AtkObject*)comps[2]);
36 }
37
38 G_MODULE_EXPORT void
39 test_next (int argc, char *argv[])
40 {
41   g_print("Moving to next stage\n");
42 }
43
44 G_MODULE_EXPORT void
45 test_finished (int argc, char *argv[])
46 {
47   g_print("Test has completed\n");
48 }
49
50 G_MODULE_EXPORT AtkObject *
51 test_get_root (void)
52 {
53   return ATK_COMPONENT(comps[2]);
54 }