From 47737c7d13f2a848153b8f929c777dc61fa57b7a Mon Sep 17 00:00:00 2001 From: matt335672 <30179339+matt335672@users.noreply.github.com> Date: Wed, 7 Jul 2021 11:36:29 +0100 Subject: [PATCH] Add unit tests for xrdp_bitmap_load() --- configure.ac | 1 + tests/Makefile.am | 3 +- tests/xrdp/Makefile.am | 37 +++++ tests/xrdp/test_24bit.bmp | Bin 0 -> 196662 bytes tests/xrdp/test_4bit.bmp | Bin 0 -> 32888 bytes tests/xrdp/test_8bit.bmp | Bin 0 -> 66614 bytes tests/xrdp/test_bitmap_load.c | 282 +++++++++++++++++++++++++++++++++ tests/xrdp/test_not4_24bit.bmp | Bin 0 -> 11710 bytes tests/xrdp/test_not4_4bit.bmp | Bin 0 -> 2102 bytes tests/xrdp/test_not4_8bit.bmp | Bin 0 -> 5046 bytes tests/xrdp/test_xrdp.h | 8 + tests/xrdp/test_xrdp_main.c | 62 ++++++++ 12 files changed, 392 insertions(+), 1 deletion(-) create mode 100644 tests/xrdp/Makefile.am create mode 100644 tests/xrdp/test_24bit.bmp create mode 100644 tests/xrdp/test_4bit.bmp create mode 100644 tests/xrdp/test_8bit.bmp create mode 100644 tests/xrdp/test_bitmap_load.c create mode 100644 tests/xrdp/test_not4_24bit.bmp create mode 100644 tests/xrdp/test_not4_4bit.bmp create mode 100644 tests/xrdp/test_not4_8bit.bmp create mode 100644 tests/xrdp/test_xrdp.h create mode 100644 tests/xrdp/test_xrdp_main.c diff --git a/configure.ac b/configure.ac index 0081ff49..49bd6013 100644 --- a/configure.ac +++ b/configure.ac @@ -454,6 +454,7 @@ AC_CONFIG_FILES([ tests/Makefile tests/common/Makefile tests/memtest/Makefile + tests/xrdp/Makefile tools/Makefile tools/devel/Makefile tools/devel/tcp_proxy/Makefile diff --git a/tests/Makefile.am b/tests/Makefile.am index c5342cd8..42b0df1c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,4 +4,5 @@ EXTRA_DIST = \ SUBDIRS = \ common \ - memtest + memtest \ + xrdp diff --git a/tests/xrdp/Makefile.am b/tests/xrdp/Makefile.am new file mode 100644 index 00000000..c1868ad2 --- /dev/null +++ b/tests/xrdp/Makefile.am @@ -0,0 +1,37 @@ +AM_CPPFLAGS = \ + -I$(top_builddir) \ + -I$(top_srcdir)/xrdp \ + -I$(top_srcdir)/libxrdp \ + -I$(top_srcdir)/common + +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +PACKAGE_STRING="XRDP daemon" + +EXTRA_DIST = \ + test_4bit.bmp \ + test_8bit.bmp \ + test_24bit.bmp \ + test_not4_4bit.bmp \ + test_not4_8bit.bmp \ + test_not4_24bit.bmp + +TESTS = test_xrdp +check_PROGRAMS = test_xrdp + +test_xrdp_SOURCES = \ + test_xrdp.h \ + test_xrdp_main.c \ + test_bitmap_load.c + +test_xrdp_CFLAGS = \ + -D IMAGEDIR=\"$(srcdir)\" \ + @CHECK_CFLAGS@ + +test_xrdp_LDADD = \ + $(top_builddir)/xrdp/xrdp_bitmap_load.o \ + $(top_builddir)/xrdp/xrdp_bitmap_common.o \ + $(top_builddir)/xrdp/funcs.o \ + $(top_builddir)/common/libcommon.la \ + @CHECK_LIBS@ diff --git a/tests/xrdp/test_24bit.bmp b/tests/xrdp/test_24bit.bmp new file mode 100644 index 0000000000000000000000000000000000000000..2125d824858733161b00579e2bdfe635ff891a0b GIT binary patch literal 196662 zcmeIyF^&@f5Jb^gaS3t~BEmfYIrl$~!6431Px?LbNOsg!-B14c>+|{Yyr0iM@AvnY zkALsS^Y#7f@AK`)^Ss~x&+B>av)sVzp6Le8|8@h@2C>9#Z@SZa081$i~=S|E6c*A;nMNb^{25 zY>e&oZ+aFUQv3vNH-Iq6#@Jr}rf12C>9#Z@S zZa081$i~=S|E6c*A;nMNb^{25Y>e&oZ+aFUQv3vNH-Iq6#@Jr}rf12C>9#Z@SZa081$i~=S|E6c*A;nMNb^{25Y>e&oZ+aFUQv3vN zH-Iq6#@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IyV}e8> zL~Aqbm>^LI(b^0+6+4;NEAY}Hp7ky z5`_@0&9GyFL?J|LGwhfkQ3%o63_B)B6hgE%!;T3Og%GXHuw#NmAw+94?3f@?2+`UM zJ0?gJLbNu+jtLTl5UtIyV}e8>L~Aqbm>^LI(b^0+6+4;NEAY}Hp7ky5`_@0&9GyFL?J|LGwhfkQ3%o63_B)B6hgE%!;T3O lg%GXHuw#NmAw+94?3f@?2+`UMJ0?gJLbNu+jtSC)@EbOUm_`5q literal 0 HcmV?d00001 diff --git a/tests/xrdp/test_4bit.bmp b/tests/xrdp/test_4bit.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9506afaf77a401809477742f914920b1edc3ca1d GIT binary patch literal 32888 zcmeI!!EM4o6h+ZNN+;Q5l_IiFJFMM?Tc8RGpeOQeOKIS2?|>ZxGG97*^Tf~ZeOu?c z&-v@Px?RU@eH^dW+SdB~zK-+t|7kv$=i0XG&z$FSj%_`k&-vheKG*wwT+K0$I>%{IN?U-_Fr`7;62Z~vQq z{a5}>p!}JD>DPazU;mXq6DWTsVEXl+>DPbd&jiY!37CHUXZrPD`7?p?X9A{Q|CxUM zSN=?({F#91*MFv8|CK)zD1Rnk`t_gb*MH^D1j?TYn120d`t@J=GlBAF0;XU8nST9O z{!F0!nSklnf2Lpml|K_GewGJC1)e-vshE0n^{hzwx*KF@VUQfBqy;{!D=I z=VqJ!X#e9sAb%4;{_=19?SBj)^5>sF36wt*ApE)6ruX|Re-kKwCSdyQf77r3%AX08 zKNB$h`p@+1zw&1S<0HP)35(bzy2$KCQ$xN!1U`s)35)^p9z#d x6EOYy&-ClR@@E3&&jd`r{xkjhul$)n`7;62um4QH{wsebQ2tE7^u7Pq`U7}?-7o+E literal 0 HcmV?d00001 diff --git a/tests/xrdp/test_8bit.bmp b/tests/xrdp/test_8bit.bmp new file mode 100644 index 0000000000000000000000000000000000000000..50d4a746f596dbc561124d3d1b53bccf35b241ec GIT binary patch literal 66614 zcmeH}v5liQ7zMutE^rwH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lk#K&;H3@09k+h$G@6D`tK&7%ICw~ ztN+OU$pwgiHvw6HzW=WN?4SGvkoCuZ{HqD1|84@Rd_LU0`uzSM|84^5zng$-Kl|s} z&;FA#zRYd`z%+Ry%{|84^5 zzng$-Kl|_6&;FA#zRYd`z% z+Ry%{|84^5zng$-Kl|_6&;FA#zRYd`z%+Ry%{|84^5zng$-Kl|_6&;FA#zRYd`z%+Ry%{|84^5zng$-Kl|_6|M>V9){xa* literal 0 HcmV?d00001 diff --git a/tests/xrdp/test_bitmap_load.c b/tests/xrdp/test_bitmap_load.c new file mode 100644 index 00000000..a26ce490 --- /dev/null +++ b/tests/xrdp/test_bitmap_load.c @@ -0,0 +1,282 @@ +#if defined(HAVE_CONFIG_H) +#include "config_ac.h" +#endif + +#include "test_xrdp.h" +#include "xrdp.h" + +/* Where the image files are located */ +#ifndef IMAGEDIR +#define IMAGEDIR "." +#endif + +/* Handy color definitions. These are variables so they are displayed + * in assert messages if tests fail */ +static int RED = COLOR24RGB(255, 0, 0); +static int GREEN = COLOR24RGB(0, 255, 0); +static int BLUE = COLOR24RGB(0, 0, 255); +static int WHITE = COLOR24RGB(255, 255, 255); + +/* Virtual desktop maxima and minima [MS-RDPBCGR] 2.2.1.3.6 */ +#define MAX_VDESKTOP_WIDTH 32766 +#define MAX_VDESKTOP_HEIGHT 32766 +#define MIN_VDESKTOP_WIDTH 200 +#define MIN_VDESKTOP_HEIGHT 200 + +/* Characteristics of the test bitmap(s) */ +#define TEST_BM_WIDTH 256 +#define TEST_BM_HEIGHT 256 + +#define TEST_NOT4_BM_WIDTH 62 +#define TEST_NOT4_BM_HEIGHT 62 + +#define TEST_BM_TOP_LEFT_PIXEL RED +#define TEST_BM_TOP_RIGHT_PIXEL GREEN +#define TEST_BM_BOTTOM_LEFT_PIXEL BLUE +#define TEST_BM_BOTTOM_RIGHT_PIXEL WHITE + +void setup(void) +{ +} + +void teardown(void) +{ +} + +/* Tests an error is returned for a non-existent file */ +START_TEST(test_bitmap_load__with_invalid_image__fail) +{ + struct xrdp_wm *wm = NULL; + int result; + + struct xrdp_bitmap *bm = xrdp_bitmap_create(4, 4, 32, WND_TYPE_IMAGE, wm); + + ck_assert_ptr_ne(bm, NULL); + + result = xrdp_bitmap_load(bm, "/dev/null", NULL, 0, XBLT_NONE, 0, 0); + + ck_assert_int_ne(result, 0); + + xrdp_bitmap_delete(bm); +} +END_TEST + +/* Checks a particular pixmap value is expected */ +static void +check_pixel(struct xrdp_bitmap *bm, int i, int j, int expected) +{ + int pixel = xrdp_bitmap_get_pixel(bm, i, j); + if (pixel != expected) + { + ck_abort_msg("Pixmap (%d,%d) expected %06x, got %06x", + i, j, expected, pixel); + } +} + +/* Check we can load bitmaps of various depths with various transforms */ +static void +load_and_transform_bm(int depth, + enum xrdp_bitmap_load_transform transform, + int twidth, int theight) +{ + struct xrdp_wm *wm = NULL; + int result; + + int width; + int height; + + char name[256]; + int top_left_pixel; + int top_right_pixel; + int bottom_left_pixel; + int bottom_right_pixel; + + struct xrdp_bitmap *bm = xrdp_bitmap_create(4, 4, 32, WND_TYPE_IMAGE, wm); + + ck_assert_ptr_ne(bm, NULL); + + g_snprintf(name, sizeof(name), IMAGEDIR "/test_%dbit.bmp", depth); + result = xrdp_bitmap_load(bm, name, NULL, 0, transform, twidth, theight); + + ck_assert_int_eq(result, 0); + + /* Bitmap right size? */ + if (transform == XBLT_NONE) + { + width = TEST_BM_WIDTH; + height = TEST_BM_HEIGHT; + ck_assert_int_eq(bm->width, TEST_BM_WIDTH); + ck_assert_int_eq(bm->height, TEST_BM_HEIGHT); + } + else + { + width = twidth; + height = theight; + ck_assert_int_eq(bm->width, twidth); + ck_assert_int_eq(bm->height, theight); + } + + /* Corners OK? */ + top_left_pixel = xrdp_bitmap_get_pixel(bm, 0, 0); + top_right_pixel = xrdp_bitmap_get_pixel(bm, width - 1, 0); + bottom_left_pixel = xrdp_bitmap_get_pixel(bm, 0, height - 1); + bottom_right_pixel = xrdp_bitmap_get_pixel(bm, width - 1, height - 1); + + ck_assert_int_eq(top_left_pixel, TEST_BM_TOP_LEFT_PIXEL); + ck_assert_int_eq(top_right_pixel, TEST_BM_TOP_RIGHT_PIXEL); + ck_assert_int_eq(bottom_left_pixel, TEST_BM_BOTTOM_LEFT_PIXEL); + ck_assert_int_eq(bottom_right_pixel, TEST_BM_BOTTOM_RIGHT_PIXEL); + + xrdp_bitmap_delete(bm); +} + +/* Check we can load bitmaps that aren't a multiple of 4 pixels wide */ +static void +load_not4_bm(int depth) +{ + struct xrdp_wm *wm = NULL; + int result; + + const int width = TEST_NOT4_BM_WIDTH; + const int height = TEST_NOT4_BM_HEIGHT; + + char name[256]; + int i; + int j; + + struct xrdp_bitmap *bm = xrdp_bitmap_create(4, 4, 32, WND_TYPE_IMAGE, wm); + + ck_assert_ptr_ne(bm, NULL); + + g_snprintf(name, sizeof(name), IMAGEDIR "/test_not4_%dbit.bmp", depth); + result = xrdp_bitmap_load(bm, name, NULL, 0, XBLT_NONE, 0, 0); + + ck_assert_int_eq(result, 0); + + /* Bitmap right size? */ + ck_assert_int_eq(bm->width, TEST_NOT4_BM_WIDTH); + ck_assert_int_eq(bm->height, TEST_NOT4_BM_HEIGHT); + + /* Check all data */ + for (i = 0 ; i < width / 2 ; ++i) + { + for (j = 0 ; j < height / 2 ; ++j) + { + check_pixel(bm, i, j, TEST_BM_TOP_LEFT_PIXEL); + check_pixel(bm, i + width / 2, j, TEST_BM_TOP_RIGHT_PIXEL); + check_pixel(bm, i, j + height / 2, TEST_BM_BOTTOM_LEFT_PIXEL); + check_pixel(bm, i + width / 2, j + height / 2, + TEST_BM_BOTTOM_RIGHT_PIXEL); + } + } + + xrdp_bitmap_delete(bm); +} + +START_TEST(test_bitmap_load__4_bit__ok) +{ + load_and_transform_bm(4, XBLT_NONE, 0, 0); +} +END_TEST + +START_TEST(test_bitmap_load__8_bit__ok) +{ + load_and_transform_bm(8, XBLT_NONE, 0, 0); +} +END_TEST + +START_TEST(test_bitmap_load__24_bit__ok) +{ + load_and_transform_bm(24, XBLT_NONE, 0, 0); +} +END_TEST + +START_TEST(test_bitmap_load__max_width_zoom__ok) +{ + load_and_transform_bm(24, + XBLT_ZOOM, MAX_VDESKTOP_WIDTH, MIN_VDESKTOP_HEIGHT); +} +END_TEST + +START_TEST(test_bitmap_load__max_height_zoom__ok) +{ + load_and_transform_bm(24, + XBLT_ZOOM, MIN_VDESKTOP_WIDTH, MAX_VDESKTOP_HEIGHT); +} +END_TEST + +START_TEST(test_bitmap_load__min_zoom__ok) +{ + load_and_transform_bm(24, + XBLT_ZOOM, MIN_VDESKTOP_WIDTH, MIN_VDESKTOP_HEIGHT); +} +END_TEST + +START_TEST(test_bitmap_load__max_width_scale__ok) +{ + load_and_transform_bm(24, + XBLT_SCALE, MAX_VDESKTOP_WIDTH, MIN_VDESKTOP_HEIGHT); +} +END_TEST + +START_TEST(test_bitmap_load__max_height_scale__ok) +{ + load_and_transform_bm(24, + XBLT_SCALE, MIN_VDESKTOP_WIDTH, MAX_VDESKTOP_HEIGHT); +} +END_TEST + +START_TEST(test_bitmap_load__min_scale__ok) +{ + load_and_transform_bm(24, + XBLT_SCALE, MIN_VDESKTOP_WIDTH, MIN_VDESKTOP_HEIGHT); +} +END_TEST + +START_TEST(test_bitmap_load__not_4_pixels_wide_4_bit__ok) +{ + load_not4_bm(4); +} +END_TEST + +START_TEST(test_bitmap_load__not_4_pixels_wide_8_bit__ok) +{ + load_not4_bm(8); +} +END_TEST + +START_TEST(test_bitmap_load__not_4_pixels_wide_24_bit__ok) +{ + load_not4_bm(24); +} +END_TEST + +/******************************************************************************/ +Suite * +make_suite_test_bitmap_load(void) +{ + Suite *s; + TCase *tc_bitmap_load; + + s = suite_create("BitmapLoad"); + + tc_bitmap_load = tcase_create("xrdp_bitmap_load"); + tcase_add_checked_fixture(tc_bitmap_load, setup, teardown); + tcase_add_test(tc_bitmap_load, test_bitmap_load__with_invalid_image__fail); + tcase_add_test(tc_bitmap_load, test_bitmap_load__4_bit__ok); + tcase_add_test(tc_bitmap_load, test_bitmap_load__8_bit__ok); + tcase_add_test(tc_bitmap_load, test_bitmap_load__24_bit__ok); + tcase_add_test(tc_bitmap_load, test_bitmap_load__max_width_zoom__ok); + tcase_add_test(tc_bitmap_load, test_bitmap_load__max_height_zoom__ok); + tcase_add_test(tc_bitmap_load, test_bitmap_load__min_zoom__ok); + tcase_add_test(tc_bitmap_load, test_bitmap_load__max_width_scale__ok); + tcase_add_test(tc_bitmap_load, test_bitmap_load__max_height_scale__ok); + tcase_add_test(tc_bitmap_load, test_bitmap_load__min_scale__ok); + tcase_add_test(tc_bitmap_load, test_bitmap_load__not_4_pixels_wide_4_bit__ok); + tcase_add_test(tc_bitmap_load, test_bitmap_load__not_4_pixels_wide_8_bit__ok); + tcase_add_test(tc_bitmap_load, test_bitmap_load__not_4_pixels_wide_24_bit__ok); + + suite_add_tcase(s, tc_bitmap_load); + + return s; +} diff --git a/tests/xrdp/test_not4_24bit.bmp b/tests/xrdp/test_not4_24bit.bmp new file mode 100644 index 0000000000000000000000000000000000000000..fa21f24fd8a42c9a4f43d8fb05565bc4244dc37b GIT binary patch literal 11710 zcmeI$p$-Bu5QO37E$|o&NF)N!EAwilSHR7zx(ViQt`)P%rrG<>+~fJW)LOTBp69-Q z_o0p}-;UGuvwy*;3O*yaq8FddlZ(51bJR4{85DqujBo;fN% R8a~J&Fq%G4GsvLJ9{_^P&-wrW literal 0 HcmV?d00001 diff --git a/tests/xrdp/test_not4_8bit.bmp b/tests/xrdp/test_not4_8bit.bmp new file mode 100644 index 0000000000000000000000000000000000000000..87405a37e467f5dde1b8de37540609f2eb8a3f85 GIT binary patch literal 5046 zcmeIzF^<$g5QX7~L_kKs1xg|zA|ym5a_&$^siRbYI0A9SoPnT@u<0&Hv;VkPgq?%h z_UG4Yk7uUKwVp3uf4tMRe0nW?VD$OLE4{gn=UeIh$K^Wkcb5{IGFPx?sP0z(YCZh? zE}0|12`e;4a>2mB1BpUoq!0`a{)j}OF)yEMq$7|hG)7{mGB^T>LSy)ng253;6dEJ3 zX$+1)qR<$*_?j}@*Fd7sm^C#s(h*1$8ndSDMmhqCLSt4*!bnFTQE1F6R~qREBnpjL zr7R;IfkdG(tITbrBakRG=DGzwMmhqCLSvN7KV`VjJaAtNjZvCla0C*C#;n`sMmhqC zLSxn~4I>?aM4>V3cJm>bjzFT&nAHkpq$7|hG-kC)8|ern3XQp1D91=gAW>+Hn)$a3 zjzFStUuU(J8R-Zl3XNH9=SDgLi9%ymONNn-K%&r?)vjrzBakRGX0>t|=?EkWjahBp zMmhqC(!=kYzVW)`{iNHq>2|x1z + +Suite *make_suite_test_bitmap_load(void); + +#endif /* TEST_XRDP_H */ diff --git a/tests/xrdp/test_xrdp_main.c b/tests/xrdp/test_xrdp_main.c new file mode 100644 index 00000000..eb118a1e --- /dev/null +++ b/tests/xrdp/test_xrdp_main.c @@ -0,0 +1,62 @@ +/** + * xrdp: A Remote Desktop Protocol server. + * + * Copyright (C) Jay Sorg 2004-2021 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Test driver for XRDP routines + * + * If you want to run this driver under valgrind to check for memory leaks, + * use the following command line:- + * + * CK_FORK=no valgrind --leak-check=full --show-leak-kinds=all \ + * .libs/test_xrdp + * + * without the 'CK_FORK=no', memory still allocated by the test driver will + * be logged + */ + +#if defined(HAVE_CONFIG_H) +#include "config_ac.h" +#endif + +#include "log.h" +#include "os_calls.h" +#include "test_xrdp.h" +#include + +int main (void) +{ + int number_failed; + SRunner *sr; + struct log_config *logging; + + /* Configure the logging sub-system so that functions can use + * the log functions as appropriate */ + logging = log_config_init_for_console(LOG_LEVEL_INFO, + g_getenv("TEST_LOG_LEVEL")); + log_start_from_param(logging); + log_config_free(logging); + + sr = srunner_create (make_suite_test_bitmap_load()); + + srunner_set_tap(sr, "-"); + srunner_run_all (sr, CK_ENV); + number_failed = srunner_ntests_failed(sr); + srunner_free(sr); + + log_end(); + + return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +}