aboutsummaryrefslogtreecommitdiff
path: root/AppKit
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2012-02-06 21:00:24 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2012-02-06 21:00:24 +0000
commit1aafbe44c74b025faca3c4c91e6d90be4f7d4fe1 (patch)
tree7bc77021ba9fdd62c92760c007b93130887b8bd5 /AppKit
parent754cbb4066c2682c8dec120f3d0550f84e326d3a (diff)
[Author: thomasvl]
Always uses the first element of the array for the sizeof calc rather then hard coding the type. Fixes an error with newer compiler where we did sizeof(NSColor) instead of sizeof(NSColor*). Fix warning about assignment of variable to itself. R=dmaclach DELTA=5 (0 added, 0 deleted, 5 changed)
Diffstat (limited to 'AppKit')
-rw-r--r--AppKit/GTMNSAnimatablePropertyContainerTest.m74
-rw-r--r--AppKit/GTMNSBezierPath+RoundRectTest.m8
2 files changed, 41 insertions, 41 deletions
diff --git a/AppKit/GTMNSAnimatablePropertyContainerTest.m b/AppKit/GTMNSAnimatablePropertyContainerTest.m
index 9676086..8cef089 100644
--- a/AppKit/GTMNSAnimatablePropertyContainerTest.m
+++ b/AppKit/GTMNSAnimatablePropertyContainerTest.m
@@ -48,7 +48,7 @@
#endif
- (void)set:(NSInteger)value {
- value = value;
+#pragma unused(value)
}
@end
@@ -64,19 +64,19 @@
- (void)windowWillClose:(NSNotification *)notification {
if (![[notification object] isEqual:[self window]]) {
- [[NSException exceptionWithName:SenTestFailureException
- reason:@"Bad window in windowWillClose"
+ [[NSException exceptionWithName:SenTestFailureException
+ reason:@"Bad window in windowWillClose"
userInfo:nil] raise];
}
[self autorelease];
}
-
+
@end
@implementation GTMNSAnimatablePropertyContainerTest
-
+
- (void)setUp {
- windowController_
+ windowController_
= [[GTMNSAnimatablePropertyContainerWindowController alloc] init];
STAssertNotNil(windowController_, nil);
NSWindow *window = [windowController_ window];
@@ -101,7 +101,7 @@
- (void)windowFrameStopper:(NSTimer *)timer {
NSWindow *window = GTM_DYNAMIC_CAST(NSWindow, [timer userInfo]);
[timerCalled_ setShouldStop:YES];
- [[window gtm_animatorStopper] setFrame:NSMakeRect(300, 300, 150, 150)
+ [[window gtm_animatorStopper] setFrame:NSMakeRect(300, 300, 150, 150)
display:YES];
STAssertEquals([window frame], NSMakeRect(300, 300, 150, 150), nil);
}
@@ -122,7 +122,7 @@
- (void)testWindowAnimations {
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
-
+
// Test Alpha
NSWindow *window = [windowController_ window];
[window setAlphaValue:1.0];
@@ -132,14 +132,14 @@
[currentContext setDuration:2];
[[window animator] setAlphaValue:0.5];
[NSAnimationContext endGrouping];
- [NSTimer scheduledTimerWithTimeInterval:0.1
- target:self
- selector:@selector(windowAlphaValueStopper:)
- userInfo:window
+ [NSTimer scheduledTimerWithTimeInterval:0.1
+ target:self
+ selector:@selector(windowAlphaValueStopper:)
+ userInfo:window
repeats:NO];
STAssertTrue([runLoop gtm_runUpToSixtySecondsWithContext:timerCalled_], nil);
STAssertEquals([window alphaValue], (CGFloat)0.25, nil);
-
+
// Test Frame
[window setFrame:NSMakeRect(100, 100, 100, 100) display:YES];
[timerCalled_ setShouldStop:NO];
@@ -148,29 +148,29 @@
[currentContext setDuration:2];
[[window animator] setFrame:NSMakeRect(200, 200, 200, 200) display:YES];
[NSAnimationContext endGrouping];
- [NSTimer scheduledTimerWithTimeInterval:0.1
- target:self
- selector:@selector(windowFrameStopper:)
- userInfo:window
+ [NSTimer scheduledTimerWithTimeInterval:0.1
+ target:self
+ selector:@selector(windowFrameStopper:)
+ userInfo:window
repeats:NO];
STAssertTrue([runLoop gtm_runUpToSixtySecondsWithContext:timerCalled_], nil);
STAssertEquals([window frame], NSMakeRect(300, 300, 150, 150), nil);
-
+
// Test non-animation value
[window setTitle:@"Foo"];
[[window gtm_animatorStopper] setTitle:@"Bar"];
STAssertEquals([window title], @"Bar", nil);
-
+
// Test bad selector
STAssertThrows([[window gtm_animatorStopper] testWindowAnimations], nil);
}
- (void)testNonLayerViewAnimations {
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
-
+
NSBox *nonLayerBox = [windowController_ nonLayerBox];
STAssertNotNil(nonLayerBox, nil);
-
+
// Test frame
[nonLayerBox setFrame:NSMakeRect(50, 50, 50, 50)];
[timerCalled_ setShouldStop:NO];
@@ -179,30 +179,30 @@
[currentContext setDuration:2];
[[nonLayerBox animator] setFrame:NSMakeRect(100, 100, 100, 100)];
[NSAnimationContext endGrouping];
- [NSTimer scheduledTimerWithTimeInterval:0.1
- target:self
- selector:@selector(nonLayerFrameStopper:)
- userInfo:nonLayerBox
+ [NSTimer scheduledTimerWithTimeInterval:0.1
+ target:self
+ selector:@selector(nonLayerFrameStopper:)
+ userInfo:nonLayerBox
repeats:NO];
STAssertTrue([runLoop gtm_runUpToSixtySecondsWithContext:timerCalled_], nil);
STAssertEquals([nonLayerBox frame], NSMakeRect(200, 200, 200, 200), nil);
-
+
// Test non-animation value
[nonLayerBox setToolTip:@"Foo"];
[[nonLayerBox gtm_animatorStopper] setToolTip:@"Bar"];
STAssertEquals([nonLayerBox toolTip], @"Bar", nil);
-
+
// Test bad selector
- STAssertThrows([[nonLayerBox gtm_animatorStopper] testNonLayerViewAnimations],
+ STAssertThrows([[nonLayerBox gtm_animatorStopper] testNonLayerViewAnimations],
nil);
}
- (void)testLayerViewAnimations {
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
-
+
NSBox *layerBox = [windowController_ layerBox];
STAssertNotNil(layerBox, nil);
-
+
// Test frame
[layerBox setFrame:NSMakeRect(50, 50, 50, 50)];
[timerCalled_ setShouldStop:NO];
@@ -211,21 +211,21 @@
[currentContext setDuration:2];
[[layerBox animator] setFrame:NSMakeRect(100, 100, 100, 100)];
[NSAnimationContext endGrouping];
- [NSTimer scheduledTimerWithTimeInterval:0.1
- target:self
- selector:@selector(layerFrameStopper:)
- userInfo:layerBox
+ [NSTimer scheduledTimerWithTimeInterval:0.1
+ target:self
+ selector:@selector(layerFrameStopper:)
+ userInfo:layerBox
repeats:NO];
STAssertTrue([runLoop gtm_runUpToSixtySecondsWithContext:timerCalled_], nil);
STAssertEquals([layerBox frame], NSMakeRect(200, 200, 200, 200), nil);
-
+
// Test non-animation value
[layerBox setToolTip:@"Foo"];
[[layerBox gtm_animatorStopper] setToolTip:@"Bar"];
STAssertEquals([layerBox toolTip], @"Bar", nil);
-
+
// Test bad selector
- STAssertThrows([[layerBox gtm_animatorStopper] testLayerViewAnimations],
+ STAssertThrows([[layerBox gtm_animatorStopper] testLayerViewAnimations],
nil);
// Test Short Selector
diff --git a/AppKit/GTMNSBezierPath+RoundRectTest.m b/AppKit/GTMNSBezierPath+RoundRectTest.m
index 101460c..69a0621 100644
--- a/AppKit/GTMNSBezierPath+RoundRectTest.m
+++ b/AppKit/GTMNSBezierPath+RoundRectTest.m
@@ -42,11 +42,11 @@
NSMakeRect(140.0, 10.0, 150.0, 30.0), //Large Test
NSMakeRect(300.0, 10.0, 150.0, 30.0) //Large Test 2 (for different radius)
};
- const NSUInteger theRectCount = sizeof(theRects) / sizeof(NSRect);
+ const NSUInteger theRectCount = sizeof(theRects) / sizeof(theRects[0]);
// Line Width Tests
CGFloat theLineWidths[] = { 0.5, 50.0, 2.0 };
- const NSUInteger theLineWidthCount = sizeof(theLineWidths) / sizeof(CGFloat);
+ const NSUInteger theLineWidthCount = sizeof(theLineWidths) / sizeof(theLineWidths[0]);
NSUInteger i,j;
for (i = 0; i < theLineWidthCount; ++i) {
@@ -69,7 +69,7 @@
[NSColor colorWithCalibratedRed:1.0 green:0.0 blue:0.0 alpha:1.0],
[NSColor colorWithCalibratedRed:0.2 green:0.4 blue:0.6 alpha:0.4]
};
- const NSUInteger theColorCount = sizeof(theColors)/sizeof(NSColor);
+ const NSUInteger theColorCount = sizeof(theColors)/sizeof(theColors[0]);
for (i = 0; i < theColorCount; ++i) {
for (j = 0; j < theRectCount; ++j) {
@@ -84,7 +84,7 @@
// Flatness test
CGFloat theFlatness[] = {0.0, 0.1, 1.0, 10.0};
- const NSUInteger theFlatnessCount = sizeof(theFlatness)/sizeof(CGFloat);
+ const NSUInteger theFlatnessCount = sizeof(theFlatness)/sizeof(theFlatness[0]);
for (i = 0; i < theFlatnessCount; i++) {
for (j = 0; j < theRectCount; ++j) {