|
| 1 | +/** |
| 2 | + * xrdp: A Remote Desktop Protocol server. |
| 3 | + * |
| 4 | + * Copyright (C) Jay Sorg 2004-2021 |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + * you may not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + * |
| 18 | + * Test driver for XRDP routines |
| 19 | + * |
| 20 | + * If you want to run this driver under valgrind to check for memory leaks, |
| 21 | + * use the following command line:- |
| 22 | + * |
| 23 | + * CK_FORK=no valgrind --leak-check=full --show-leak-kinds=all \ |
| 24 | + * .libs/test_xrdp |
| 25 | + * |
| 26 | + * without the 'CK_FORK=no', memory still allocated by the test driver will |
| 27 | + * be logged |
| 28 | + */ |
| 29 | + |
| 30 | +#if defined(HAVE_CONFIG_H) |
| 31 | +#include "config_ac.h" |
| 32 | +#endif |
| 33 | + |
| 34 | +#include "log.h" |
| 35 | +#include "os_calls.h" |
| 36 | +#include <stdlib.h> |
| 37 | +#include "xrdp_egfx.h" |
| 38 | +#include "test_xrdp.h" |
| 39 | + |
| 40 | +START_TEST(test_xrdp_egfx_send_create_surface__happy_path) |
| 41 | +{ |
| 42 | + struct xrdp_egfx_bulk *bulk = g_new0(struct xrdp_egfx_bulk, 1); |
| 43 | + |
| 44 | + const int surface_id = 0xFF; |
| 45 | + const int width = 640; |
| 46 | + const int height = 480; |
| 47 | + const int pixel_format = 32; |
| 48 | + |
| 49 | + struct stream *s = xrdp_egfx_create_surface( |
| 50 | + bulk, surface_id, width, height, pixel_format); |
| 51 | + s->p = s->data; |
| 52 | + |
| 53 | + unsigned char descriptor; |
| 54 | + in_uint8(s, descriptor); |
| 55 | + ck_assert_int_eq(0xE0, descriptor); |
| 56 | +} |
| 57 | +END_TEST |
| 58 | + |
| 59 | +/******************************************************************************/ |
| 60 | +Suite * |
| 61 | +make_suite_egfx_base_functions(void) |
| 62 | +{ |
| 63 | + Suite *s; |
| 64 | + TCase *tc_process_monitors; |
| 65 | + |
| 66 | + s = suite_create("test_xrdp_egfx_base_functions"); |
| 67 | + |
| 68 | + tc_process_monitors = tcase_create("xrdp_egfx_base_functions"); |
| 69 | + tcase_add_test(tc_process_monitors, |
| 70 | + test_xrdp_egfx_send_create_surface__happy_path); |
| 71 | + |
| 72 | + suite_add_tcase(s, tc_process_monitors); |
| 73 | + |
| 74 | + return s; |
| 75 | +} |
| 76 | + |
0 commit comments