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_back_attach", /* Test name */
11 117, 100, 253, 170 /* 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
45 /* Replace the default graphics driver with the validation driver. */
46 #ifdef win32_graphics_driver_setup_24xrgb
47 #undef win32_graphics_driver_setup_24xrgb
48 #endif
49 #define win32_graphics_driver_setup_24xrgb gx_validation_graphics_driver_setup_24xrgb
50
51
52 #ifdef WIN32
53 #undef WIN32
54 #endif
55
56 #include "gx_validation_wrapper.h"
57
58 #include "demo_guix_all_widgets.c"
59 GX_CHAR test_comment[256];
60
control_thread_entry(ULONG input)61 static VOID control_thread_entry(ULONG input)
62 {
63 int frame_id = 1;
64 GX_WIDGET *button = (GX_WIDGET *)&button_screen.button_screen_base_button_1;
65 GX_WIDGET *text_button = (GX_WIDGET *)&button_screen.button_screen_text_button_1;
66 GX_WIDGET *multi_line_button = (GX_WIDGET *)&button_screen.button_screen_multi_line_button_1;
67 int index;
68
69 gx_widget_shift(text_button, 0, button->gx_widget_size.gx_rectangle_top - text_button->gx_widget_size.gx_rectangle_top, GX_FALSE);
70 gx_widget_shift(multi_line_button, 0, button->gx_widget_size.gx_rectangle_top - multi_line_button->gx_widget_size.gx_rectangle_top, GX_FALSE);
71
72 for(index = 0; index < 2; index++)
73 {
74 switch(index)
75 {
76 case 0:
77 gx_widget_back_attach(button, text_button);
78 sprintf(test_comment, "back attach text_button to base_button");
79 break;
80
81 case 1:
82 gx_widget_back_attach(button, multi_line_button);
83 sprintf(test_comment, "back attach multi_line_button to base_button");
84 break;
85 }
86
87 gx_validation_set_frame_id(frame_id++);
88 gx_validation_set_frame_comment(test_comment);
89 gx_validation_screen_refresh();
90 }
91
92 _gx_widget_back_link(GX_NULL, GX_NULL);
93
94 /* Signal the end of the test case. Verify the output. */
95 gx_validation_end();
96
97 exit(0);
98 }
99