aboutsummaryrefslogtreecommitdiff
path: root/AppKit/GTMWindowSheetControllerTest.m
diff options
context:
space:
mode:
authorGravatar dmaclach <dmaclach@google.com>2016-10-07 12:10:23 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2016-10-07 12:21:06 -0400
commit42124b3691197c3c4f52f069775fa0390a8ff942 (patch)
treeebd373d398ea64b45bdc1d196fa0a2c5f57cabfd /AppKit/GTMWindowSheetControllerTest.m
parent57eeab4193210df8ab0c81e9d3f1ee1ad3e24492 (diff)
First cut at pruning things/updating things.
Remove a bunch of code that Google stopped using/maintaining rather than trying to update it it. Some would be hard to update, some actually has system provided replacements; others are patterns that just don't seem as common now. Prune out the code related to macOS <= 10.5, start pruning some of the really old iOS support also. Get the projects mostly limping again with modern Xcodes so tests can be run. If someone ends up on this commit via history for something they still find as useful, feel free to do a pull request to bring the snippet of code back to life and update it for current SDKs.
Diffstat (limited to 'AppKit/GTMWindowSheetControllerTest.m')
-rw-r--r--AppKit/GTMWindowSheetControllerTest.m107
1 files changed, 51 insertions, 56 deletions
diff --git a/AppKit/GTMWindowSheetControllerTest.m b/AppKit/GTMWindowSheetControllerTest.m
index 65ef084..6117371 100644
--- a/AppKit/GTMWindowSheetControllerTest.m
+++ b/AppKit/GTMWindowSheetControllerTest.m
@@ -18,7 +18,6 @@
#import "GTMSenTestCase.h"
#import "GTMWindowSheetController.h"
-#import "GTMNSObject+UnitTesting.h"
@interface GTMWindowSheetControllerTest : GTMTestCase
<GTMWindowSheetControllerDelegate,
@@ -49,11 +48,11 @@
styleMask:NSTitledWindowMask
backing:NSBackingStoreBuffered
defer:NO] autorelease];
- STAssertNotNil(window, @"Could not allocate window");
+ XCTAssertNotNil(window, @"Could not allocate window");
NSTabView *tabView =
[[[NSTabView alloc] initWithFrame:NSMakeRect(10, 10, 580, 580)]
autorelease];
- STAssertNotNil(tabView, @"Could not allocate tab view");
+ XCTAssertNotNil(tabView, @"Could not allocate tab view");
[[window contentView] addSubview:tabView];
[tabView setDelegate:self];
@@ -70,10 +69,10 @@
[[[GTMWindowSheetController alloc] initWithWindow:window
delegate:self] autorelease];
- STAssertFalse([sheetController_ isSheetAttachedToView:
- [[tabView selectedTabViewItem] view]],
- @"Sheet should not be attached to current view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertFalse([sheetController_ isSheetAttachedToView:
+ [[tabView selectedTabViewItem] view]],
+ @"Sheet should not be attached to current view");
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)0,
@"Should have no views with sheets");
@@ -98,19 +97,19 @@
nil]];
didAlertClose_ = NO;
- STAssertTrue([sheetController_ isSheetAttachedToView:
- [[tabView selectedTabViewItem] view]],
- @"Sheet should be attached to current view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertTrue([sheetController_ isSheetAttachedToView:
+ [[tabView selectedTabViewItem] view]],
+ @"Sheet should be attached to current view");
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)1,
@"Should have one view with sheets");
[tabView selectTabViewItem:item2];
- STAssertFalse([sheetController_ isSheetAttachedToView:
- [[tabView selectedTabViewItem] view]],
- @"Sheet should not be attached to current view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertFalse([sheetController_ isSheetAttachedToView:
+ [[tabView selectedTabViewItem] view]],
+ @"Sheet should not be attached to current view");
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)1,
@"Should have one view with sheets");
@@ -128,52 +127,52 @@
contextInfo:nil];
didSheetClose_ = NO;
- STAssertTrue([sheetController_ isSheetAttachedToView:
- [[tabView selectedTabViewItem] view]],
- @"Sheet should be attached to current view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertTrue([sheetController_ isSheetAttachedToView:
+ [[tabView selectedTabViewItem] view]],
+ @"Sheet should be attached to current view");
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)2,
@"Should have two views with sheets");
[tabView selectTabViewItem:item1];
- STAssertTrue([sheetController_ isSheetAttachedToView:
- [[tabView selectedTabViewItem] view]],
- @"Sheet should be attached to current view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertTrue([sheetController_ isSheetAttachedToView:
+ [[tabView selectedTabViewItem] view]],
+ @"Sheet should be attached to current view");
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)2,
@"Should have two views with sheets");
// Close alert
[alertButton performClick:self];
- STAssertFalse([sheetController_ isSheetAttachedToView:
- [[tabView selectedTabViewItem] view]],
- @"Sheet should not be attached to current view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertFalse([sheetController_ isSheetAttachedToView:
+ [[tabView selectedTabViewItem] view]],
+ @"Sheet should not be attached to current view");
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)1,
@"Should have one view with sheets");
- STAssertTrue(didAlertClose_, @"Alert should have closed");
+ XCTAssertTrue(didAlertClose_, @"Alert should have closed");
[tabView selectTabViewItem:item2];
- STAssertTrue([sheetController_ isSheetAttachedToView:
- [[tabView selectedTabViewItem] view]],
- @"Sheet should be attached to current view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertTrue([sheetController_ isSheetAttachedToView:
+ [[tabView selectedTabViewItem] view]],
+ @"Sheet should be attached to current view");
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)1,
@"Should have one view with sheets");
// Close sheet
[[NSApplication sharedApplication] endSheet:sheet returnCode:NSOKButton];
- STAssertFalse([sheetController_ isSheetAttachedToView:
- [[tabView selectedTabViewItem] view]],
- @"Sheet should not be attached to current view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertFalse([sheetController_ isSheetAttachedToView:
+ [[tabView selectedTabViewItem] view]],
+ @"Sheet should not be attached to current view");
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)0,
@"Should have no views with sheets");
- STAssertTrue(didSheetClose_, @"Sheet should have closed");
+ XCTAssertTrue(didSheetClose_, @"Sheet should have closed");
}
- (void)testOpenSheetAfterFirst {
@@ -183,16 +182,15 @@
styleMask:NSTitledWindowMask
backing:NSBackingStoreBuffered
defer:NO] autorelease];
- STAssertNotNil(window_, @"Could not allocate window");
+ XCTAssertNotNil(window_, @"Could not allocate window");
sheetController_ =
[[[GTMWindowSheetController alloc] initWithWindow:window_
delegate:self] autorelease];
- STAssertFalse([sheetController_ isSheetAttachedToView:
- [window_ contentView]],
- @"Sheet should not be attached to current view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertFalse([sheetController_ isSheetAttachedToView:[window_ contentView]],
+ @"Sheet should not be attached to current view");
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)0,
@"Should have no views with sheets");
@@ -225,34 +223,31 @@
didAlertClose_ = NO;
didSheetClose_ = NO;
- STAssertTrue([sheetController_ isSheetAttachedToView:
- [window_ contentView]],
+ XCTAssertTrue([sheetController_ isSheetAttachedToView:[window_ contentView]],
@"Sheet should be attached to view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)1,
@"Should have one view with sheets");
// Close alert
[alertButton performClick:self];
- STAssertTrue([sheetController_ isSheetAttachedToView:
- [window_ contentView]],
+ XCTAssertTrue([sheetController_ isSheetAttachedToView:[window_ contentView]],
@"Second sheet should be attached to view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)1,
@"Should have one view with sheets");
- STAssertTrue(didAlertClose_, @"Alert should have closed");
+ XCTAssertTrue(didAlertClose_, @"Alert should have closed");
// Close sheet
[[NSApplication sharedApplication] endSheet:sheet returnCode:NSOKButton];
- STAssertFalse([sheetController_ isSheetAttachedToView:
- [window_ contentView]],
- @"Sheet should not be attached to current view");
- STAssertEquals([[sheetController_ viewsWithAttachedSheets] count],
+ XCTAssertFalse([sheetController_ isSheetAttachedToView:[window_ contentView]],
+ @"Sheet should not be attached to current view");
+ XCTAssertEqual([[sheetController_ viewsWithAttachedSheets] count],
(NSUInteger)0,
@"Should have no views with sheets");
- STAssertTrue(didSheetClose_, @"Sheet should have closed");
+ XCTAssertTrue(didSheetClose_, @"Sheet should have closed");
}
- (void)alertDidEnd:(NSAlert *)alert
@@ -283,13 +278,13 @@
}
- (void)tabView:(NSTabView *)tabView
-didSelectTabViewItem:(NSTabViewItem *)tabViewItem {
+ didSelectTabViewItem:(NSTabViewItem *)tabViewItem {
NSView* view = [tabViewItem view];
[sheetController_ setActiveView:view];
}
- (void)gtm_systemRequestsVisibilityForView:(NSView*)view {
- STAssertTrue(false, @"Shouldn't be called");
+ XCTAssertTrue(false, @"Shouldn't be called");
}
@end