Files
LCUI/test/cases/test_image_reader.c
T
GregoryLiand李刚毅 c44562b45b refactor(paint): migrate to new naming style (#265)
* ib/paint 目录内代码及相关调用代码的重命名

* Revert "ib/paint 目录内代码及相关调用代码的重命名"

This reverts commit 6369a3b7bc.

* lib/paint 目录内代码及相关调用代码的重命名

* 添加 PandaGL 优化文档

* 修改部分命名规范

* - 将paint 中的LCUI_BOOL 更改为 pd_bool 其他地方保持 LCUI_BOOL
- 将 .h 文件中 PandaGL 函数更改为以 pd_ 前缀
- 将 paint 中 graph 更改为 canvas

* 退回 LCUI_StyleValue 与 LCUI_StyleType 的修改

* - 根据使用范围修改 types.h 中 LCUI_BOOL 与 pd_bool
- 回退LCUI_Style、LCUI_StyleRec
- 回退LCUI_Background

* 将 pd_paint_context 修改为 pd_paint_context_t *

* 替换 PDASSIGN

* 修改logger_debug

* 更改logger_error

Co-authored-by: 李刚毅 <gregoryli@foxmail.com>
2023-04-01 22:34:33 +08:00

31 lines
926 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)
{
pd_canvas_t img;
int i, width, height;
char file[256], *formats[] = { "png", "bmp", "jpg" };
for (i = 0; i < 3; ++i) {
width = height = 0;
pd_canvas_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);
pd_canvas_free(&img);
}
}