Files
LCUI/test/test_image_reader.c
T
Liu 1a50aeca37 refactor(gui): improve widget update processing
BREAKING CHANGE: Some widget operation functions have been renamed or removed.
2020-02-16 17:43:35 +08:00

28 lines
714 B
C

#include <stdio.h>
#include <LCUI_Build.h>
#include <LCUI/LCUI.h>
#include <LCUI/graph.h>
#include <LCUI/image.h>
#include "test.h"
int test_image_reader(void)
{
LCUI_Graph img;
int ret = 0, i, width, height;
char file[256], *formats[] = { "png", "bmp", "jpg" };
for (i = 0; i < 3; ++i) {
width = height = 0;
Graph_Init(&img);
snprintf(file, 255, "test_image_reader.%s", formats[i]);
TEST_LOG("image file: %s\n", file);
CHECK(LCUI_ReadImageFile(file, &img) == 0);
CHECK(img.width == 91 && img.height == 69);
CHECK(LCUI_GetImageSize(file, &width, &height) == 0);
TEST_LOG("image size: (%d, %d)\n", width, height);
CHECK(width == 91 && height == 69);
Graph_Free(&img);
}
return ret;
}