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 #include "gx_widget.h"
8
9 TEST_PARAM test_parameter = {
10 "guix_widget_children_draw", /* Test name */
11 0, 0, 342, 195 /* Define the coordinates of the capture area.
12 In this test, we only need to capture the line
13 drawing area. */
14 };
15
16 static VOID control_thread_entry(ULONG);
main(int argc,char ** argv)17 int main(int argc, char ** argv)
18 {
19 /* Parse the command line argument. */
20 gx_validation_setup(argc, argv);
21
22 /* Start ThreadX system */
23 tx_kernel_enter();
24 return(0);
25 }
26
tx_application_define(void * first_unused_memory)27 VOID tx_application_define(void *first_unused_memory)
28 {
29
30 /* Create a dedicated thread to perform various operations
31 on the line drawing example. These operations simulate
32 user input. */
33 gx_validation_control_thread_create(control_thread_entry);
34
35 /* Termiante the test if it runs for more than 100 ticks */
36 /* This function is not implemented yet. */
37 gx_validation_watchdog_create(100);
38
39 /* Call the actual line example routine. */
40 gx_validation_application_define(first_unused_memory);
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 GX_WIDGET *parent;
64 GX_PROMPT test_prompt[4];
65 GX_RECTANGLE size;
66 int index;
67
68 parent = (GX_WIDGET *)&window_screen.window_screen_window_8;
69 for(index =0; index < 4; index++)
70 {
71 /* Create child prompt for child window. */
72 switch(index)
73 {
74 case 0:
75 gx_utility_rectangle_define(&size, 217, 97, 297, 153);
76 break;
77
78 case 1:
79 gx_utility_rectangle_define(&size, 223, 103, 291, 145);
80 parent = (GX_WIDGET *)&test_prompt[0];
81 break;
82
83 case 2:
84 gx_utility_rectangle_define(&size, 228, 110, 288, 141);
85 parent = (GX_WIDGET *)&test_prompt[1];
86 break;
87
88 case 3:
89 gx_utility_rectangle_define(&size, 235, 114, 284, 138);
90 parent = (GX_WIDGET *)&test_prompt[2];
91 break;
92 }
93 memset(&test_prompt[index], 0, sizeof(GX_PROMPT));
94 gx_prompt_create(&test_prompt[index], "test_prompt", parent, 0, GX_STYLE_ENABLED | GX_STYLE_BORDER_THIN, 1024 + index, &size);
95 }
96
97 ToggleScreen((GX_WINDOW *)&window_screen, (GX_WINDOW *)&button_screen);
98
99 /* Toggle to text screen. */
100 gx_validation_set_frame_id(frame_id++);
101 gx_validation_set_frame_comment("Create nested widgets that exceed GX_MAX_CONTEXT_NESTING");
102 gx_validation_screen_refresh();
103
104 /* Signal the end of the test case. Verify the output. */
105 gx_validation_end();
106
107 exit(0);
108 }
109