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 
8 TEST_PARAM test_parameter = {
9     "guix_button_24xrgb", /* Test name */
10     111, 90, 260, 139  /* Define the coordinates of the capture area.
11                          In this test, we only need to capture the line
12                          drawing area.  */
13 };
14 
15 static VOID      control_thread_entry(ULONG);
main(int argc,char ** argv)16 int main(int argc, char ** argv)
17 {
18     /* Parse the command line argument. */
19     gx_validation_setup(argc, argv);
20 
21     /* Start ThreadX system */
22     tx_kernel_enter();
23     return(0);
24 }
25 
tx_application_define(void * first_unused_memory)26 VOID tx_application_define(void *first_unused_memory)
27 {
28 
29     /* Create a dedicated thread to perform various operations
30        on the line drawing example. These operations simulate
31        user input. */
32     gx_validation_control_thread_create(control_thread_entry);
33 
34     /* Termiante the test if it runs for more than 100 ticks */
35     /* This function is not implemented yet. */
36     gx_validation_watchdog_create(100);
37 
38     /* Call the actual line example routine. */
39     gx_validation_application_define(first_unused_memory);
40 
41 }
42 
43 
44 /* Replace the default graphics driver with the validation driver. */
45 #ifdef win32_graphics_driver_setup_24xrgb
46 #undef win32_graphics_driver_setup_24xrgb
47 #endif
48 #define win32_graphics_driver_setup_24xrgb  gx_validation_graphics_driver_setup_24xrgb
49 
50 
51 #ifdef WIN32
52 #undef WIN32
53 #endif
54 
55 #include "gx_validation_wrapper.h"
56 
57 #include "demo_guix_all_widgets.c"
58 /* Define the xpos values for the mouse. */
59 static int xpos_value[] = {111, 112, 116, 130, 144, 155, 167, 188, 201, 255};
60 
61 /* Define the ypos values for the mouse.*/
62 static int ypos_value[] = {90, 92, 95, 106, 117, 128, 136};
63 
64 static int Mouse_event[] = {GX_EVENT_PEN_DOWN, GX_EVENT_PEN_UP};
65 
66 char test_comment[256];
67 
68 
control_thread_entry(ULONG input)69 static VOID control_thread_entry(ULONG input)
70 {
71 
72 int xpos_index, ypos_index, Mouse_index;
73 int frame_id = 1;
74 GX_EVENT my_event;
75 
76     for(xpos_index = 0; xpos_index < (INT)(sizeof(xpos_value) / sizeof(int)); xpos_index++)
77     {
78         for(ypos_index = 0; ypos_index < (INT)(sizeof(ypos_value) / sizeof(int)); ypos_index++)
79         {
80             for(Mouse_index = 0; Mouse_index < 2; Mouse_index++)
81             {
82                 /* Inform the validation system
83                 (1) Frame ID, which identifies a specific test configuration;
84                 (2) Start recording frame on the next toggle operation.
85                 */
86                 sprintf(test_comment, "xpos %d ypos %d ", xpos_value[xpos_index], ypos_value[ypos_index]);
87                 if(xpos_value[xpos_index] < 117 || xpos_value[xpos_index] > 253 || ypos_value[ypos_index] < 100 || ypos_value[ypos_index] > 134)
88                 {
89                     strcat(test_comment, "outside ");
90                 }
91                 else
92                 {
93                     strcat(test_comment, "inside ");
94                 }
95                 if(Mouse_event[Mouse_index] == GX_EVENT_PEN_DOWN)
96                 {
97                     strcat(test_comment, "mouse down ");
98                 }
99                 else
100                 {
101                     strcat(test_comment, "mouse on ");
102                 }
103 
104 
105                 memset(&my_event, 0, sizeof(GX_EVENT));
106 
107                 my_event.gx_event_type = Mouse_event[Mouse_index];
108 
109                 my_event.gx_event_payload.gx_event_pointdata.gx_point_x = xpos_value[xpos_index];
110                 my_event.gx_event_payload.gx_event_pointdata.gx_point_y = ypos_value[ypos_index];
111                 my_event.gx_event_display_handle = 1;
112                 gx_system_event_send(&my_event);
113                 gx_validation_set_frame_id(frame_id);
114                 gx_validation_set_frame_comment(test_comment);
115                 /* Force a screen refresh. */
116                 gx_validation_screen_refresh();
117                 /* Increment frame ID */
118                 frame_id ++;
119             }
120         }
121     }
122 
123 
124     /* Signal the end of the test case.  Verify the output. */
125     gx_validation_end();
126 
127     exit(0);
128 }
129 
130 
131 
132 
133 
134