diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-04-15 17:34:29 +1000 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-04-15 17:34:29 +1000 |
| commit | a1cd6e8a281afca1fdadf655e4b6780e8384376b (patch) | |
| tree | f053727b4cfdcb9b90d7ea9ffbdf0152cfd29604 /tests/format/image/png | |
| parent | 76107d44f5e30edfd3b89a0363cd00d117dccd4f (diff) | |
feat(tests/png): Add lenna256 test for png
Diffstat (limited to 'tests/format/image/png')
| -rw-r--r-- | tests/format/image/png/assets/lenna256.png | bin | 0 -> 473831 bytes | |||
| -rw-r--r-- | tests/format/image/png/png_open.c | 34 |
2 files changed, 31 insertions, 3 deletions
diff --git a/tests/format/image/png/assets/lenna256.png b/tests/format/image/png/assets/lenna256.png Binary files differnew file mode 100644 index 0000000..59ef68a --- /dev/null +++ b/tests/format/image/png/assets/lenna256.png diff --git a/tests/format/image/png/png_open.c b/tests/format/image/png/png_open.c index a01a75b..97392fb 100644 --- a/tests/format/image/png/png_open.c +++ b/tests/format/image/png/png_open.c @@ -21,6 +21,23 @@ ff_result fftest_rgb2x2(ff_ctx* ctx) { return res;
}
+ff_result fftest_lenna256(ff_ctx* ctx) {
+ FILE* file = fopen("tests/format/image/png/assets/lenna256.png", "rb");
+ if (!file) {
+ printf("file failed to open\n");
+ return FF_RESULT_ERROR_INVALID_FILE;
+ }
+
+ ff_stream stream = ff_create_file_stream(file);
+
+ ff_png_ctx* png_ctx = NULL;
+ ff_result res = ff_open_png(ctx, &stream, &png_ctx, FF_ENABLE);
+
+ fclose(file);
+ ff_close_png(ctx, png_ctx);
+ return res;
+}
+
int main() {
ff_allocator alloc = { malloc, free, calloc };
ff_ctx* ctx = ff_init(&alloc);
@@ -28,14 +45,25 @@ int main() { ff_stream out = ff_create_file_stream(stdout);
ff_set_debug_stream(&out, ctx);
+
+ // rgb2x2
ff_result res = fftest_rgb2x2(ctx);
if (res == FF_RESULT_OK) {
- printf("Works!\n");
+ printf("rgb2x2: Works!\n");
} else {
- printf("Doesn't work :(\n");
+ printf("rgb2x2: Doesn't work :(\n");
}
-
+
+
+ // lenna256
+ res = fftest_lenna256(ctx);
+ if (res == FF_RESULT_OK) {
+ printf("lenna256: Works!\n");
+ } else {
+ printf("lenna256: Doesn't work :(\n");
+ }
+
ff_cleanup(ctx);
return 0;
|
