int test_widget_rect( void ) { int i, ret = 0; float values[3] = { 1.0f, 1.5f, 2.0f }; for( i = 0; i < 3; ++i ) { memset( &self, 0, sizeof( self ) ); TEST_LOG( "test widget rectagle in " "%g%% scaling mode\n", values[i] * 100 ); LCUI_Init(); #ifdef _WIN32 Logger_SetHandler( LoggerHandler ); Logger_SetHandlerW( LoggerHandlerW ); #endif self.widget = create_widget(); LCUIMetrics_SetScale( values[i] ); LCUIDisplay_SetSize( SCREEN_WIDTH, SCREEN_HEIGHT ); /* 等一段时间后再开始测试,避免初始化 LCUI 时产生的脏矩形影响测试结果 */ LCUITimer_Set( 100, start_test, NULL, FALSE ); LCUIWidget_Update(); if( LCUI_Main() != 0 ) { ret -= 1; } } return ret; }
int test_xml_parser( void ) { int ret = 0; LCUI_Widget root, pack; LCUI_Init(); TEST_LOG( "test widget layout\n" ); LCUIDisplay_SetSize( 960, 680 ); root = LCUIWidget_GetRoot(); CHECK( pack = LCUIBuilder_LoadFile( "test_xml_parser.xml" ) ); if( !pack ) { LCUI_Destroy(); return ret; } Widget_UpdateStyle( root, TRUE ); Widget_Append( root, pack ); Widget_Unwrap( pack ); LCUIWidget_Update(); ret += check_widget_attribute(); LCUI_Destroy(); return ret; }
int test_widget_inline_block_layout( void ) { int ret = 0; LCUI_Widget root, pack; LCUI_Init(); TEST_LOG( "test widget inline block layout\n" ); LCUIDisplay_SetSize( SCREEN_WIDTH, SCREEN_HEIGHT ); root = LCUIWidget_GetRoot(); CHECK( pack = LCUIBuilder_LoadFile( "test_widget_inline_block_layout.xml" ) ); if( !pack ) { LCUI_Destroy(); return ret; } Widget_UpdateStyle( root, TRUE ); Widget_Append( root, pack ); Widget_Unwrap( pack ); LCUIWidget_Update(); ret += check_layout(); LCUI_Destroy(); return ret; }