48 lines
1.1 KiB
C
48 lines
1.1 KiB
C
#include "test_common.h"
|
|
|
|
#include <string.h>
|
|
|
|
#include "../src/Drv/lcd/lcd.h"
|
|
#include "../src/Drv/menu/app/menu.h"
|
|
#include "../src/Drv/menu/view/menu_layout.h"
|
|
|
|
int main(void)
|
|
{
|
|
tagMenuItem root;
|
|
tagMenuItem child;
|
|
MenuLayoutConfig config = {
|
|
LCD_SIZE_X,
|
|
LCD_SIZE_Y,
|
|
MENU_YMIN,
|
|
MENU_YMAX_FROM_LCD(LCD_SIZE_Y),
|
|
LINE_HEIGHT,
|
|
MENU_WITDTH,
|
|
MENU_XADD,
|
|
MENU_YADD};
|
|
|
|
memset(&root, 0, sizeof(root));
|
|
memset(&child, 0, sizeof(child));
|
|
|
|
memcpy(root.byName, "Root", 5);
|
|
memcpy(child.byName, "Child", 6);
|
|
root.byClass = 0;
|
|
child.byClass = 1;
|
|
|
|
root.ptLower = &child;
|
|
root.ptBehind = &root;
|
|
root.ptBefore = &root;
|
|
child.ptHigher = &root;
|
|
child.ptBehind = &child;
|
|
child.ptBefore = &child;
|
|
|
|
ASSERT_EQ_INT(3, MenuLayout_Utf8LenCal((uint8_t *)"ABC"));
|
|
ASSERT_EQ_INT(2, MenuLayout_Utf8LenCal((uint8_t *)"你"));
|
|
|
|
MenuLayout_PositionCal(&root, 1, &config);
|
|
ASSERT_TRUE(root.wEPosX > root.wSPosX);
|
|
ASSERT_TRUE(root.wEPosY > root.wSPosY);
|
|
ASSERT_TRUE(root.wEPosY <= LCD_SIZE_Y);
|
|
|
|
return 0;
|
|
}
|