我有以下代码以测试是否视图正确配置(除其他外,我已在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