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_scrollbar_reset", /* Test name */
10     351, 45, 562, 180  /* 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 
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 line 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_24xrgb
45 #undef win32_graphics_driver_setup_24xrgb
46 #endif
47 #define win32_graphics_driver_setup_24xrgb  gx_validation_graphics_driver_setup_24xrgb
48 
49 
50 #ifdef WIN32
51 #undef WIN32
52 #endif
53 
54 #include "gx_validation_wrapper.h"
55 
56 #include "demo_guix_all_widgets.c"
57 
58 char test_comment[255];
59 
60 static GX_SCROLL_INFO scroll_info = {5, 0, 10, 1, 1};
61 
control_thread_entry(ULONG input)62 static VOID control_thread_entry(ULONG input)
63 {
64 int       frame_id = 1;
65 GX_SCROLLBAR *hscroll;
66 
67     gx_widget_detach(pButtonScreen);
68     gx_widget_attach(root, (GX_WIDGET *)&window_screen);
69     hscroll = &window_screen.window_screen_hscroll_1;
70     gx_validation_set_frame_id(frame_id++);
71     gx_validation_set_frame_comment("Original scollbar in window_screen.");
72     /* Force a screen refresh. */
73     gx_validation_screen_refresh();    /* Signal the end of the test case.  Verify the output. */
74 
75     gx_scrollbar_reset(hscroll, &scroll_info);
76     gx_validation_set_frame_id(frame_id++);
77     sprintf(test_comment, "Set scroll info: gx_scroll_value: %d, gx_scroll_minimum: %d, gx_scroll_maximum: %d, gx_scroll_visible: %d, gx_scroll_increment: %d ",
78                                                      scroll_info.gx_scroll_value, scroll_info.gx_scroll_minimum,scroll_info.gx_scroll_maximum,scroll_info.gx_scroll_visible,scroll_info.gx_scroll_increment);
79     gx_validation_set_frame_comment(test_comment);
80     /* Force a screen refresh. */
81     gx_validation_screen_refresh();    /* Signal the end of the test case.  Verify the output. */
82 
83     gx_scrollbar_reset(hscroll, GX_NULL);
84     gx_validation_set_frame_id(frame_id++);
85     gx_validation_set_frame_comment("Call function gx_scrollbar_reset, and the scroll_info parameter is null.");
86     /* Force a screen refresh. */
87     gx_validation_screen_refresh();    /* Signal the end of the test case.  Verify the output. */
88 
89     gx_validation_end();
90 
91     exit(0);
92 }
93