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_sl_input_backspace", /* Test name */
11     114, 69, 538, 119  /* 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 
30     /* Create a dedicated thread to perform various operations
31        on the line drawing example. These operations simulate
32        user input. */
33     gx_validation_control_thread_create(control_thread_entry);
34 
35     /* Termiante the test if it runs for more than 100 ticks */
36     /* This function is not implemented yet. */
37     gx_validation_watchdog_create(100);
38 
39     /* Call the actual line example routine. */
40     gx_validation_application_define(first_unused_memory);
41 
42 }
43 
44 
45 /* Replace the default graphics driver with the validation driver. */
46 #ifdef win32_graphics_driver_setup_565rgb
47 #undef win32_graphics_driver_setup_565rgb
48 #endif
49 #define win32_graphics_driver_setup_565rgb  gx_validation_graphics_driver_setup_565rgb
50 
51 
52 #ifdef WIN32
53 #undef WIN32
54 #endif
55 
56 #include "gx_validation_wrapper.h"
57 #include "demo_guix_sl_text_input_16bpp.c"
58 
59 static GX_CONST GX_UBYTE SINGLE_LINE_TEXT[] = "do you remember the day we used to be, why do the";
60 static INT key_list[]={GX_KEY_HOME, GX_KEY_RIGHT_ARROW, GX_KEY_BACKSPACE, GX_KEY_RIGHT_ARROW, GX_KEY_BACKSPACE};
61 static GX_CHAR *test_comments[5] = {"home", "right arrow", "backspace", "right arrow", "backspace"};
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 GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr;
68 int                        frame_id = 1;
69 int index;
70 GX_EVENT my_event;
71 
72     memset(&my_event, 0, sizeof(GX_EVENT));
73     text_input_ptr = &pMainScreen->window_sl_text_input;
74 
75     /* Remove cursor blink style. */
76     gx_single_line_text_input_style_remove(text_input_ptr, GX_STYLE_CURSOR_BLINK);
77     gx_single_line_text_input_style_remove(text_input_ptr, GX_STYLE_TEXT_ALIGNMENT_MASK);
78     gx_single_line_text_input_style_add(text_input_ptr, GX_STYLE_TEXT_RIGHT);
79     gx_single_line_text_input_text_set(text_input_ptr, (GX_CONST GX_CHAR *)SINGLE_LINE_TEXT);
80 
81     gx_system_focus_claim((GX_WIDGET *)text_input_ptr);
82 
83     my_event.gx_event_display_handle = 1;
84     for(index = 0; index < (int)(sizeof(key_list) / sizeof(INT)); index++)
85     {
86         my_event.gx_event_type = GX_EVENT_KEY_DOWN;
87         my_event.gx_event_payload.gx_event_ushortdata[0] = key_list[index];
88         gx_system_event_send(&my_event);
89 
90         gx_validation_set_frame_id(frame_id++);
91         gx_validation_set_frame_comment(test_comments[index]);
92         gx_validation_screen_refresh();
93     }
94 
95     /* Signal the end of the test case.  Verify the output. */
96     gx_validation_end();
97 
98     exit(0);
99 }
100