我有以下代码来测试视图是否配置正确(除其他外,我将其monthScrollview
放置为视图的子视图:
@implementation ECBrowserViewControllerTests
-(void)setUp
{
//-deviceSpecific simply adds suffix like '_iPad'
main=[[ECBrowserViewController alloc] initWithNibName:[@"ECBrowserViewController" deviceSpecific] bundle:nil];
}
-(void)testOutlets
{
STAssertNotNil(main.view, @"View outlet not set!");
STAssertNotNil(main.monthScrollView, @"no month scrollview");
STAssertTrue(main.monthScrollView.pagingEnabled, @"Paging should be enabled");
}
-(void)testPaging
{
STAssertNotNil(main.monthScrollView, @"no month scrollview");
STAssertTrue(main.monthScrollView.pagingEnabled, @"Paging should be enabled");
}
@end
谁能告诉我为什么testPaging
失败,而testOutlets
成功?我发现这是先检查 parentView,但为什么呢?
我正在使用 Xcode 4.6.3 和内置 SenTestingKit