summaryrefslogtreecommitdiffstats
path: root/rdtk/librdtk/test/TestRdTkNinePatch.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
commita9bcc81f821d7c66f623779fa5147e728eb3c388 (patch)
tree98676963bcdd537ae5908a067a8eb110b93486a6 /rdtk/librdtk/test/TestRdTkNinePatch.c
parentInitial commit. (diff)
downloadfreerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.tar.xz
freerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.zip
Adding upstream version 3.3.0+dfsg1.upstream/3.3.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'rdtk/librdtk/test/TestRdTkNinePatch.c')
-rw-r--r--rdtk/librdtk/test/TestRdTkNinePatch.c62
1 files changed, 62 insertions, 0 deletions
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 <stdio.h>
+#include <stdint.h>
+#include <rdtk/rdtk.h>
+#include <winpr/error.h>
+
+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;
+}