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_rich_text_view_line_info_get", /* Test name */
10 99, 94, 295, 357 /* 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
29 /* Create a dedicated thread to perform various operations
30 on the line 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_rich_text_view_16bpp.c"
58
59 static GX_UBYTE string_0[] = {0xfc, 0x00};
60 static char string_1[] = "<align left>A B</align>";
61
62 GX_STRING test_string_list[]={
63 {(GX_CHAR *)string_0, sizeof(string_0) - 1},
64 {string_1, sizeof(string_1) - 1},
65 };
66
67 char comment[256];
68
control_thread_entry(ULONG input)69 static VOID control_thread_entry(ULONG input)
70 {
71 INT frame_id = 1;
72 UINT index;
73 GX_RICH_TEXT_VIEW *rich_view = &main_screen.main_screen_rich_text_view;
74 GX_RECTANGLE size;
75
76 /* Detach rich text view scrollbar. */
77 gx_widget_detach(&main_screen.main_screen_vertical_scroll);
78
79 for(index = 0; index < sizeof(test_string_list)/sizeof(GX_STRING); index++)
80 {
81 gx_multi_line_text_view_text_set_ext((GX_MULTI_LINE_TEXT_VIEW *)rich_view, &test_string_list[index]);
82 gx_validation_set_frame_id(frame_id++);
83 gx_validation_set_frame_comment("test line break");
84 gx_validation_screen_refresh();
85 }
86
87 size = rich_view->gx_widget_size;
88 size.gx_rectangle_right = size.gx_rectangle_left + 15;
89
90 gx_widget_resize(rich_view, &size);
91 gx_validation_set_frame_id(frame_id++);
92 gx_validation_set_frame_comment("Resize widget.");
93 gx_validation_screen_refresh();
94
95 /* Signal the end of the test case. Verify the output. */
96 gx_validation_end();
97
98 exit(0);
99 }
100