2009-27-09 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, -100, 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     
35   my_atk_object_add_child(MY_ATK_OBJECT(comps[2]), MY_ATK_OBJECT(comps[0]));
36   my_atk_object_add_child(MY_ATK_OBJECT(comps[2]), MY_ATK_OBJECT(comps[1]));
37 }
38
39 G_MODULE_EXPORT void
40 test_next (int argc, char *argv[])
41 {
42   g_print("Moving to next stage\n");
43 }
44
45 G_MODULE_EXPORT void
46 test_finished (int argc, char *argv[])
47 {
48   g_print("Test has completed\n");
49 }
50
51 G_MODULE_EXPORT AtkObject *
52 test_get_root (void)
53 {
54   return ATK_COMPONENT(comps[2]);
55 }