mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-01 02:42:03 +00:00
-[CPScrollView setContentView:] did not allow changing the content view.
This commit is contained in:
1 parent
3287b02816
commit
2037ab9a5e
2 files changed
+27
-1
No files matched your search
@@ -186,7 +186,7 @@
|
||||
*/
|
||||
- (void)setContentView:(CPClipView)aContentView
|
||||
{
|
||||
if (_contentView !== aContentView || !aContentView)
|
||||
if (_contentView === aContentView || !aContentView)
|
||||
return;
|
||||
|
||||
var documentView = [aContentView documentView];
|
||||
|
||||
@@ -174,4 +174,30 @@
|
||||
[self assert:[[scrollView verticalScroller] isEnabled] equals:NO];
|
||||
}
|
||||
|
||||
- (void)testSetContentView
|
||||
{
|
||||
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 100.0)];
|
||||
var documentView = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 400.0)];
|
||||
|
||||
var replacementContentView = [[CPClipView alloc] initWithFrame:[scrollView _insetBounds]];
|
||||
var replacementDocumentView = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 400.0)];
|
||||
|
||||
[replacementContentView setDocumentView:replacementDocumentView];
|
||||
|
||||
// Test the obvious condition that they aren't the same
|
||||
[self assert:replacementContentView notEqual:[scrollView contentView] message:@"contentView somehow equals the replacement"];
|
||||
|
||||
// Test the obvious condition that the document view can be get/set
|
||||
[scrollView setDocumentView:documentView];
|
||||
[self assert:documentView equals:[scrollView documentView] message:@"documentView is not set as expected"];
|
||||
|
||||
// Change the content view
|
||||
[scrollView setContentView:replacementContentView];
|
||||
|
||||
// Test that the content view has been replaced
|
||||
[self assert:replacementContentView equals:[scrollView contentView] message:@"contentView was not replaced properly"];
|
||||
// and that the document view has been replaced
|
||||
[self assert:replacementDocumentView equals:[scrollView documentView] message:@"documentView was not replaced properly"];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user