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_widget_style_set", /* Test name */
10     0, 0, 639, 479  /* 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 GX_CHAR test_comment[256];
59 
control_thread_entry(ULONG input)60 static VOID control_thread_entry(ULONG input)
61 {
62 int        frame_id = 1;
63 int        index;
64 GX_WIDGET *window_5 = (GX_WIDGET *)&window_screen.window_screen_window_5;
65 GX_WIDGET *next_button = (GX_WIDGET *)&window_screen.window_screen_next_button_1;
66 
67     ToggleScreen((GX_WINDOW *)&window_screen, (GX_WINDOW *)&button_screen);
68 
69     for(index = 0; index < 2; index++)
70     {
71 
72         if(index)
73         {
74             gx_widget_hide(window_5);
75             gx_widget_hide(next_button);
76         }
77         gx_widget_style_set(window_5, GX_STYLE_ENABLED | GX_STYLE_TRANSPARENT);
78         gx_widget_style_set(next_button, GX_STYLE_ENABLED | GX_STYLE_TRANSPARENT);
79 
80         sprintf(test_comment, "set style GX_STYLE_ENABLED|GX_STYLE_TRANSPARENT");
81         gx_validation_set_frame_id(frame_id++);
82         gx_validation_set_frame_comment(test_comment);
83         gx_validation_screen_refresh();
84 
85         gx_widget_style_set(window_5, GX_STYLE_ENABLED | GX_STYLE_TRANSPARENT);
86         gx_widget_style_set(next_button, GX_STYLE_ENABLED | GX_STYLE_TRANSPARENT);
87 
88         gx_validation_set_frame_id(frame_id++);
89         gx_validation_set_frame_comment(test_comment);
90         gx_validation_screen_refresh();
91 
92         sprintf(test_comment, "set style GX_STYLE_ENABLED");
93         gx_widget_style_set(window_5, GX_STYLE_ENABLED);
94         gx_widget_style_set(next_button, GX_STYLE_ENABLED);
95 
96         gx_validation_set_frame_id(frame_id++);
97         gx_validation_set_frame_comment(test_comment);
98         gx_validation_screen_refresh();
99 
100         gx_widget_style_set(window_5, GX_STYLE_ENABLED);
101         gx_widget_style_set(next_button, GX_STYLE_ENABLED);
102 
103         gx_validation_set_frame_id(frame_id++);
104         gx_validation_set_frame_comment(test_comment);
105         gx_validation_screen_refresh();
106     }
107 
108     /* Signal the end of the test case.  Verify the output. */
109     gx_validation_end();
110 
111     exit(0);
112 }
113