重构显示逻辑为 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

@@ -0,0 +1,39 @@
#include "test_common.h"
#include "../src/Drv/key.h"
#include "../src/Drv/menu/app/menu.h"
int main(void)
{
int decorated_found = 0;
uint16_t itemCount = 0;
const tagMenuItem *menuItems;
MenuApp_Init();
Key_Init();
menuItems = MenuApp_GetMenuItems(&itemCount);
for (uint16_t i = 0; i < itemCount; i++)
{
if (menuItems[i].ptLower != NULL)
{
uint8_t len = 0;
while ((len < 50) && (menuItems[i].byName[len] != '\0'))
{
len++;
}
ASSERT_TRUE(len > 0);
ASSERT_EQ_INT('\x10', menuItems[i].byName[len - 1]);
decorated_found = 1;
break;
}
}
ASSERT_TRUE(decorated_found == 1);
/* 首次路由应仅触发首帧绘制,不应崩溃 */
MenuApp_PollInput();
/* 二次刷新路径也不应崩溃 */
MenuApp_Render();
return 0;
}