Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Unit test CPSplitView.

  • Loading branch information...
commit 95368585990fb1a2688394389dcb5481792bd85c 1 parent c7d3ccb
@aljungberg aljungberg authored
Showing with 39 additions and 0 deletions.
  1. +39 −0 Tests/AppKit/CPSplitViewTest.j
View
39 Tests/AppKit/CPSplitViewTest.j
@@ -0,0 +1,39 @@
+
+@import <AppKit/CPApplication.j>
+@import <AppKit/CPSplitView.j>
+
+[CPApplication sharedApplication]
+
+@implementation CPSplitViewTest : OJTestCase
+{
+}
+
+- (void)testSplitViewResize
+{
+ var splitView = [[CPSplitView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)],
+ viewA = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 50)],
+ viewB = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];
+
+ [splitView addSubview:viewA];
+ [splitView addSubview:viewB];
+ [splitView setVertical:NO];
+
+ var dividerThickness = [splitView dividerThickness];
+
+ [splitView setPosition:50 ofDividerAtIndex:0];
+
+ [self assert:50 equals:[viewA frameSize].height];
+ [self assert:(50 - dividerThickness) equals:[viewB frameSize].height];
+
+ [splitView setPosition:40 ofDividerAtIndex:0];
+
+ [self assert:40 equals:[viewA frameSize].height];
+ [self assert:(60 - dividerThickness) equals:[viewB frameSize].height];
+
+ [splitView setFrame:CGRectMake(0, 0, 200, 200)];
+ // The extra size should be distributed proportionally to the original sizes of the subviews.
+ [self assert:80 equals:[viewA frameSize].height];
+ [self assert:(120 - dividerThickness) equals:[viewB frameSize].height];
+}
+
+@end
Please sign in to comment.
Something went wrong with that request. Please try again.