mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-22 18:30:43 +00:00
test item visibility when expanding/collapsing items
This commit is contained in:
@@ -161,6 +161,17 @@
|
||||
[self assert:2 equals:[[outlineView selectedRowIndexes] count] message:"selections should remain"];
|
||||
}
|
||||
|
||||
|
||||
- (void)testExpandCollapseItemVisibility
|
||||
{
|
||||
var delegate = [TestExpandCollapseVisibilityDelegate new];
|
||||
[delegate setTester:self];
|
||||
[outlineView setDelegate:delegate];
|
||||
|
||||
[outlineView collapseItem:".1"];
|
||||
[outlineView expandItem:".1"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Test that the outline view archives properly.
|
||||
*/
|
||||
@@ -270,3 +281,50 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TestExpandCollapseVisibilityDelegate : CPObject
|
||||
{
|
||||
id tester @accessors;
|
||||
}
|
||||
|
||||
- (void)outlineViewItemWillCollapse:(CPNotification)aNotification
|
||||
{
|
||||
var anOutlineView = [aNotification object],
|
||||
visibleRows = [anOutlineView rowsInRect:[anOutlineView visibleRect]];
|
||||
|
||||
[tester assertTrue:[anOutlineView isItemExpanded:".1"]];
|
||||
[tester assert:0 equals:visibleRows.location];
|
||||
[tester assert:8 equals:visibleRows.length];
|
||||
}
|
||||
|
||||
- (void)outlineViewItemDidCollapse:(CPNotification)aNotification
|
||||
{
|
||||
var anOutlineView = [aNotification object],
|
||||
visibleRows = [anOutlineView rowsInRect:[anOutlineView visibleRect]];
|
||||
|
||||
[tester assertFalse:[anOutlineView isItemExpanded:".1"]];
|
||||
[tester assert:0 equals:visibleRows.location];
|
||||
[tester assert:4 equals:visibleRows.length];
|
||||
}
|
||||
|
||||
- (void)outlineViewItemWillExpand:(CPNotification)aNotification
|
||||
{
|
||||
var anOutlineView = [aNotification object],
|
||||
visibleRows = [anOutlineView rowsInRect:[anOutlineView visibleRect]];
|
||||
|
||||
[tester assertFalse:[anOutlineView isItemExpanded:".1"]];
|
||||
[tester assert:0 equals:visibleRows.location];
|
||||
[tester assert:4 equals:visibleRows.length];
|
||||
}
|
||||
|
||||
- (void)outlineViewItemDidExpand:(CPNotification)aNotification
|
||||
{
|
||||
var anOutlineView = [aNotification object],
|
||||
visibleRows = [anOutlineView rowsInRect:[anOutlineView visibleRect]];
|
||||
|
||||
[tester assertTrue:[anOutlineView isItemExpanded:".1"]];
|
||||
[tester assert:0 equals:visibleRows.location];
|
||||
[tester assert:8 equals:visibleRows.length];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user