mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-04 20:05:03 +00:00
Test: added unit test for registered notification for the scrollView
This commit is contained in:
1 parent
ec3af04f29
commit
006bf72c17
1 file changed
+22
@@ -1,5 +1,9 @@
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "CPNotificationCenterHelper.j"
|
||||
|
||||
[CPApplication sharedApplication];
|
||||
|
||||
@implementation CPScrollViewTest : OJTestCase
|
||||
{
|
||||
}
|
||||
@@ -256,6 +260,24 @@
|
||||
[self assertPoint:CGPointMake(0, 0) equals:visibleRect.origin message:@"VisibleRect origin not at top left corner again"];
|
||||
}
|
||||
|
||||
-(void)testNotificationsRegistered
|
||||
{
|
||||
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)],
|
||||
theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 1024.0, 768.0)
|
||||
styleMask:CPWindowNotSizable];
|
||||
|
||||
[self assert:[CPNotificationCenterHelper registeredNotificationsForObserver:scrollView] equals:[] message:@"Notications registered for the scrollView in the notification center are wrong"];
|
||||
|
||||
[[theWindow contentView] addSubview:scrollView];
|
||||
[self assert:[CPNotificationCenterHelper registeredNotificationsForObserver:scrollView] equals:[@"CPScrollerStyleGlobalChangeNotification"] message:@"Notications registered for the scrollView in the notification center are wrong"];
|
||||
|
||||
[[theWindow contentView] addSubview:scrollView];
|
||||
[self assert:[CPNotificationCenterHelper registeredNotificationsForObserver:scrollView] equals:[@"CPScrollerStyleGlobalChangeNotification"] message:@"Notications registered for the scrollView in the notification center are wrong"];
|
||||
|
||||
[scrollView removeFromSuperview];
|
||||
[self assert:[CPNotificationCenterHelper registeredNotificationsForObserver:scrollView] equals:[] message:@"Notications registered for the scrollView in the notification center are wrong"];
|
||||
}
|
||||
|
||||
- (void)assertPoint:(CGPoint)expected equals:(CGPoint)actual message:(CPString)message
|
||||
{
|
||||
[self assert:expected.x equals:actual.x message:@"X: " + message];
|
||||
|
||||
Reference in new issue
Block a user