diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-03-30 16:42:08 +1100 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-03-30 16:42:08 +1100 |
| commit | 69b4c8a7b8fbf1ed9fa4422ea6bbd4865297166f (patch) | |
| tree | f1c6a481c6ad206bf1b583557bdae1cb7c319cce /tests/format/image/bmp/bmp_open.c | |
| parent | 0371a6da2ab8f4ae70e09aa12811b8ecf4f98faa (diff) | |
feat(bmp): Create bmp_open test
Diffstat (limited to 'tests/format/image/bmp/bmp_open.c')
| -rw-r--r-- | tests/format/image/bmp/bmp_open.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/format/image/bmp/bmp_open.c b/tests/format/image/bmp/bmp_open.c new file mode 100644 index 0000000..a8780c7 --- /dev/null +++ b/tests/format/image/bmp/bmp_open.c @@ -0,0 +1,43 @@ +#include <stdlib.h> +#include <tinyff/tinyff.h> +#include <tinyff/image/bmp.h> +#include <bridges/stdio/stream_bridge.h> +#include <stdio.h> +#include <tinyff/dbg.h> + +ff_result fftest_rgb2x2(ff_ctx* ctx) { + FILE* file = fopen("tests/format/image/bmp/assets/rgb2x2.bmp", "rb"); + if (!file) { + printf("file failed to open\n"); + return FF_RESULT_ERROR_INVALID_FILE; + } + + ff_stream stream = ff_create_file_stream(file); + + ff_bmp_ctx* png_ctx = NULL; + ff_result res = ff_open_bmp(ctx, &stream, &png_ctx, FF_ENABLE); + + fclose(file); + + return res; +} + +int main() { + ff_allocator alloc = { malloc, free, calloc }; + ff_ctx* ctx = ff_init(&alloc); + + ff_stream out = ff_create_file_stream(stdout); + ff_set_debug_stream(&out, ctx); + + ff_result res = fftest_rgb2x2(ctx); + + if (res == FF_RESULT_WARN_NO_IMPL) { + printf("Works!\n"); + } else { + printf("Doesn't work :(\n"); + } + + ff_cleanup(ctx); + + return 0; +} |
