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_system.h"
7 #include "gx_validation_utility.h"
8
9 TEST_PARAM test_parameter = {
10 "guix_system_event_fold_no_output", /* Test name */
11 0, 0, 0, 0 /* Define the coordinates of the capture area.*/
12 };
13
14 static VOID control_thread_entry(ULONG);
main(int argc,char ** argv)15 int main(int argc, char ** argv)
16 {
17 /* Start ThreadX system */
18 tx_kernel_enter();
19 return(0);
20 }
21
tx_application_define(void * first_unused_memory)22 VOID tx_application_define(void *first_unused_memory)
23 {
24 /* Call the actual line example routine. */
25 gx_validation_application_define(first_unused_memory);
26 /* Termiante the test if it runs for more than 100 ticks */
27 /* This function is not implemented yet. */
28 gx_validation_watchdog_create(100);
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 }
36
37 #ifdef WIN32
38 #undef WIN32
39 #endif
40
41 #include "gx_validation_wrapper.h"
42 #include "demo_guix_all_widgets.c"
43
44 #define TIMER_EVENT_QUEUED 2
45 char test_comment[255];
46 int timer_ticks = 0;
47
test_event_process(GX_WINDOW * window,GX_EVENT * event_ptr)48 static UINT test_event_process(GX_WINDOW *window, GX_EVENT* event_ptr)
49 {
50 switch(event_ptr->gx_event_type)
51 {
52 case GX_EVENT_TIMER:
53 timer_ticks = event_ptr->gx_event_payload.gx_event_ulongdata;
54 break;
55
56 }
57 return gx_window_event_process(window, event_ptr);
58 }
59
60 /* This thread simulates user input. Its priority is lower
61 than the GUIX thread, so that GUIX finishes an operation
62 before this thread is able to issue the next command. */
control_thread_entry(ULONG input)63 static VOID control_thread_entry(ULONG input)
64 {
65 GX_EVENT my_event;
66 int index = 0;
67
68 memset(&my_event, 0, sizeof(GX_EVENT));
69 my_event.gx_event_display_handle = 1;
70
71 gx_widget_event_process_set((GX_WIDGET *)&button_screen, (UINT (*)(GX_WIDGET *, GX_EVENT *))test_event_process);
72 my_event.gx_event_type = GX_EVENT_TIMER;
73 my_event.gx_event_target = (GX_WIDGET *)&button_screen;
74 my_event.gx_event_payload.gx_event_ulongdata = 1;
75
76 tx_thread_suspend(&_gx_system_thread);
77 for(index = 0; index < TIMER_EVENT_QUEUED + 1; index++)
78 {
79 gx_system_event_fold(&my_event);
80 }
81 tx_thread_resume(&_gx_system_thread);
82
83 if(timer_ticks == TIMER_EVENT_QUEUED)
84 {
85 gx_validation_print_test_result(TEST_SUCCESS);
86 exit(0);
87 }
88 else
89 {
90 gx_validation_print_test_result(TEST_FAIL);
91 exit(1);
92 }
93 }
94