Files
LCUI/test/cases/test_image_reader.c
T
YDYKand李梓豪 b46306ddea refactor(util): add yutil library (#264)
* add yutil

* add yutil to util.h

* remove util file that same as yutil's

* replace the old header file like '#include <LCUI/util/*>' with yutil's head file

* Replace the old UTIL module associated data structures and function call code

* change timer

* Replace the old UTIL module associated data structures and function call code

* fix

* fix compilation problems(RGB to YUTIL_TEST_RGB)

* turn some useless changes back to origin

* change YUTIL_TEST_RGB back to RGB and add  lcui-util/xmake.lua include

* update github action

* update github action

* update github action

* change new yutil func name

* update xmake and change way to include yutil

* update include to <yutil.h>

* update list_for_each to for(list_each())

* fix

* add graph.h to test_*

* add #include <LCUI/graph.h>

* update yutil

* change timer func name and update submodule

* update submodules

* test strncpy

* turn useless code back origin

* fix lose RGB issue

* fix yutil charset

* update yutil

* update yutil

* add yutil_test instead of lcui-util test

* change timer func name style

Co-authored-by: 李梓豪 <yidianyiko@foxmail.com>
2023-04-01 22:34:33 +08:00

31 lines
917 B
C

#include <stdio.h>
#include <LCUI.h>
#include <LCUI/graph.h>
#include <LCUI/image.h>
#include <yutil.h>
#include "ctest.h"
void test_image_reader(void)
{
LCUI_Graph img;
int 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]);
logger_debug("image file: %s\n", file);
it_i("check LCUI_ReadImageFile", LCUI_ReadImageFile(file, &img),
0);
it_i("check image width with ReadImageFile", img.width, 91);
it_i("check image height with ReadImageFile", img.height, 69);
it_i("check LCUI_GetImageSize",
LCUI_GetImageSize(file, &width, &height), 0);
logger_debug("image size: (%d, %d)\n", width, height);
it_i("check image width with GetImageSize", width, 91);
it_i("check image height with GetImageSize", height, 69);
Graph_Free(&img);
}
}