aboutsummaryrefslogtreecommitdiff
path: root/AppKit/GTMUILocalizerAndLayoutTweakerTest.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/GTMUILocalizerAndLayoutTweakerTest.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/GTMUILocalizerAndLayoutTweakerTest.m')
-rw-r--r--AppKit/GTMUILocalizerAndLayoutTweakerTest.m83
1 files changed, 20 insertions, 63 deletions
diff --git a/AppKit/GTMUILocalizerAndLayoutTweakerTest.m b/AppKit/GTMUILocalizerAndLayoutTweakerTest.m
index 8905e82..955637c 100644
--- a/AppKit/GTMUILocalizerAndLayoutTweakerTest.m
+++ b/AppKit/GTMUILocalizerAndLayoutTweakerTest.m
@@ -18,7 +18,6 @@
#import "GTMSenTestCase.h"
#import "GTMUILocalizerAndLayoutTweakerTest.h"
-#import "GTMNSObject+UnitTesting.h"
#import "GTMUILocalizerAndLayoutTweaker.h"
static NSUInteger gTestPass = 0;
@@ -35,12 +34,7 @@ static NSUInteger gTestPass = 0;
[[GTMUILocalizerAndLayoutTweakerTestWindowController alloc]
initWithWindowNibName:@"GTMUILocalizerAndLayoutTweakerTest1"];
NSWindow *window = [controller window];
- STAssertNotNil(window, @"Pass %zu", gTestPass);
- NSString *imageName =
- [NSString stringWithFormat:@"GTMUILocalizerAndLayoutTweakerTest1-%ld",
- (long)gTestPass];
- GTMAssertObjectImageEqualToImageNamed(window, imageName,
- @"Pass %zu", gTestPass);
+ XCTAssertNotNil(window, @"Pass %tu", gTestPass);
[controller release];
}
// Test with nib 2
@@ -49,12 +43,7 @@ static NSUInteger gTestPass = 0;
[[GTMUILocalizerAndLayoutTweakerTestWindowController alloc]
initWithWindowNibName:@"GTMUILocalizerAndLayoutTweakerTest2"];
NSWindow *window = [controller window];
- STAssertNotNil(window, @"Pass %zu", gTestPass);
- NSString *imageName =
- [NSString stringWithFormat:@"GTMUILocalizerAndLayoutTweakerTest2-%ld",
- (long)gTestPass];
- GTMAssertObjectImageEqualToImageNamed(window, imageName,
- @"Pass %zu", gTestPass);
+ XCTAssertNotNil(window, @"Pass %tu", gTestPass);
[controller release];
}
}
@@ -89,19 +78,14 @@ static NSUInteger gTestPass = 0;
[[GTMUILocalizerAndLayoutTweakerTestWindowController alloc]
initWithWindowNibName:@"GTMUILocalizerAndLayoutTweakerTest3"];
NSWindow *window = [controller window];
- STAssertNotNil(window, @"Pass %zu", lp);
+ XCTAssertNotNil(window, @"Pass %tu", lp);
NSTextField *field;
- GTM_FOREACH_OBJECT(field, [[window contentView] subviews]) {
- STAssertTrue([field isMemberOfClass:[NSTextField class]],
- @"Pass %zu", lp);
+ for (field in [[window contentView] subviews]) {
+ XCTAssertTrue([field isMemberOfClass:[NSTextField class]],
+ @"Pass %tu", lp);
[field setStringValue:kTestStrings[lp]];
[GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:field];
}
- NSString *imageName =
- [NSString stringWithFormat:@"GTMUILocalizerAndLayoutTweakerTest3-%ld",
- (long)lp];
- GTMAssertObjectImageEqualToImageNamed(window, imageName,
- @"Pass %zu", lp);
[controller release];
}
}
@@ -119,12 +103,7 @@ static NSUInteger gTestPass = 0;
[[GTMUILocalizerAndLayoutTweakerTestWindowController alloc]
initWithWindowNibName:@"GTMUILocalizerAndLayoutTweakerTest4"];
NSWindow *window = [controller window];
- STAssertNotNil(window, @"Pass %zu", gTestPass);
- NSString *imageName =
- [NSString stringWithFormat:@"GTMUILocalizerAndLayoutTweakerTest4-%ld",
- (long)gTestPass];
- GTMAssertObjectImageEqualToImageNamed(window, imageName,
- @"Pass %zu", gTestPass);
+ XCTAssertNotNil(window, @"Pass %tu", gTestPass);
[controller release];
}
}
@@ -144,20 +123,20 @@ static NSUInteger gTestPass = 0;
[[GTMUILocalizerAndLayoutTweakerTestWindowController alloc]
initWithWindowNibName:@"GTMUILocalizerAndLayoutTweakerTest5"];
NSWindow *window = [controller window];
- STAssertNotNil(window, @"Pass %zu", lp);
+ XCTAssertNotNil(window, @"Pass %tu", lp);
NSView *view;
- GTM_FOREACH_OBJECT(view, [[window contentView] subviews]) {
+ for (view in [[window contentView] subviews]) {
if ([view isMemberOfClass:[NSButton class]]) {
NSButton *btn = (id)view;
[btn setTitle:kTestStrings[lp]];
[GTMUILocalizerAndLayoutTweaker wrapButtonTitleForWidth:btn];
} else {
- STAssertTrue([view isMemberOfClass:[NSMatrix class]],
- @"Pass %zu", lp);
+ XCTAssertTrue([view isMemberOfClass:[NSMatrix class]],
+ @"Pass %tu", lp);
NSMatrix *mtx = (id)view;
NSCell *cell;
int i = 0;
- GTM_FOREACH_OBJECT(cell, [mtx cells]) {
+ for (cell in [mtx cells]) {
[cell setTitle:[NSString stringWithFormat:@"%d %@",
++i, kTestStrings[lp]]];
}
@@ -165,11 +144,6 @@ static NSUInteger gTestPass = 0;
}
[GTMUILocalizerAndLayoutTweaker sizeToFitView:view];
}
- NSString *imageName =
- [NSString stringWithFormat:@"GTMUILocalizerAndLayoutTweakerTest5-%ld",
- (long)lp];
- GTMAssertObjectImageEqualToImageNamed(window, imageName,
- @"Pass %zu", lp);
[controller release];
}
}
@@ -181,17 +155,11 @@ static NSUInteger gTestPass = 0;
[[GTMUILocalizerAndLayoutTweakerTestWindowController alloc]
initWithWindowNibName:@"GTMUILocalizerAndLayoutTweakerTest6"];
NSWindow *window = [controller window];
- STAssertNotNil(window, @"Pass %zu", gTestPass);
+ XCTAssertNotNil(window, @"Pass %tu", gTestPass);
NSTabView *tabView = [controller tabView];
for (NSInteger tabIndex = 0; tabIndex < [tabView numberOfTabViewItems];
++tabIndex) {
[tabView selectTabViewItemAtIndex:tabIndex];
- NSString *imageName =
- [NSString stringWithFormat:
- @"GTMUILocalizerAndLayoutTweakerTest6-tab%ld-%ld",
- (long)tabIndex, (long)gTestPass];
- GTMAssertObjectImageEqualToImageNamed(window, imageName,
- @"Pass %zu", gTestPass);
}
[controller release];
}
@@ -201,12 +169,7 @@ static NSUInteger gTestPass = 0;
[[GTMUILocalizerAndLayoutTweakerTestWindowController alloc]
initWithWindowNibName:@"GTMUILocalizerAndLayoutTweakerTest2"];
NSWindow *window = [controller window];
- STAssertNotNil(window, @"Pass %zu", gTestPass);
- NSString *imageName =
- [NSString stringWithFormat:@"GTMUILocalizerAndLayoutTweakerTest2-%ld",
- (long)gTestPass];
- GTMAssertObjectImageEqualToImageNamed(window, imageName,
- @"Pass %zu", gTestPass);
+ XCTAssertNotNil(window, @"Pass %tu", gTestPass);
[controller release];
}
}
@@ -244,11 +207,11 @@ static NSUInteger gTestPass = 0;
[[GTMUILocalizerAndLayoutTweakerTestWindowController alloc]
initWithWindowNibName:@"GTMUILocalizerAndLayoutTweakerTest7"];
NSWindow *window = [controller window];
- STAssertNotNil(window, @"Pass %zu", lp);
+ XCTAssertNotNil(window, @"Pass %tu", lp);
NSTextField *field;
- GTM_FOREACH_OBJECT(field, [[window contentView] subviews]) {
- STAssertTrue([field isMemberOfClass:[NSTextField class]],
- @"Pass %zu", lp);
+ for (field in [[window contentView] subviews]) {
+ XCTAssertTrue([field isMemberOfClass:[NSTextField class]],
+ @"Pass %tu", lp);
[field setStringValue:kTestStrings[lp]];
NSUInteger minWidth = kTestModes[modeLoop].minWidth;
if (minWidth) {
@@ -258,11 +221,6 @@ static NSUInteger gTestPass = 0;
[GTMUILocalizerAndLayoutTweaker sizeToFitFixedHeightTextField:field];
}
}
- NSString *imageName =
- [NSString stringWithFormat:@"GTMUILocalizerAndLayoutTweakerTest7-%s-%ld",
- kTestModes[modeLoop].name, (long)lp];
- GTMAssertObjectImageEqualToImageNamed(window, imageName,
- @"Pass %zu-%zu", modeLoop, lp);
[controller release];
}
}
@@ -274,9 +232,8 @@ static NSUInteger gTestPass = 0;
[textField setBezeled:NO];
[textField setStringValue:@"The quick brown fox jumps over the lazy dog."];
[GTMUILocalizerAndLayoutTweaker sizeToFitFixedHeightTextField:textField];
- STAssertTrue(
- NSEqualRects([textField bounds], NSIntegralRect([textField bounds])),
- nil);
+ XCTAssertTrue(
+ NSEqualRects([textField bounds], NSIntegralRect([textField bounds])));
[textField release];
}