加入测试代码,进行测试

This commit is contained in:
anod 2022-10-13 22:46:57 +08:00
parent 980f60b274
commit dfc229fe8b
2 changed files with 6 additions and 4 deletions

View File

@ -242,12 +242,12 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t
atp_error_t result = provider(data, item_sel, &config);
if( ATP_SUCCESS == result )
{
*res = config.value;
if( res != NULL ) *res = config.value;
return ATP_SUCCESS;
}
else
{
*res = result;
if( res != NULL ) *res = result;
return ATP_INVALID_VALUE;
}
}
@ -258,6 +258,8 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t
}
else if( key & (KEY_X | KEY_Y | KEY_SELECT | KEY_START) )
{
if( handler == NULL ) continue;
atp_pageopt_t opt = handler( data, key&KEY_X, key&KEY_Y, key&KEY_START, key&KEY_SELECT );
switch( opt )
{

View File

@ -90,7 +90,7 @@ static const char *page[] = {
"女儿情长埋葬"
};
static atp_error_t test_show( atp_callerdata_t , atp_counter_t idx, atp_linecfg_t *pcfg )
static atp_error_t test_show( atp_callerdata_t , atp_counter_t idx, atp_itemcfg_t *pcfg )
{
if( idx < sizeof(page) )
{
@ -300,7 +300,7 @@ Result browseFiles(const char *const basePath, char selected[512])
if( kDown & KEY_X )
{
atp_tips(curDir, "B键返回");
if( atp_show( 22, test_show, NULL ) == ATP_POWER_OFF )
if( atp_select( "我的第一个职业愿望是做足球运动员,这个梦想小学就被封杀了,因为我的体格太瘦小", 4, test_show, NULL, NULL, NULL ) == ATP_POWER_OFF )
{
screenClean();
res = RES_INVALID_ARG;