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_system.h"
8 
9 TEST_PARAM test_parameter = {
10     "guix_system_canvas_refresh", /* Test name */
11     41, 31, 597, 471  /* Define the coordinates of the capture area.
12                          In this test, we only need to capture the pixelmap
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     /* Call the actual line example routine. */
30     gx_validation_application_define(first_unused_memory);
31 
32     /* Termiante the test if it runs for more than 100 ticks */
33     /* This function is not implemented yet. */
34     gx_validation_watchdog_create(100);
35 
36     /* Create a dedicated thread to perform various operations
37        on the line drawing example. These operations simulate
38        user input. */
39     gx_validation_control_thread_create(control_thread_entry);
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 
59 static GX_CHAR test_comment[256];
60 
61 /* This thread simulates user input.  Its priority is lower
62    than the GUIX thread, so that GUIX finishes an operation
63    before this thread is able to issue the next command. */
control_thread_entry(ULONG input)64 static VOID control_thread_entry(ULONG input)
65 {
66 int                        frame_id = 1;
67 GX_WIDGET                 *widget;
68 GX_EVENT                   my_event;
69 
70     widget = (GX_WIDGET *)&button_screen.button_screen_button_label_1;
71     gx_widget_style_remove(widget, GX_STYLE_TRANSPARENT);
72 
73     gx_validation_set_frame_id(frame_id++);
74     sprintf(test_comment, "Remove transparent style.");
75     gx_validation_set_frame_comment(test_comment);
76     gx_validation_screen_refresh();
77 
78     GX_ENTER_CRITICAL
79 
80 
81     gx_system_dirty_mark(widget);
82     gx_widget_status_add(widget, GX_STATUS_TRANSPARENT);
83     memset(&my_event, 0, sizeof(GX_EVENT));
84     my_event.gx_event_type = GX_EVENT_KEY_DOWN;
85     my_event.gx_event_display_handle = 1;
86     my_event.gx_event_target = widget;
87     gx_system_event_send(&my_event);
88     gx_validation_set_frame_id(frame_id++);
89     sprintf(test_comment, "Dirty mark prompt and add transparent style back.");
90     gx_validation_set_frame_comment(test_comment);
91     GX_EXIT_CRITICAL
92 
93     gx_widget_style_add(root, GX_STYLE_TRANSPARENT);
94     gx_validation_set_frame_id(frame_id++);
95     gx_validation_set_frame_comment("add transparent style to root");
96     gx_validation_screen_refresh();
97 
98     gx_system_dirty_mark(&button_screen);
99     gx_widget_status_add(&button_screen, GX_STATUS_TRANSPARENT);
100     gx_validation_set_frame_id(frame_id++);
101     gx_validation_set_frame_comment("mark button_screen as dirty, add transparent status");
102     memset(&my_event, 0, sizeof(GX_EVENT));
103     my_event.gx_event_type = GX_EVENT_PEN_DOWN;
104     my_event.gx_event_target = (GX_WIDGET *)&button_screen;
105     gx_system_event_send(&my_event);
106 
107     ToggleScreen((GX_WINDOW *)&window_screen, (GX_WINDOW *)&button_screen);
108     gx_canvas_delete(&composite_canvas);
109     animation_canvas.gx_canvas_status = GX_CANVAS_SIMPLE;
110     gx_validation_set_frame_id(frame_id++);
111     gx_validation_set_frame_comment("toggle to window screen, delete composite canvas, set animation canvas type = GX_CANVAS_SIMPLE");
112     gx_validation_screen_refresh();
113 
114     /* Signal the end of the test case.  Verify the output. */
115     gx_validation_end();
116 
117     exit(0);
118 }
119