From e91a5eaba43448a85b72bbca2d9b84d5040eb2ff Mon Sep 17 00:00:00 2001 From: TazyFoundSoup Date: Sun, 29 Mar 2026 10:05:03 +1100 Subject: feat(png/test): Create png_open test --- tests/format/image/png/assets/rgb2x2.png | Bin 0 -> 359 bytes tests/format/image/png/png_open.c | 32 +++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 tests/format/image/png/assets/rgb2x2.png (limited to 'tests') diff --git a/tests/format/image/png/assets/rgb2x2.png b/tests/format/image/png/assets/rgb2x2.png new file mode 100644 index 0000000..1e08da7 Binary files /dev/null and b/tests/format/image/png/assets/rgb2x2.png differ diff --git a/tests/format/image/png/png_open.c b/tests/format/image/png/png_open.c index 54ed6a3..9e01803 100644 --- a/tests/format/image/png/png_open.c +++ b/tests/format/image/png/png_open.c @@ -1,6 +1,34 @@ +#include "result.h" +#include "stream.h" #include #include +#include + +ff_result fftest_rgb2x2() { + FILE* file = fopen("assets/rgb2x2.png", "rb"); + if (!file) return FF_RESULT_ERROR_INVALID_FILE; + + ff_stream stream = ff_create_file_stream(file); + if (stream.user == NULL) { + fclose(file); + return FF_RESULT_ERROR_INVALID_FILE; + } + + ff_png_ctx* ctx = NULL; + ff_result res = ff_open_png(&stream, &ctx, FF_ENABLE); + + return res; +} + int main() { - ff_create_file_stream() -} \ No newline at end of file + ff_result res = fftest_rgb2x2(); + + if (res == FF_RESULT_WARN_NO_IMPL) { // This is only because I'm still busy. yall just jealous im 13 and better than like 80% of the people who have ever lived at this point in time. + printf("Works!\n"); + } else { + printf("Doesn't work :(\n"); + } + + return 0; +} -- cgit v1.2.3