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_menu_32bpp", /* Test name */
10 0 , 0, 240, 320 /* Define the coordinates of the capture area.
11 In this test, we only need to capture the pixelmap slider
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 pixelmap 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_menu.c"
58
59 char test_comment[256];
60
61 static GX_POINT click_pos[]={
62 {15, 90},/* To bookself screen. */
63 {95, 45},/* To book screen. */
64 {120, 160},/* Popup toolbar. */
65 {8, 8},/* Back to booself screen. */
66 {11, 7},/* Back to main screen. */
67 {15, 90},
68 {90, 45},
69 {120, 160},
70 {150, 10},/* Back to home screen directly. */
71 };
72
73 static char comments[9][30]={
74 "To bookself screen",
75 "To book screen",
76 "Popup toolbar.",
77 "Back to bookself screen.",
78 "Back to main screen.",
79 "To bookself screen.",
80 "To book screen",
81 "Popup toolbar.",
82 "Back to home screen directly."
83 };
84
85 /* This thread simulates user input. Its priority is lower
86 than the GUIX thread, so that GUIX finishes an operation
87 before this thread is able to issue the next command. */
control_thread_entry(ULONG input)88 static VOID control_thread_entry(ULONG input)
89 {
90 GX_EVENT my_event;
91 int frame_id = 1;
92 int loop = 0;
93 int index = 0;
94
95 memset(&my_event, 0, sizeof(GX_EVENT));
96 my_event.gx_event_display_handle = 1;
97
98 for(loop = 0; loop < 4; loop++)
99 {
100 for(index = 0; index < (int)(sizeof(click_pos)/sizeof(GX_POINT)); index++)
101 {
102 my_event.gx_event_type = GX_EVENT_PEN_DOWN;
103 my_event.gx_event_payload.gx_event_pointdata.gx_point_x = click_pos[index].gx_point_x;
104 my_event.gx_event_payload.gx_event_pointdata.gx_point_y = click_pos[index].gx_point_y;
105 gx_system_event_send(&my_event);
106
107 my_event.gx_event_type = GX_EVENT_PEN_UP;
108 gx_system_event_send(&my_event);
109
110 sprintf(test_comment, "%s", comments[index]);
111
112 gx_validation_set_frame_id(frame_id++);
113 gx_validation_set_frame_comment(test_comment);
114
115 /* Force a screen refresh. */
116 gx_validation_screen_refresh();
117 }
118
119 }
120 /* Signal the end of the test case. Verify the output. */
121 gx_validation_end();
122
123 exit(0);
124
125 }
126