重构显示逻辑为 MVP 架构,进行显示模块的解耦
This commit is contained in:
39
tests/test_p2_menu_runtime_startup.c
Normal file
39
tests/test_p2_menu_runtime_startup.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user