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_canvas_arc_draw", /* Test name */
10 10, 9, 401, 428 /* Define the coordinates of the capture area.
11 In this test, we only need to capture the graphics
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 /* Call the actual line example routine. */
29 gx_validation_application_define(first_unused_memory);
30
31 /* Termiante the test if it runs for more than 100 ticks */
32 /* This function is not implemented yet. */
33 gx_validation_watchdog_create(100);
34
35 /* Create a dedicated thread to perform various operations
36 on the pixelmap drawing example. These operations simulate
37 user input. */
38 gx_validation_control_thread_create(control_thread_entry);
39
40 }
41
42
43 /* Replace the default graphics driver with the validation driver. */
44 #ifdef win32_graphics_driver_setup_monochrome
45 #undef win32_graphics_driver_setup_monochrome
46 #endif
47 #define win32_graphics_driver_setup_monochrome gx_validation_graphics_driver_setup_monochrome
48
49
50 #ifdef WIN32
51 #undef WIN32
52 #endif
53
54 #include "gx_validation_wrapper.h"
55
56 #include "demo_guix_all_widgets_1bpp.c"
57
58 char test_comment[256];
59 extern INT draw_shape;
60 extern INT start_angle;
61 extern INT end_angle;
62 /* This thread simulates user input. Its priority is lower
63 than the GUIX thread, so that GUIX finishes an operation
64 before this thread is able to issue the next command. */
control_thread_entry(ULONG input)65 static VOID control_thread_entry(ULONG input)
66 {
67 INT frame_id = 1;
68 GX_RECTANGLE size;
69
70 /* part1, original screen. */
71 gx_widget_detach(pSpriteScreen);
72 gx_widget_attach(root, pShapesScreen);
73 draw_shape = 1; //2 is arc
74
75 start_angle = 190;
76 end_angle = 500;
77
78 /* Set frame id. */
79 gx_validation_set_frame_id(frame_id++);
80 sprintf(test_comment, "Set brush properties and draw original arc. start_angle: %d, end_angle: %d.", start_angle, end_angle);
81 gx_validation_set_frame_comment(test_comment);
82 gx_system_dirty_mark(pShapesScreen);
83 gx_validation_screen_refresh();
84
85 /* part2, draw area covered by others. */
86 while(pSpriteScreen->gx_widget_first_child)
87 {
88 gx_widget_detach(pSpriteScreen->gx_widget_first_child);
89 }
90
91 size = shapes_screen.shapes_screen_graphics_window.gx_widget_size;
92 size.gx_rectangle_left += 20;
93 size.gx_rectangle_right += 20;
94 size.gx_rectangle_top += 20;
95 size.gx_rectangle_bottom += 20;
96
97 gx_widget_resize(pSpriteScreen, &size);
98 gx_widget_attach(root, pSpriteScreen);
99
100 /* Set frame id. */
101 gx_validation_set_frame_id(frame_id++);
102 sprintf(test_comment, "Add a window to cover view where the arc should be draw.");
103 gx_validation_set_frame_comment(test_comment);
104 gx_system_dirty_mark(pShapesScreen);
105 gx_validation_screen_refresh();
106
107 /* part3, draw area outside the screen. */
108 gx_widget_detach(pSpriteScreen);
109 size = shapes_screen.shapes_screen_graphics_window.gx_widget_size;
110 size.gx_rectangle_left += 380;
111 size.gx_rectangle_top += 410;
112 gx_widget_resize(pShapesScreen, &size);
113
114 /* Set frame id. */
115 gx_validation_set_frame_id(frame_id++);
116 sprintf(test_comment, "Draw arc outside the window client.");
117 gx_validation_set_frame_comment(test_comment);
118 gx_system_dirty_mark(pShapesScreen);
119 gx_validation_screen_refresh();
120
121 /* Signal the end of the test case, Verify the outout. */
122 gx_validation_end();
123
124 exit(0);
125 }
126