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_all_widgets_565bgr", /* Test name */
10     0, 0, 639, 479  /* Define the coordinates of the capture area.
11                        In this test, we only need to capture the pixelmap
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_565bgr
46 #undef win32_graphics_driver_setup_565bgr
47 #endif
48 #define win32_graphics_driver_setup_565bgr  gx_validation_graphics_driver_setup_565bgr
49 
50 
51 #ifdef WIN32
52 #undef WIN32
53 #endif
54 
55 #include "gx_validation_wrapper.h"
56 
57 #include "demo_guix_all_widgets_565bgr.c"
58 
59 char test_comment[256];
60 
61 /* This thread simulates user input.  Its priority is lower
62    than the GUIX thread, so that GUIX finishes an operation
63    before this thread is able to issue the next command. */
control_thread_entry(ULONG input)64 static VOID control_thread_entry(ULONG input)
65 {
66 int frame_id;
67 
68     for(frame_id = 1; frame_id <= 10; frame_id++)
69     {
70         switch(frame_id)
71         {
72         case 1:
73             sprintf(test_comment, "Button screen.");
74             break;
75 
76         case 2:
77             ToggleScreen((GX_WINDOW *)&text_screen, (GX_WINDOW *)&button_screen);
78             sprintf(test_comment, "Text screen.");
79             break;
80 
81         case 3:
82             ToggleScreen((GX_WINDOW *)&indicator_screen, (GX_WINDOW *)&text_screen);
83             sprintf(test_comment, "Indicator screen");
84             break;
85 
86         case 4:
87             ToggleScreen((GX_WINDOW *)&rotate_screen, (GX_WINDOW *)&indicator_screen);
88             sprintf(test_comment, "Rotate screen.");
89             break;
90 
91         case 5:
92             ToggleScreen((GX_WINDOW *)&shapes_screen, (GX_WINDOW *)&rotate_screen);
93             sprintf(test_comment, "Shapes screen.");
94             break;
95 
96         case 6:
97             ToggleScreen((GX_WINDOW *)&lines_screen, (GX_WINDOW *)&shapes_screen);
98             sprintf(test_comment, "Lines screen");
99             break;
100 
101         case 7:
102             ToggleScreen((GX_WINDOW *)&scroll_wheel_screen, (GX_WINDOW *)&lines_screen);
103             sprintf(test_comment, "Scroll wheel screen.");
104             break;
105 
106         case 8:
107             /* Disable gauge animation. */
108             gx_circular_gauge_animation_set(&gauge_screen.gauge_screen_gauge_1, 0, 0);
109             ToggleScreen((GX_WINDOW *)&gauge_screen, (GX_WINDOW *)&scroll_wheel_screen);
110             sprintf(test_comment, "Gauge screen.");
111             break;
112 
113         case 9:
114             ToggleScreen((GX_WINDOW *)&menu_screen, (GX_WINDOW *)&gauge_screen);
115             sprintf(test_comment, "Menu screen");
116             break;
117 
118         case 10:
119             ToggleScreen((GX_WINDOW *)&pixelmap_screen, (GX_WINDOW *)&menu_screen);
120             sprintf(test_comment, "Pixelmap screen.");
121             break;
122 
123         }
124 
125         gx_validation_set_frame_id(frame_id);
126         gx_validation_set_frame_comment(test_comment);
127         gx_validation_screen_refresh();
128     }
129 
130     /* Signal the end of the test case.  Verify the output. */
131     gx_validation_end();
132 
133     exit(0);
134 }
135