From a9bcc81f821d7c66f623779fa5147e728eb3c388 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 03:24:41 +0200 Subject: Adding upstream version 3.3.0+dfsg1. Signed-off-by: Daniel Baumann --- rdtk/librdtk/test/TestRdTkNinePatch.c | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 rdtk/librdtk/test/TestRdTkNinePatch.c (limited to 'rdtk/librdtk/test/TestRdTkNinePatch.c') diff --git a/rdtk/librdtk/test/TestRdTkNinePatch.c b/rdtk/librdtk/test/TestRdTkNinePatch.c new file mode 100644 index 0000000..2c7405f --- /dev/null +++ b/rdtk/librdtk/test/TestRdTkNinePatch.c @@ -0,0 +1,62 @@ + +#include +#include +#include +#include + +int TestRdTkNinePatch(int argc, char* argv[]) +{ + rdtkEngine* engine = NULL; + rdtkSurface* surface = NULL; + uint32_t scanline = 0; + uint32_t width = 0; + uint32_t height = 0; + uint8_t* data = NULL; + int ret = -1; + + WINPR_UNUSED(argc); + WINPR_UNUSED(argv); + + if (!(engine = rdtk_engine_new())) + { + printf("%s: error creating rdtk engine (%" PRIu32 ")\n", __func__, GetLastError()); + goto out; + } + + width = 1024; + height = 768; + scanline = width * 4; + + /* let rdtk allocate the surface buffer */ + if (!(surface = rdtk_surface_new(engine, NULL, width, height, scanline))) + { + printf("%s: error creating auto-allocated surface (%" PRIu32 ")\n", __func__, + GetLastError()); + goto out; + } + rdtk_surface_free(surface); + surface = NULL; + + /* test self-allocated buffer */ + if (!(data = calloc(height, scanline))) + { + printf("%s: error allocating surface buffer (%" PRIu32 ")\n", __func__, GetLastError()); + goto out; + } + + if (!(surface = rdtk_surface_new(engine, data, width, height, scanline))) + { + printf("%s: error creating self-allocated surface (%" PRIu32 ")\n", __func__, + GetLastError()); + goto out; + } + + ret = 0; + +out: + rdtk_surface_free(surface); + rdtk_engine_free(engine); + free(data); + + return ret; +} -- cgit v1.2.3