/* 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 */ staticint RED = COLOR24RGB(255, 0, 0); staticint GREEN = COLOR24RGB(0, 255, 0); staticint BLUE = COLOR24RGB(0, 0, 255); staticint 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_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
/* *Scalingbitmapsproperlywillintroducecolorchangeswithdithering. *Alsosomefiletypesusecompression,andthesedonotrepresentcolors *perfectly. * *ThisisthePythagoreandistanceweallowbetweentwocolorsforthemto
* be considered close enough to each other */ #define MAX_SIMILAR_COLOR_DISTANCE 3
/* Time to allow some large bitmap test suites to run on slower platforms */ #define LARGE_BM_TEST_SUITE_TIMEOUT 10
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;
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 */ staticvoid
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 0x%06x, got 0x%06x",
i, j, expected, pixel);
}
}
/* Calculates whether two colors are close enough to be considered the same */ staticvoid
check_is_close_color(struct xrdp_bitmap *bm, int i, int j, int expected)
{ int pixel = xrdp_bitmap_get_pixel(bm, i, j); int r1; int g1; int b1; int r2; int g2; int b2; int variance;
if (variance > MAX_SIMILAR_COLOR_DISTANCE * MAX_SIMILAR_COLOR_DISTANCE)
{
ck_abort_msg("Pixmap (%d,%d) expected 0x%06x, got 0x%06x" " which exceeds distance of %d",
i, j, expected, pixel, MAX_SIMILAR_COLOR_DISTANCE);
}
}
/* Check we can load images of various depths with various transforms */ staticvoid
load_and_transform_img(constchar *name, enum xrdp_bitmap_load_transform transform, int twidth, int theight)
{ struct xrdp_wm *wm = NULL; int result;
/* Check we can load bitmaps that aren't a multiple of 4 pixels wide */ staticvoid
load_not4_img(constchar *name)
{ struct xrdp_wm *wm = NULL; int result;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.