1 /* This is a small demo of the high-performance GUIX graphics framework. */
2 
3 #include <stdio.h>
4 #include "tx_api.h"
5 #include "gx_api.h"
6 #include "gx_validation_utility.h"
7 #include "gx_system.h"
8 
9 TEST_PARAM test_parameter = {
10    "guix_system_screen_stack", /* Test name */
11     0 , 0, 240, 320  /* Define the coordinates of the capture area.
12                          In this test, we only need to capture the pixelmap slider
13                          drawing area.  */
14 };
15 
16 static VOID      control_thread_entry(ULONG);
main(int argc,char ** argv)17 int main(int argc, char ** argv)
18 {
19     /* Parse the command line argument. */
20     gx_validation_setup(argc, argv);
21 
22     /* Start ThreadX system */
23     tx_kernel_enter();
24     return(0);
25 }
26 
tx_application_define(void * first_unused_memory)27 VOID tx_application_define(void *first_unused_memory)
28 {
29 
30     /* Create a dedicated thread to perform various operations
31        on the pixelmap drawing example. These operations simulate
32        user input. */
33     gx_validation_control_thread_create(control_thread_entry);
34 
35     /* Termiante the test if it runs for more than 100 ticks */
36     /* This function is not implemented yet. */
37     gx_validation_watchdog_create(100);
38 
39     /* Call the actual line example routine. */
40     gx_validation_application_define(first_unused_memory);
41 
42 }
43 
44 
45 /* Replace the default graphics driver with the validation driver. */
46 #ifdef win32_graphics_driver_setup_24xrgb
47 #undef win32_graphics_driver_setup_24xrgb
48 #endif
49 #define win32_graphics_driver_setup_24xrgb  gx_validation_graphics_driver_setup_24xrgb
50 
51 
52 #ifdef WIN32
53 #undef WIN32
54 #endif
55 
56 #include "gx_validation_wrapper.h"
57 
58 #include "demo_guix_system_screen_stack.c"
59 
60 typedef struct TEST_STRUCT{
61 int xpos;
62 int ypos;
63 int steps;
64 char *comment;
65 }TEST;
66 
67 TEST test_list[]={
68 {151, 135, 20, "click on bookshelf button"},
69 {112,  76,  1, "click on one book"},
70 {112,  76,  1, "click on setting button"},
71 {112,  76,  1, "click on language setting button"},
72 {179,  13, 10, "click home button"},
73 {151, 135, 20, "click on bookshelf button"},
74 {112,  76,  1, "click on one book"},
75 {112,  76,  1, "click on setting button"},
76 {112,  76,  1, "click on language setting button"},
77 {29,   12,  1, "click on back icon"},
78 {29,   12,  1, "click on back icon"},
79 {29,   12,  1, "click on back icon"},
80 {29,   12, 20, "click on back icon"},
81 {59,  179,  1, "click on setting button"},
82 {112,  76,  1, "click on language setting button"},
83 {29,   12,  1, "click on back icon"},
84 {29,   12,  1, "click on back icon"},
85 {59,  179,  1, "click on setting button"},
86 {112,  76,  1, "click on language setting button"},
87 {179,  13, 10, "click on home button"},
88 {0,     0,  0, ""}
89 };
90 
91 /* This thread simulates user input.  Its priority is lower
92    than the GUIX thread, so that GUIX finishes an operation
93    before this thread is able to issue the next command. */
control_thread_entry(ULONG input)94 static VOID control_thread_entry(ULONG input)
95 {
96 GX_EVENT my_event;
97 int      frame_id = 1;
98 TEST    *entry = test_list;
99 char *comment[1];
100 
101     memset(&my_event, 0, sizeof(GX_EVENT));
102 
103     while(entry->steps)
104     {
105         gx_validation_current_frame_id_get(&frame_id);
106         comment[0] = entry->comment;
107 GX_ENTER_CRITICAL
108         tx_thread_sleep(1);
109         gx_validation_capture_frames(frame_id, entry->steps, comment, 1, 1000);
110         my_event.gx_event_display_handle = 1;
111         my_event.gx_event_payload.gx_event_pointdata.gx_point_x = entry->xpos;
112         my_event.gx_event_payload.gx_event_pointdata.gx_point_y = entry->ypos;
113         my_event.gx_event_type = GX_EVENT_PEN_DOWN;
114         gx_system_event_send(&my_event);
115 
116         my_event.gx_event_type = GX_EVENT_PEN_UP;
117         gx_system_event_send(&my_event);
118 GX_EXIT_CRITICAL
119         gx_validation_capture_frames_wait();
120         entry++;
121     }
122 
123      /* Signal the end of the test case.  Verify the output. */
124     gx_validation_end();
125 
126     exit(0);
127 
128 }
129