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_multi_themes_16bpp", /* Test name */
10     5, 5, 630, 470  /* 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 #ifdef GX_UTF8_SUPPORT
19     /* Parse the command line argument. */
20     gx_validation_setup(argc, argv);
21 #else
22     printf("guix_multi_themes_16bpp:Skip Testing!\n");
23 #endif
24     /* Start ThreadX system */
25     tx_kernel_enter();
26     return(0);
27 }
28 
tx_application_define(void * first_unused_memory)29 VOID tx_application_define(void *first_unused_memory)
30 {
31 
32     /* Create a dedicated thread to perform various operations
33        on the line drawing example. These operations simulate
34        user input. */
35     gx_validation_control_thread_create(control_thread_entry);
36 
37     /* Termiante the test if it runs for more than 100 ticks */
38     /* This function is not implemented yet. */
39     gx_validation_watchdog_create(100);
40 
41     /* Call the actual line example routine. */
42     gx_validation_application_define(first_unused_memory);
43 
44 }
45 
46 
47 /* Replace the default graphics driver with the validation driver. */
48 #ifdef win32_graphics_driver_setup_565rgb
49 #undef win32_graphics_driver_setup_565rgb
50 #endif
51 #define win32_graphics_driver_setup_565rgb  gx_validation_graphics_driver_setup_565rgb
52 
53 
54 #ifdef WIN32
55 #undef WIN32
56 #endif
57 
58 #define REGRESSION_TEST_MODE
59 
60 #include "gx_validation_wrapper.h"
61 
62 #include "demo_guix_multi_themes_16bpp.c"
63 
64 char test_comment[256];
65 
66 extern SIMPLE_WINDOW_CONTROL_BLOCK simple_window;
67 
control_thread_entry(ULONG input)68 static VOID control_thread_entry(ULONG input)
69 {
70 #ifdef GX_UTF8_SUPPORT
71 int      frame_id = 1;
72 int      theme_id;
73 int      language_id;
74 GX_EVENT select_event;
75 
76     /* Initiate event structure.  */
77     memset(&select_event, 0, sizeof(GX_EVENT));
78 
79     select_event.gx_event_type = GX_EVENT_SELECT;
80     select_event.gx_event_display_handle = 1;
81     select_event.gx_event_sender = 0;
82 
83     for(theme_id = 0; theme_id < 5; theme_id++)
84     {
85         switch(theme_id)
86         {
87         case 0:
88             select_event.gx_event_target = (GX_WIDGET *)&simple_window.simple_window_radio_button_theme_1;
89             break;
90         case 1:
91             select_event.gx_event_target = (GX_WIDGET *)&simple_window.simple_window_radio_button_theme_2;
92             break;
93         case 2:
94             select_event.gx_event_target = (GX_WIDGET *)&simple_window.simple_window_radio_button_theme_3;
95             break;
96         case 3:
97             select_event.gx_event_target = (GX_WIDGET *)&simple_window.simple_window_radio_button_theme_4;
98             break;
99         case 4:
100             select_event.gx_event_target = (GX_WIDGET *)&simple_window.simple_window_radio_button_theme_5;
101             break;
102         }
103 
104         gx_validation_set_frame_id(frame_id++);
105 
106         sprintf(test_comment, "Select Theme %d", theme_id + 1);
107         gx_validation_set_frame_comment(test_comment);
108 
109         gx_system_event_send(&select_event);
110 
111         /* Force a screen refresh. */
112         gx_validation_screen_refresh();
113 
114         for(language_id = 0; language_id < 4; language_id++)
115         {
116             switch(language_id)
117             {
118             case 0:
119                 select_event.gx_event_target = (GX_WIDGET *)&simple_window.simple_window_radio_button_English;
120                 sprintf(test_comment, "Select language \"English\"");
121                 break;
122             case 1:
123                 select_event.gx_event_target = (GX_WIDGET *)&simple_window.simple_window_radio_button_Chinese;
124                 sprintf(test_comment, "Select language \"Chinese\"");
125                 break;
126             case 2:
127                 select_event.gx_event_target = (GX_WIDGET *)&simple_window.simple_window_radio_button_Japanese;
128                 sprintf(test_comment, "Select language \"Japanese\"");
129                 break;
130             case 3:
131                 select_event.gx_event_target = (GX_WIDGET *)&simple_window.simple_window_radio_button_Spanish;
132                 sprintf(test_comment, "Select language \"Spanish\"");
133                 break;
134             }
135 
136             gx_validation_set_frame_id(frame_id++);
137             gx_validation_set_frame_comment(test_comment);
138             gx_system_event_send(&select_event);
139             gx_validation_screen_refresh();
140         }
141 
142     }
143 
144     /* Signal the end of the test case.  Verify the output. */
145     gx_validation_end();
146 #endif
147     exit(0);
148 }
149