summaryrefslogtreecommitdiff
path: root/tests/format/image/png/png_open.c
blob: 9e01803721b03c4a8a52ea6ef88cf8058cf1b136 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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_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;
}