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_pixelmap_565rgb", /* Test name */
10     9, 5, 250, 168  /* 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 pixelmap 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_565rgb
46 #undef win32_graphics_driver_setup_565rgb
47 #endif
48 #define win32_graphics_driver_setup_565rgb  gx_validation_graphics_driver_setup_565rgb
49 
50 
51 #ifdef WIN32
52 #undef WIN32
53 #endif
54 
55 #include "gx_validation_wrapper.h"
56 
57 #include "demo_guix_pixelmap_16bpp.c"
58 /* Define the move values for the horizontal slider. */
59 static int horizontal_value[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
60 
61 /* Define the move values for the vertical slider.*/
62 static int vertical_value[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
63 
64 /* Define the alpha settings. */
65 static int alpha_value[] = {GX_TRUE, GX_FALSE};
66 
67 /* Define the compressed settings. */
68 static int compressed_value[] = {GX_TRUE, GX_FALSE};
69 
70 char test_comment[256];
71 
72 /* This thread simulates user input.  Its priority is lower
73    than the GUIX thread, so that GUIX finishes an operation
74    before this thread is able to issue the next command. */
control_thread_entry(ULONG input)75 static VOID control_thread_entry(ULONG input)
76 {
77 
78 int horizontal_index, vertical_index, alpha_index, compressed_index;
79 int frame_id = 1;
80 GX_SLIDER *slider_h;
81 GX_SLIDER *slider_v;
82 
83     gx_widget_find(pMainWin, ID_HORIZONTALMOVE, 0, &slider_h);
84     gx_widget_find(pMainWin, ID_VERTICALMOVE, 0, &slider_v);
85 
86     for(alpha_index = 0; alpha_index < 2; alpha_index++)
87     {
88         alpha = alpha_value[alpha_index];
89         for(compressed_index = 0; compressed_index < 2; compressed_index++)
90         {
91             compressed = compressed_value[compressed_index];
92             for(horizontal_index = 0; horizontal_index < (INT)(sizeof(horizontal_value) / sizeof(int)); horizontal_index++)
93             {
94                 gx_slider_value_set(slider_h, &slider_h -> gx_slider_info, horizontal_value[horizontal_index]);
95 
96                 for(vertical_index = 0; vertical_index < (INT)(sizeof(vertical_value) / sizeof(int)); vertical_index++)
97                 {
98                     /* Inform the validation system
99                     (1) Frame ID, which identifies a specific test configuration;
100                     (2) Start recording frame on the next toggle operation.
101                     */
102                     gx_validation_set_frame_id(frame_id);
103 
104                     /* Set the vertical slider value */
105                     gx_slider_value_set(slider_v, &slider_v -> gx_slider_info, vertical_value[vertical_index]);
106 
107                     sprintf(test_comment, "xshift %d yshift %d ", xshift, yshift);
108                     if(alpha)
109                         strcat(test_comment, "alpha ");
110                     else
111                         strcat(test_comment, "without alpha ");
112                     if(compressed)
113                         strcat(test_comment, "compressed ");
114                     else
115                         strcat(test_comment, "without compressed ");
116 
117                     gx_validation_set_frame_comment(test_comment);
118 
119                     /* Mark the window "dirty" */
120                     gx_system_dirty_mark(pic_window);
121 
122                     /* Force a screen refresh. */
123                     gx_validation_screen_refresh();
124 
125                     /* Increment frame ID */
126                     frame_id ++;
127                 }
128             }
129         }
130     }
131 
132     /* Signal the end of the test case.  Verify the output. */
133     gx_validation_end();
134 
135     exit(0);
136 }
137 
138 
139 
140 
141 
142