summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTazyFoundSoup <gardendistrict0x0@outlook.com>2026-03-29 10:05:03 +1100
committerTazyFoundSoup <gardendistrict0x0@outlook.com>2026-03-29 10:05:03 +1100
commite91a5eaba43448a85b72bbca2d9b84d5040eb2ff (patch)
treec3185428d1d6913d99f1cf60feca3bbeb6c7e7cc
parentf5b672b27cb455f2e9911d05309f827756e1c9c5 (diff)
feat(png/test): Create png_open test
-rw-r--r--tests/format/image/png/assets/rgb2x2.pngbin0 -> 359 bytes
-rw-r--r--tests/format/image/png/png_open.c32
2 files changed, 30 insertions, 2 deletions
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
--- /dev/null
+++ b/tests/format/image/png/assets/rgb2x2.png
Binary files 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 <tinyff/image/png.h>
#include <bridges/stdio/stream.h>
+#include <stdio.h>
+
+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;
+}