mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-23 23:15:52 +00:00
Fix tab view test to work after 2758454.
Now that we use layoutSubviews in CPTabView we have to make sure it's called in a unit test scenario.
This commit is contained in:
1 parent
e2f19c30f1
commit
7b2464a740
1 file changed
+18
-12
@@ -28,15 +28,15 @@
|
||||
- (void)setUp
|
||||
{
|
||||
_tabView = [[CPTabView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)];
|
||||
|
||||
_tabItem1 = [[CPTabViewItem alloc] initWithIdentifier:@"id1"];
|
||||
|
||||
_tabItem1 = [[CPTabViewItem alloc] initWithIdentifier:@"id1"];
|
||||
[_tabItem1 setLabel:@"Item A"];
|
||||
[_tabItem1 setView:[[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]]
|
||||
|
||||
_tabItem2 = [[CPTabViewItem alloc] initWithIdentifier:@"id2"];
|
||||
[_tabItem2 setLabel:@"Item B"];
|
||||
[_tabItem2 setView:[[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]]
|
||||
|
||||
|
||||
[_tabView addTabViewItem:_tabItem1];
|
||||
[_tabView addTabViewItem:_tabItem2];
|
||||
}
|
||||
@@ -44,35 +44,41 @@
|
||||
- (void)testCreate
|
||||
{
|
||||
[self assertNotNull:_tabView];
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)testMiddle
|
||||
{
|
||||
var tabs = [_tabView tabs];
|
||||
[self assert:([_tabView frameSize].width / 2) equals:CPRectGetMidX([tabs frame])];
|
||||
[self assert:([_tabView frameSize].width / 2) equals:CGRectGetMidX([tabs frame])];
|
||||
}
|
||||
|
||||
- (void)testMiddleAfterMoveFrame
|
||||
{
|
||||
var tabs = [_tabView tabs];
|
||||
[_tabView setFrame:CPRectMake(10, 100, 1000, 200)];
|
||||
[self assert:([_tabView frameSize].width / 2) equals:CPRectGetMidX([tabs frame])];
|
||||
[_tabView setFrame:CGRectMake(10, 100, 1000, 200)];
|
||||
// Perform this manually for the sake of the unit test.
|
||||
[_tabView layoutIfNeeded];
|
||||
[self assert:([_tabView frameSize].width / 2) equals:CGRectGetMidX([tabs frame])];
|
||||
}
|
||||
|
||||
- (void)testMiddleAfterMoveBound
|
||||
{
|
||||
var tabs = [_tabView tabs];
|
||||
[_tabView setBounds:CPRectMake(100, 100, 20, 300)];
|
||||
[self assert:([tabs boundsSize].width / 2) equals:CPRectGetMidX([tabs bounds])];
|
||||
[_tabView setBounds:CGRectMake(100, 100, 20, 300)];
|
||||
// Perform this manually for the sake of the unit test.
|
||||
[_tabView layoutIfNeeded];
|
||||
[self assert:([tabs boundsSize].width / 2) equals:CGRectGetMidX([tabs bounds])];
|
||||
}
|
||||
|
||||
- (void)testBoxHeight
|
||||
{
|
||||
var box = [_tabView box],
|
||||
tabs = [_tabView tabs];
|
||||
|
||||
[_tabView setFrame:CPRectMake(0, 0, 800, 800)];
|
||||
|
||||
[_tabView setFrame:CGRectMake(0, 0, 800, 800)];
|
||||
// Perform this manually for the sake of the unit test.
|
||||
[_tabView layoutIfNeeded];
|
||||
[self assert:[box frameSize].height equals:800 - [tabs frameSize].height / 2];
|
||||
}
|
||||
|
||||
@@ -87,4 +93,4 @@
|
||||
[self assertNull:[_tabItem1 tabView]];
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
Reference in new issue
Block a user