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_1bpp_glyph_draw", /* Test name */
10    200, 30, 468, 80  /* Define the coordinates of the capture area.
11                          In this test, we only need to capture the line
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 
26 #define TEST_1BPP_BLACK          0x00
27 #define TEST_1BPP_WHITE          0x01
28 #define TEST_1BPP_INVALID_COLOR  0x02
29 
30 
31 /* User-defined color table. */
32 static GX_COLOR test_color_table[] =
33 {
34     TEST_1BPP_BLACK,
35     TEST_1BPP_WHITE,
36     TEST_1BPP_INVALID_COLOR
37 };
38 
tx_application_define(void * first_unused_memory)39 VOID tx_application_define(void *first_unused_memory)
40 {
41 
42     /* Create a dedicated thread to perform various operations
43        on the line drawing example. These operations simulate
44        user input. */
45     gx_validation_control_thread_create(control_thread_entry);
46 
47     /* Termiante the test if it runs for more than 100 ticks */
48     /* This function is not implemented yet. */
49     gx_validation_watchdog_create(100);
50 
51     /* Call the actual line example routine. */
52     gx_validation_application_define(first_unused_memory);
53 
54 }
55 
56 
57 /* Replace the default graphics driver with the validation driver. */
58 #ifdef win32_graphics_driver_setup_monochrome
59 #undef win32_graphics_driver_setup_monochrome
60 #endif
61 #define win32_graphics_driver_setup_monochrome  gx_validation_graphics_driver_setup_monochrome
62 
63 
64 #ifdef WIN32
65 #undef WIN32
66 #endif
67 
68 #include "gx_validation_wrapper.h"
69 
70 #include "demo_guix_all_widgets_1bpp.c"
71 
72 char test_comment[256];
73 
control_thread_entry(ULONG input)74 static VOID control_thread_entry(ULONG input)
75 {
76 int frame_id = 1;
77 GX_DRAW_CONTEXT context;
78 
79     ToggleScreen((GX_WINDOW *)&button_screen, (GX_WINDOW *)&sprite_screen);
80     gx_validation_set_frame_id(frame_id++);
81     gx_validation_set_frame_comment("Screen shot without changing");
82     gx_validation_screen_refresh();
83 
84     gx_display_color_table_set(root->gx_window_root_canvas->gx_canvas_display, test_color_table, sizeof(test_color_table) / sizeof(GX_COLOR));
85 
86     /* Reset line wind draw function because line color is hard-coded in original draw function in demo file,
87        Rewrite this draw function to change line color. */
88     gx_widget_style_remove((GX_WIDGET *)&button_screen.button_screen_title_1, GX_STYLE_TRANSPARENT);
89     gx_prompt_text_color_set(&button_screen.button_screen_title_1, TEST_1BPP_INVALID_COLOR, TEST_1BPP_INVALID_COLOR, TEST_1BPP_INVALID_COLOR);
90     gx_validation_set_frame_id(frame_id++);
91     gx_validation_set_frame_comment("Set title prompt text color id to an invalid id");
92     gx_validation_screen_refresh();
93 
94     memset(&context, 0, sizeof(GX_DRAW_CONTEXT));
95     context.gx_draw_context_pitch = 640;
96     root->gx_window_root_canvas->gx_canvas_display->gx_display_driver_pixel_write(&context, 201, 35, 2);
97     gx_validation_set_frame_id(frame_id++);
98     gx_validation_set_frame_comment("Call 1bpp pixel write with color set to 2");
99     gx_validation_screen_refresh();
100 
101     /* Signal the end of the test case.  Verify the output. */
102     gx_validation_end();
103 
104     exit(0);
105 }
106 
107 
108 
109 
110 
111 
112 
113 
114 
115