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_canvas_pixelmap_get_no_output", /* Test name */
11 0, 0, 0, 0 /* Define the coordinates of the capture area. */
12 };
13
main(int argc,char ** argv)14 int main(int argc, char ** argv)
15 {
16 /* Start ThreadX system */
17 tx_kernel_enter();
18 return(0);
19 }
20
21 static VOID control_thread_entry(ULONG);
22
tx_application_define(void * first_unused_memory)23 VOID tx_application_define(void *first_unused_memory)
24 {
25 /* Create a dedicated thread to perform various operations
26 on the pixelmap drawing example. These operations simulate
27 user input. */
28 gx_validation_control_thread_create(control_thread_entry);
29
30 gx_validation_application_define(first_unused_memory);
31
32 /* Termiante the test if it runs for more than 100 ticks */
33 /* This function is not implemented yet. */
34 gx_validation_watchdog_create(100);
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
control_thread_entry(ULONG input)44 static VOID control_thread_entry(ULONG input)
45 {
46 int failed_tests = 0;
47 GX_CANVAS *canvas = GX_NULL;
48 GX_DISPLAY *display = GX_NULL;
49 GX_PIXELMAP return_map;
50 UINT status;
51 GX_RECTANGLE size = {0};
52
53 canvas = root->gx_window_root_canvas;
54 display = canvas->gx_canvas_display;
55
56 status = gx_canvas_pixelmap_get(GX_NULL);
57 EXPECT_EQ(GX_PTR_ERROR, status);
58
59 status = gx_canvas_pixelmap_get(&return_map);
60 EXPECT_EQ(GX_INVALID_CONTEXT, status);
61
62 gx_canvas_drawing_initiate(canvas, root, &size);
63 status = gx_canvas_pixelmap_get(&return_map);
64 gx_canvas_drawing_complete(canvas, GX_FALSE);
65 EXPECT_EQ(GX_SUCCESS, status);
66
67 gx_canvas_drawing_initiate(canvas, root, &size);
68 _gx_system_current_draw_context->gx_draw_context_display = GX_NULL;
69 status = gx_canvas_pixelmap_get(&return_map);
70 _gx_system_current_draw_context->gx_draw_context_display = display;
71 gx_canvas_drawing_complete(canvas, GX_FALSE);
72 EXPECT_EQ(GX_INVALID_DISPLAY, status);
73
74 gx_canvas_drawing_initiate(canvas, root, &size);
75 _gx_system_current_draw_context->gx_draw_context_canvas = GX_NULL;
76 status = gx_canvas_pixelmap_get(&return_map);
77 gx_canvas_drawing_complete(canvas, GX_FALSE);
78 EXPECT_EQ(GX_INVALID_CANVAS, status);
79
80
81 if(failed_tests == 0)
82 {
83 gx_validation_print_test_result(TEST_SUCCESS);
84 exit(0);
85 }
86 else
87 {
88 gx_validation_print_test_result(TEST_FAIL);
89 exit(1);
90 }
91 }
92