重构显示逻辑为 MVP 架构,进行显示模块的解耦

This commit is contained in:
2026-03-24 19:52:22 +08:00
parent a4bf0962b2
commit 0690d6a00e
42 changed files with 2207 additions and 1417 deletions

View File

@@ -1,13 +1,42 @@
/* -------------------------------------------------------------------------
* 文件名: test_p0_utf8_hz12_get.c
* 作用:
* 验证中文点阵查询接口 utf8_hz12_get() 的基础行为是否正确。
*
* 被测接口:
* const uint8_t* utf8_hz12_get(uint32_t unicode);
*
* 测试目标:
* 1) 对于字库中存在的码点,应返回非 NULL 位图指针。
* 2) 对于字库范围外或不存在的码点,应返回 NULL。
*
* 说明:
* - 本测试只校验“是否命中”这一契约,不校验位图内容本身。
* - 若后续需要,可新增逐字节位图校验测试。
* ------------------------------------------------------------------------- */
#include "../src/Drv/lcd/ascii.h"
#include "test_common.h"
/* -------------------------------------------------------------------------
* 测试入口:
* 按“命中/低位未命中/高位未命中”三个场景依次断言。
*
* 返回值约定:
* 0 -> 测试通过
* 非0 -> 断言失败(由 ASSERT_* 宏返回)
* ------------------------------------------------------------------------- */
int main(void)
{
/* 命中用例U+4F60“你”通常在当前字库中存在 */
const uint8_t* hit = utf8_hz12_get(0x4F60u); /* 你 */
/* 低位未命中:非常低的控制区码点,预期不在中文字库 */
const uint8_t* miss_low = utf8_hz12_get(0x0001u);
/* 高位未命中:超高码点,预期不在当前 12 点阵中文表中 */
const uint8_t* miss_high = utf8_hz12_get(0x10FFFFu);
/* 命中必须返回有效指针 */
ASSERT_TRUE(hit != NULL);
/* 非命中必须返回 NULL */
ASSERT_TRUE(miss_low == NULL);
ASSERT_TRUE(miss_high == NULL);
return 0;