aboutsummaryrefslogtreecommitdiff
path: root/AppKit/GTMUILocalizerAndLayoutTweakerTest.m
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2013-06-24 18:30:10 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2013-06-24 18:30:10 +0000
commitcba40d9e2e1cc1d078e855b43f21c82bb0d7d275 (patch)
treeba66242172a2b86dd71abc7830250a95a58ea2f4 /AppKit/GTMUILocalizerAndLayoutTweakerTest.m
parent99e55aa47943ab0f18767fb906c96870c983715d (diff)
Ensure +[GTMUILocalizerAndLayoutTweaker sizeToFitFixedHeightTextField:] sets an integral size.
When resizing labels it's possible to get fractional sizes. This CL fixes the problem by using integral values. DELTA=17 (17 added, 0 deleted, 0 changed)
Diffstat (limited to 'AppKit/GTMUILocalizerAndLayoutTweakerTest.m')
-rw-r--r--AppKit/GTMUILocalizerAndLayoutTweakerTest.m14
1 files changed, 14 insertions, 0 deletions
diff --git a/AppKit/GTMUILocalizerAndLayoutTweakerTest.m b/AppKit/GTMUILocalizerAndLayoutTweakerTest.m
index d5b111c..8905e82 100644
--- a/AppKit/GTMUILocalizerAndLayoutTweakerTest.m
+++ b/AppKit/GTMUILocalizerAndLayoutTweakerTest.m
@@ -212,6 +212,7 @@ static NSUInteger gTestPass = 0;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+
- (void)testSizeToFitFixedHeightTextField {
struct {
const char *name;
@@ -266,6 +267,19 @@ static NSUInteger gTestPass = 0;
}
}
}
+
+- (void)testSizeToFitFixedHeightTextFieldIntegral {
+ NSTextField* textField =
+ [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 50)];
+ [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);
+ [textField release];
+}
+
#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
@end