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_insert", /* 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[] = "12345";
60
61 typedef struct TEST_STRUCT{
62 INT event_type;
63 INT key_value;
64 char *comment;
65 }TEST;
66
67 TEST test_list[]={
68 {GX_EVENT_KEY_DOWN, GX_KEY_END, "end key down"},
69 {GX_EVENT_MARK_PREVIOUS, 0, "mark previous"},
70 {GX_EVENT_KEY_DOWN, '6', "insert characer '6'"},
71 {GX_EVENT_COPY, 0, "copy"},
72 {GX_EVENT_PASTE, 0, "paste"},
73 {GX_EVENT_CUT, 0, "cut"},
74 {GX_EVENT_PASTE, 0, "paste"},
75 {0, 0, ""}
76 };
77
78 /* This thread simulates user input. Its priority is lower
79 than the GUIX thread, so that GUIX finishes an operation
80 before this thread is able to issue the next command. */
control_thread_entry(ULONG input)81 static VOID control_thread_entry(ULONG input)
82 {
83 GX_SINGLE_LINE_TEXT_INPUT *text_input_ptr;
84 int frame_id = 1;
85 GX_EVENT my_event;
86 TEST *test = test_list;
87
88 memset(&my_event, 0, sizeof(GX_EVENT));
89 text_input_ptr = &pMainScreen->window_sl_text_input;
90
91 /* Remove cursor blink style. */
92 gx_single_line_text_input_style_remove(text_input_ptr, GX_STYLE_CURSOR_BLINK);
93 gx_single_line_text_input_style_remove(text_input_ptr, GX_STYLE_TEXT_ALIGNMENT_MASK);
94
95 /* Set input test. */
96 gx_single_line_text_input_text_set(text_input_ptr, (GX_CONST GX_CHAR *)SINGLE_LINE_TEXT);
97
98 gx_system_focus_claim((GX_WIDGET *)text_input_ptr);
99
100 my_event.gx_event_display_handle = 1;
101
102 while(test->event_type)
103 {
104 my_event.gx_event_type = test->event_type;
105 my_event.gx_event_payload.gx_event_ushortdata[0] = test->key_value;
106 gx_system_event_send(&my_event);
107
108 gx_validation_set_frame_id(frame_id++);
109 gx_validation_set_frame_comment(test->comment);
110 gx_validation_screen_refresh();
111 test++;
112 }
113
114 /* Signal the end of the test case. Verify the output. */
115 gx_validation_end();
116
117 exit(0);
118 }
119