1 /* This is a small demo of the high-performance GUIX graphics framework. */
2
3
4 #include <stdio.h>
5 #include "tx_api.h"
6 #include "gx_api.h"
7 #include "gx_system.h"
8 #include "gx_validation_utility.h"
9
10 TEST_PARAM test_parameter = {
11 "guix_screen_stack", /* Test name */
12 0, 0, 640, 480 /* Define the coordinates of the capture area.
13 In this test, we only need to capture the pixelmap
14 drawing area. */
15 };
16
17 static VOID control_thread_entry(ULONG);
main(int argc,char ** argv)18 int main(int argc, char ** argv)
19 {
20 /* Parse the command line argument. */
21 gx_validation_setup(argc, argv);
22
23 /* Start ThreadX system */
24 tx_kernel_enter();
25 return(0);
26 }
27
tx_application_define(void * first_unused_memory)28 VOID tx_application_define(void *first_unused_memory)
29 {
30 /* Call the actual line example routine. */
31 gx_validation_application_define(first_unused_memory);
32
33 /* Termiante the test if it runs for more than 100 ticks */
34 /* This function is not implemented yet. */
35 gx_validation_watchdog_create(100);
36
37
38 /* Create a dedicated thread to perform various operations
39 on the pixelmap drawing example. These operations simulate
40 user input. */
41 gx_validation_control_thread_create(control_thread_entry);
42
43 }
44
45
46 /* Replace the default graphics driver with the validation driver. */
47 #ifdef win32_graphics_driver_setup_24xrgb
48 #undef win32_graphics_driver_setup_24xrgb
49 #endif
50 #define win32_graphics_driver_setup_24xrgb gx_validation_graphics_driver_setup_24xrgb
51
52
53 #ifdef WIN32
54 #undef WIN32
55 #endif
56
57 #include "gx_validation_wrapper.h"
58
59 #include "demo_guix_all_widgets.c"
60
61 #define SCREEN_STACK_SIZE 2
62 static GX_SCREEN_STACK_CONTROL screen_stack_ctrl;
63 static GX_WIDGET *screen_stack[SCREEN_STACK_SIZE];
64
65 static GX_WIDGET *screen_list[]=
66 {
67 (GX_WIDGET *)&button_screen,
68 (GX_WIDGET *)&text_screen,
69 (GX_WIDGET *)&sprite_screen,
70 (GX_WIDGET *)&gauge_screen
71 };
72
73 char test_comment[256];
74
75 /* This thread simulates user input. Its priority is lower
76 than the GUIX thread, so that GUIX finishes an operation
77 before this thread is able to issue the next command. */
control_thread_entry(ULONG uinput)78 static VOID control_thread_entry(ULONG uinput)
79 {
80 int frame_id = 1;
81 INT index = 0;
82
83 while(index < (INT)(sizeof(screen_list)/sizeof(GX_WIDGET *)))
84 {
85 gx_widget_detach(screen_list[index]);
86 while(screen_list[index]->gx_widget_first_child)
87 {
88 gx_widget_detach(screen_list[index]->gx_widget_first_child);
89 }
90 index++;
91 }
92 gx_widget_attach(root, (GX_WIDGET *)&button_screen);
93 gx_screen_stack_create(&screen_stack_ctrl, screen_stack, SCREEN_STACK_SIZE * sizeof(GX_WIDGET *));
94 index = 0;
95 while(index < (INT)(sizeof(screen_list)/sizeof(GX_WIDGET *)))
96 {
97 gx_screen_stack_push(&screen_stack_ctrl, (GX_WIDGET *)screen_list[index], (GX_WIDGET *)screen_list[index+1]);
98
99 gx_validation_set_frame_id(frame_id++);
100 sprintf(test_comment, "Push new screen into stack.");
101 gx_validation_set_frame_comment(test_comment);
102 /* Force a screen refresh. */
103 gx_validation_screen_refresh();
104 index +=2;
105 }
106 index = 0;
107 while(index < (INT)(sizeof(screen_list)/sizeof(GX_WIDGET *)))
108 {
109 gx_screen_stack_pop(&screen_stack_ctrl);
110
111 gx_validation_set_frame_id(frame_id++);
112 sprintf(test_comment, "Call gx_screen_stack_pop to pop screen from stack.");
113 gx_validation_set_frame_comment(test_comment);
114 /* Force a screen refresh. */
115 gx_validation_screen_refresh();
116 index++;
117 }
118
119 gx_screen_stack_reset(&screen_stack_ctrl);
120
121 /* Signal the end of the test case. Verify the output. */
122 gx_validation_end();
123
124 exit(0);
125 }
126
127
128
129
130
131