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_lines_24xrgb", /* Test name */
10 25, 17, 344, 336 /* 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_lines.c"
58 /* Define the angles values for the line. */
59 static int angle_value[] = {0, 1, 23, 30, 45, 60, 75, 89, 90, 135};
60
61 /* Define the width values for the line.*/
62 static int width_value[] = {1, 2, 3, 5, 10};
63
64 /* Define the anti-alias settings. */
65 static int aa_value[] = {GX_TRUE, GX_FALSE};
66
67 static int brush_alpha_value[] = {0, 155, 255};
68
69 /* Define the line end settings. */
70 static int rounded_value[] = {GX_TRUE, GX_FALSE};
71
72 char test_comment[256];
73
74 /* This thread simulates user input. Its priority is lower
75 than the GUIX thread, so that GUIX finishes an operation
76 before this thread is able to issue the next command. */
control_thread_entry(ULONG input)77 static VOID control_thread_entry(ULONG input)
78 {
79
80 int angle_index, width_index, aa_index, rounded_index, brush_alpha_index;
81 int frame_id = 1;
82 GX_RECTANGLE size;
83
84 for(aa_index = 0; aa_index < 2; aa_index++)
85 {
86 anti_aliased = aa_value[aa_index];
87 for(rounded_index = 0; rounded_index < 2; rounded_index++)
88 {
89 rounded = rounded_value[rounded_index];
90 for(width_index = 0; width_index < (INT)(sizeof(width_value) / sizeof(int)); width_index++)
91 {
92 line_width = width_value[width_index];
93 line_color = (GX_RESOURCE_ID)color_list[width_index].color_id;
94 for(angle_index = 0; angle_index < (INT)(sizeof(angle_value) / sizeof(int)); angle_index++)
95 {
96 for(brush_alpha_index = 0; brush_alpha_index < (INT)(sizeof(brush_alpha_value)/sizeof(INT)); brush_alpha_index++)
97 {
98 brush_alpha = brush_alpha_value[brush_alpha_index];
99 /* Inform the validation system
100 (1) Frame ID, which identifies a specific test configuration;
101 (2) Start recording frame on the next toggle operation.
102 */
103 gx_validation_set_frame_id(frame_id);
104
105 /* Set the line angle value */
106 line_angle = angle_value[angle_index];
107
108 sprintf(test_comment, "width %d angle %d brush_alpha: %d", line_width, line_angle, brush_alpha);
109 if(anti_aliased)
110 strcat(test_comment, "anti-aliased ");
111 if(rounded)
112 strcat(test_comment, "round end ");
113
114 gx_validation_set_frame_comment(test_comment);
115
116 /* Mark the window "dirty" */
117 gx_system_dirty_mark(pLineWin);
118
119 /* Force a screen refresh. */
120 gx_validation_screen_refresh();
121
122 /* Increment frame ID */
123 frame_id ++;
124 }
125 }
126 }
127 }
128 }
129 brush_alpha = 0xff;
130
131 size.gx_rectangle_left = pLineWin->gx_widget_size.gx_rectangle_left;
132 size.gx_rectangle_top = pLineWin->gx_widget_size.gx_rectangle_top;
133 size.gx_rectangle_right = pLineWin->gx_widget_size.gx_rectangle_left + 150;
134 size.gx_rectangle_bottom = pLineWin->gx_widget_size.gx_rectangle_top + 150;
135 gx_widget_resize(pLineWin, &size);
136
137 for(width_index = 0; width_index < (INT)(sizeof(width_value) / sizeof(int)); width_index++)
138 {
139 line_width = width_value[width_index];
140 line_color = (GX_RESOURCE_ID)color_list[width_index].color_id;
141 for(line_angle = 0; line_angle < 360; line_angle+=30)
142 {
143 for(brush_alpha_index = 0; brush_alpha_index < (INT)(sizeof(brush_alpha_value)/sizeof(INT)); brush_alpha_index++)
144 {
145 brush_alpha = brush_alpha_value[brush_alpha_index];
146
147 /* Inform the validation system
148 (1) Frame ID, which identifies a specific test configuration;
149 (2) Start recording frame on the next toggle operation.
150 */
151 gx_validation_set_frame_id(frame_id);
152
153 /* Set the line angle value */
154
155 sprintf(test_comment, "width %d angle %d brush_alpha: %d", line_width, line_angle, brush_alpha);
156
157 gx_validation_set_frame_comment(test_comment);
158
159 /* Mark the window "dirty" */
160 gx_system_dirty_mark(pLineWin);
161
162 /* Force a screen refresh. */
163 gx_validation_screen_refresh();
164
165 /* Increment frame ID */
166 frame_id ++;
167 }
168 }
169 }
170
171
172 /* Signal the end of the test case. Verify the output. */
173 gx_validation_end();
174
175 exit(0);
176 }
177
178
179
180
181
182