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_system_private_string", /* Test name */
10 116, 139, 253, 170 /* Define the coordinates of the capture area.
11 In this test, we only need to capture the pixelmap
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 #include "demo_guix_all_widgets.c"
57
58 char test_comment[255];
59
60 char test_string[]="123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
61
62 #define TEST_MEMORY_SIZE 100
63 GX_UBYTE test_memory[TEST_MEMORY_SIZE];
64
65 /* This thread simulates user input. Its priority is lower
66 than the GUIX thread, so that GUIX finishes an operation
67 before this thread is able to issue the next command. */
control_thread_entry(ULONG input)68 static VOID control_thread_entry(ULONG input)
69 {
70 INT frame_id = 1;
71 GX_TEXT_BUTTON *button;
72 INT index;
73 GX_STRING string;
74
75 button = &button_screen.button_screen_text_button_1;
76
77 tx_byte_pool_delete(&rotate_pool);
78 tx_byte_pool_create(&rotate_pool, "test_memory_pool", test_memory, TEST_MEMORY_SIZE);
79
80 gx_widget_hide(button);
81 gx_text_button_text_set(button, GX_NULL);
82 gx_widget_style_add(button, GX_STYLE_TEXT_COPY);
83 gx_widget_show(button);
84 gx_text_button_text_set(button, "text_button");
85
86 for(index = 0; index < 9; index++)
87 {
88 switch(index)
89 {
90 case 0:
91 sprintf(test_comment, "set memory pool size to %d, add GX_STYLE_TEXT_COPY style", TEST_MEMORY_SIZE);
92 break;
93
94 case 1:
95 case 2:
96 gx_text_button_text_set(button, test_string);
97 sprintf(test_comment, "set %d bytes long string", sizeof(test_string));
98 break;
99
100 case 3:
101 gx_text_button_text_set(button, "test");
102 sprintf(test_comment, "set string \"test\"");
103 break;
104
105 case 4:
106 gx_text_button_text_set(button, "testtest");
107 sprintf(test_comment, "set string \"testtest\"");
108 break;
109
110 case 5:
111 gx_text_button_text_set(button, GX_NULL);
112 sprintf(test_comment, "set text GX_NULL");
113 break;
114
115 case 6:
116 gx_text_button_text_id_set(button, 1);
117 sprintf(test_comment, "set text id = 0");
118 break;
119
120 case 7:
121 gx_text_button_text_set_ext(button, GX_NULL);
122 sprintf(test_comment, "set text GX_NULL");
123 break;
124
125 case 8:
126 string.gx_string_ptr = GX_NULL;
127 string.gx_string_length = 0;
128 gx_text_button_text_set_ext(button, &string);
129 sprintf(test_comment, "set text GX_NULL");
130 break;
131 }
132 gx_validation_set_frame_id(frame_id++);
133 gx_validation_set_frame_comment(test_comment);
134 gx_validation_screen_refresh();
135 }
136
137 /* Signal the end of the test case. Verify the output. */
138 gx_validation_end();
139
140 exit(0);
141 }
142