aboutsummaryrefslogtreecommitdiff
path: root/AppKit
diff options
context:
space:
mode:
authorGravatar thomasvl <thomasvl@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2008-04-14 17:21:02 +0000
committerGravatar thomasvl <thomasvl@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2008-04-14 17:21:02 +0000
commitcdf070c8d76ffc4eaa24e8671756cbbe9ceb2890 (patch)
treefaa9ae3a72a6591d6a6add7ceed7f91e92ade11f /AppKit
parent0aaecac6ff2bc89e58a0c8c6d6ad62e02fb2b011 (diff)
See the ReleaseNotes for the full details, highlights:
- bug fixes - code coverage support - more complete unittests - full support for unittesting UIs - support for the iphone sdk (include ui unittesting)
Diffstat (limited to 'AppKit')
-rw-r--r--AppKit/GTMGeometryUtils.h560
-rw-r--r--AppKit/GTMGeometryUtils.m152
-rw-r--r--AppKit/GTMGeometryUtilsTest.m323
-rw-r--r--AppKit/GTMLinearRGBShading.m2
-rw-r--r--AppKit/GTMNSBezierPath+CGPath.m3
-rw-r--r--AppKit/GTMNSBezierPath+CGPathTest.m21
-rw-r--r--AppKit/GTMNSBezierPath+CGPathTest.tifbin1090 -> 0 bytes
-rw-r--r--AppKit/GTMNSBezierPath+CGPathTest.tiffbin0 -> 2558 bytes
-rw-r--r--AppKit/GTMNSBezierPath+RoundRectTest.m25
-rw-r--r--AppKit/GTMNSBezierPath+RoundRectTest.tifbin6982 -> 0 bytes
-rw-r--r--AppKit/GTMNSBezierPath+RoundRectTest.tiffbin0 -> 8036 bytes
-rw-r--r--AppKit/GTMNSBezierPath+ShadingTest.10.4.tifbin12964 -> 0 bytes
-rw-r--r--AppKit/GTMNSBezierPath+ShadingTest.10.5.tiff (renamed from AppKit/GTMNSBezierPath+ShadingTest.10.5.tif)bin17982 -> 19450 bytes
-rw-r--r--AppKit/GTMNSBezierPath+ShadingTest.m4
-rw-r--r--AppKit/GTMNSColor+Theme.m9
-rw-r--r--AppKit/GTMNSColor+ThemeTest.m21
-rw-r--r--AppKit/GTMNSWorkspace+ScreenSaver.m17
-rw-r--r--AppKit/GTMNSWorkspace+Theme.m2
18 files changed, 55 insertions, 1084 deletions
diff --git a/AppKit/GTMGeometryUtils.h b/AppKit/GTMGeometryUtils.h
deleted file mode 100644
index 1dd274f..0000000
--- a/AppKit/GTMGeometryUtils.h
+++ /dev/null
@@ -1,560 +0,0 @@
-//
-// GTMGeometryUtils.h
-//
-// Utilities for geometrical utilities such as conversions
-// between different types.
-//
-// Copyright 2006-2008 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
-// of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-//
-
-#include <Carbon/Carbon.h>
-#include <Cocoa/Cocoa.h>
-
-
-#pragma mark Miscellaneous
-
-/// Calculate the distance between two points.
-//
-// Args:
-// pt1 first point
-// pt2 second point
-//
-// Returns:
-// Distance
-CG_INLINE float GTMDistanceBetweenPoints(NSPoint pt1, NSPoint pt2) {
- float dX = pt1.x - pt2.x;
- float dY = pt1.y - pt2.y;
- return sqrtf(dX * dX + dY * dY);
-}
-
-/// Returns the height of the main display (the one with the menu bar).
-//
-/// The value updates itself automatically whenever the user
-/// repositions their monitors, or changes resolutions etc.
-//
-// Returns:
-// height of the main display area.
-float GTMGetMainDisplayHeight(void);
-
-#pragma mark -
-#pragma mark Point Conversion
-
-/// Quickly convert from a global HIPoint to a global NSPoint.
-//
-/// HIPoints are relative to 0,0 in upper left;
-/// NSPoints are relative to 0,0 in lower left
-//
-// Args:
-// inPoint: HIPoint to convert
-//
-// Returns:
-// Converted NSPoint
-CG_INLINE NSPoint GTMGlobalHIPointToNSPoint(HIPoint inPoint) {
- return NSMakePoint(inPoint.x, GTMGetMainDisplayHeight() - inPoint.y);
-}
-
-/// Quickly convert from a global NSPoint to a global HIPoint.
-//
-/// HIPoints are relative to 0,0 in upper left;
-/// NSPoints are relative to 0,0 in lower left
-//
-// Args:
-// inPoint: NSPoint to convert
-//
-// Returns:
-// Converted HIPoint
-CG_INLINE HIPoint GTMGlobalNSPointToHIPoint(NSPoint inPoint) {
- return CGPointMake(inPoint.x, GTMGetMainDisplayHeight() - inPoint.y);
-}
-
-/// Quickly convert from a CGPoint to a NSPoint.
-//
-/// CGPoints are relative to 0,0 in lower left;
-/// NSPoints are relative to 0,0 in lower left
-//
-// Args:
-// inPoint: CGPoint to convert
-//
-// Returns:
-// Converted NSPoint
-CG_INLINE NSPoint GTMCGPointToNSPoint(CGPoint inPoint) {
- return NSMakePoint(inPoint.x, inPoint.y);
-}
-
-/// Quickly convert from a NSPoint to a CGPoint.
-//
-/// CGPoints are relative to 0,0 in lower left;
-/// NSPoints are relative to 0,0 in lower left
-//
-// Args:
-// inPoint: NSPoint to convert
-//
-// Returns:
-// Converted CGPoint
-CG_INLINE CGPoint GTMNSPointToCGPoint(NSPoint inPoint) {
- return CGPointMake(inPoint.x, inPoint.y);
-}
-
-/// Quickly convert from a global HIPoint to a global CGPoint.
-//
-/// HIPoints are relative to 0,0 in upper left;
-/// CGPoints are relative to 0,0 in lower left
-//
-// Args:
-// inPoint: NSPoint to convert
-//
-// Returns:
-// Converted CGPoint
-CG_INLINE HIPoint GTMGlobalCGPointToHIPoint(CGPoint inPoint) {
- return GTMGlobalNSPointToHIPoint(GTMCGPointToNSPoint(inPoint));
-}
-
-/// Quickly convert from a global CGPoint to a global HIPoint.
-//
-/// HIPoints are relative to 0,0 in upper left;
-/// CGPoints are relative to 0,0 in lower left
-//
-// Args:
-// inPoint: CGPoint to convert
-//
-// Returns:
-// Converted NSPoint
-CG_INLINE CGPoint GTMGlobalHIPointToCGPoint(HIPoint inPoint) {
- return GTMNSPointToCGPoint(GTMGlobalHIPointToNSPoint(inPoint));
-}
-
-#pragma mark -
-#pragma mark Rect Conversion
-
-/// Convert from a global NSRect to a global HIRect.
-//
-/// HIRect are relative to 0,0 in upper left;
-/// NSRect are relative to 0,0 in lower left
-//
-// Args:
-// inRect: NSRect to convert
-//
-// Returns:
-// Converted HIRect
-HIRect GTMGlobalNSRectToHIRect(NSRect inRect);
-
-/// Convert from a rect to a HIRect.
-//
-/// HIRect are relative to 0,0 in upper left;
-/// Rect are relative to 0,0 in upper left
-//
-// Args:
-// inRect: Rect to convert
-//
-// Returns:
-// Converted HIRect
-HIRect GTMRectToHIRect(Rect inRect);
-
-/// Convert from a global HIRect to a global NSRect.
-//
-/// NSRect are relative to 0,0 in lower left;
-/// HIRect are relative to 0,0 in upper left
-//
-// Args:
-// inRect: HIRect to convert
-//
-// Returns:
-// Converted NSRect
-NSRect GTMGlobalHIRectToNSRect(HIRect inRect);
-
-
-/// Convert from a HIRect to a Rect.
-//
-/// Rect are relative to 0,0 in upper left;
-/// HIRect are relative to 0,0 in upper left
-//
-// Args:
-// inRect: HIRect to convert
-//
-// Returns:
-// Converted Rect
-Rect GTMHIRectToRect(HIRect inRect);
-
-/// Convert from a global Rect to a global NSRect.
-//
-/// NSRect are relative to 0,0 in lower left;
-/// Rect are relative to 0,0 in upper left
-//
-// Args:
-// inRect: Rect to convert
-//
-// Returns:
-// Converted NSRect
-CG_INLINE NSRect GTMGlobalRectToNSRect(Rect inRect) {
- return GTMGlobalHIRectToNSRect(GTMRectToHIRect(inRect));
-}
-
-/// Convert from a CGRect to a NSRect.
-//
-/// NSRect are relative to 0,0 in lower left;
-/// CGRect are relative to 0,0 in lower left
-//
-// Args:
-// inRect: CGRect to convert
-//
-// Returns:
-// Converted NSRect
-CG_INLINE NSRect GTMCGRectToNSRect(CGRect inRect) {
- return NSMakeRect(inRect.origin.x,inRect.origin.y,inRect.size.width,inRect.size.height);
-}
-
-/// Convert from a NSRect to a CGRect.
-//
-/// NSRect are relative to 0,0 in lower left;
-/// CGRect are relative to 0,0 in lower left
-//
-// Args:
-// inRect: NSRect to convert
-//
-// Returns:
-// Converted CGRect
-CG_INLINE CGRect GTMNSRectToCGRect(NSRect inRect) {
- return CGRectMake(inRect.origin.x,inRect.origin.y,inRect.size.width,inRect.size.height);
-}
-
-/// Convert from a global HIRect to a global CGRect.
-//
-/// HIRect are relative to 0,0 in upper left;
-/// CGRect are relative to 0,0 in lower left
-//
-// Args:
-// inRect: HIRect to convert
-//
-// Returns:
-// Converted CGRect
-CG_INLINE CGRect GTMGlobalHIRectToCGRect(HIRect inRect) {
- return GTMNSRectToCGRect(GTMGlobalHIRectToNSRect(inRect));
-}
-
-/// Convert from a global Rect to a global CGRect.
-//
-/// Rect are relative to 0,0 in upper left;
-/// CGRect are relative to 0,0 in lower left
-//
-// Args:
-// inRect: Rect to convert
-//
-// Returns:
-// Converted CGRect
-CG_INLINE CGRect GTMGlobalRectToCGRect(Rect inRect) {
- return GTMNSRectToCGRect(GTMGlobalRectToNSRect(inRect));
-}
-
-/// Convert from a global NSRect to a global Rect.
-//
-/// Rect are relative to 0,0 in upper left;
-/// NSRect are relative to 0,0 in lower left
-//
-// Args:
-// inRect: NSRect to convert
-//
-// Returns:
-// Converted Rect
-CG_INLINE Rect GTMGlobalNSRectToRect(NSRect inRect) {
- return GTMHIRectToRect(GTMGlobalNSRectToHIRect(inRect));
-}
-
-/// Convert from a global CGRect to a global HIRect.
-//
-/// HIRect are relative to 0,0 in upper left;
-/// CGRect are relative to 0,0 in lower left
-//
-// Args:
-// inRect: CGRect to convert
-//
-// Returns:
-// Converted HIRect
-CG_INLINE HIRect GTMGlobalCGRectToHIRect(CGRect inRect) {
- return GTMGlobalNSRectToHIRect(GTMCGRectToNSRect(inRect));
-}
-
-/// Convert from a global CGRect to a global Rect.
-//
-/// Rect are relative to 0,0 in upper left;
-/// CGRect are relative to 0,0 in lower left
-//
-// Args:
-// inRect: CGRect to convert
-//
-// Returns:
-// Converted Rect
-CG_INLINE Rect GTMGlobalCGRectToRect(CGRect inRect) {
- return GTMHIRectToRect(GTMGlobalCGRectToHIRect(inRect));
-}
-
-#pragma mark -
-#pragma mark Size Conversion
-
-/// Convert from a CGSize to an NSSize.
-//
-// Args:
-// inSize: CGSize to convert
-//
-// Returns:
-// Converted NSSize
-CG_INLINE NSSize GTMCGSizeToNSSize(CGSize inSize) {
- return NSMakeSize(inSize.width, inSize.height);
-}
-
-/// Convert from a NSSize to a CGSize.
-//
-// Args:
-// inSize: NSSize to convert
-//
-// Returns:
-// Converted CGSize
-CG_INLINE CGSize GTMNSSizeToCGSize(NSSize inSize) {
- return CGSizeMake(inSize.width, inSize.height);
-}
-
-#pragma mark -
-#pragma mark Point On Rect
-
-/// Return middle of left side of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// point located in the middle of left side of rect
-CG_INLINE NSPoint GTMNSMidLeft(NSRect rect) {
- return NSMakePoint(NSMinX(rect), NSMidY(rect));
-}
-
-/// Return middle of right side of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// point located in the middle of right side of rect
-CG_INLINE NSPoint GTMNSMidRight(NSRect rect) {
- return NSMakePoint(NSMaxX(rect), NSMidY(rect));
-}
-
-/// Return middle of top side of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// point located in the middle of top side of rect
-CG_INLINE NSPoint GTMNSMidTop(NSRect rect) {
- return NSMakePoint(NSMidX(rect), NSMaxY(rect));
-}
-
-/// Return middle of bottom side of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// point located in the middle of bottom side of rect
-CG_INLINE NSPoint GTMNSMidBottom(NSRect rect) {
- return NSMakePoint(NSMidX(rect), NSMinY(rect));
-}
-
-/// Return center of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// point located in the center of rect
-CG_INLINE NSPoint GTMNSCenter(NSRect rect) {
- return NSMakePoint(NSMidX(rect), NSMidY(rect));
-}
-
-/// Return middle of left side of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// point located in the middle of left side of rect
-CG_INLINE CGPoint GTMCGMidLeft(CGRect rect) {
- return CGPointMake(CGRectGetMinX(rect), CGRectGetMidY(rect));
-}
-
-/// Return middle of right side of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// point located in the middle of right side of rect
-CG_INLINE CGPoint GTMCGMidRight(CGRect rect) {
- return CGPointMake(CGRectGetMaxX(rect), CGRectGetMidY(rect));
-}
-
-/// Return middle of top side of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// point located in the middle of top side of rect
-CG_INLINE CGPoint GTMCGMidTop(CGRect rect) {
- return CGPointMake(CGRectGetMidX(rect), CGRectGetMaxY(rect));
-}
-
-/// Return middle of bottom side of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// point located in the middle of bottom side of rect
-CG_INLINE CGPoint GTMCGMidBottom(CGRect rect) {
- return CGPointMake(CGRectGetMidX(rect), CGRectGetMinY(rect));
-}
-
-/// Return center of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// point located in the center of rect
-CG_INLINE CGPoint GTMCGCenter(CGRect rect) {
- return CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect));
-}
-
-#pragma mark -
-#pragma mark Rect-Size Conversion
-
-/// Return size of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// size of rectangle
-CG_INLINE NSSize GTMNSRectSize(NSRect rect) {
- return NSMakeSize(NSWidth(rect), NSHeight(rect));
-}
-
-/// Return size of rectangle
-//
-// Args:
-// rect - rectangle
-//
-// Returns:
-// size of rectangle
-CG_INLINE CGSize GTMCGRectSize(CGRect rect) {
- return CGSizeMake(CGRectGetWidth(rect), CGRectGetHeight(rect));
-}
-
-/// Return rectangle of size
-//
-// Args:
-// size - size
-//
-// Returns:
-// rectangle of size (origin 0,0)
-CG_INLINE NSRect GTMNSRectOfSize(NSSize size) {
- return NSMakeRect(0.0f, 0.0f, size.width, size.height);
-}
-
-/// Return rectangle of size
-//
-// Args:
-// size - size
-//
-// Returns:
-// rectangle of size (origin 0,0)
-CG_INLINE CGRect GTMCGRectOfSize(CGSize size) {
- return CGRectMake(0.0f, 0.0f, size.width, size.height);
-}
-
-#pragma mark -
-#pragma mark Rect Scaling and Alignment
-
-/// Scales an NSRect
-//
-// Args:
-// inRect: Rect to scale
-// xScale: fraction to scale (1.0 is 100%)
-// yScale: fraction to scale (1.0 is 100%)
-//
-// Returns:
-// Converted Rect
-CG_INLINE NSRect GTMNSRectScale(NSRect inRect, float xScale, float yScale) {
- return NSMakeRect(inRect.origin.x, inRect.origin.y,
- inRect.size.width * xScale, inRect.size.height * yScale);
-}
-
-/// Scales an CGRect
-//
-// Args:
-// inRect: Rect to scale
-// xScale: fraction to scale (1.0 is 100%)
-// yScale: fraction to scale (1.0 is 100%)
-//
-// Returns:
-// Converted Rect
-CG_INLINE CGRect GTMCGRectScale(CGRect inRect, float xScale, float yScale) {
- return CGRectMake(inRect.origin.x, inRect.origin.y,
- inRect.size.width * xScale, inRect.size.height * yScale);
-}
-
-/// Align rectangles
-//
-// Args:
-// alignee - rect to be aligned
-// aligner - rect to be aligned from
-NSRect GTMAlignRectangles(NSRect alignee, NSRect aligner,
- NSImageAlignment alignment);
-
-/// Align rectangles
-//
-// Args:
-// alignee - rect to be aligned
-// aligner - rect to be aligned from
-// alignment - way to align the rectangles
-CG_INLINE CGRect GTMCGAlignRectangles(CGRect alignee, CGRect aligner,
- NSImageAlignment alignment) {
- return GTMNSRectToCGRect(GTMAlignRectangles(GTMCGRectToNSRect(alignee),
- GTMCGRectToNSRect(aligner),
- alignment));
-}
-
-/// Scale rectangle
-//
-// Args:
-// scalee - rect to be scaled
-// size - size to scale to
-// scaling - way to scale the rectangle
-NSRect GTMScaleRectangleToSize(NSRect scalee, NSSize size,
- NSImageScaling scaling);
-
-/// Scale rectangle
-//
-// Args:
-// scalee - rect to be scaled
-// size - size to scale to
-// scaling - way to scale the rectangle
-CG_INLINE CGRect GTMCGScaleRectangleToSize(CGRect scalee, CGSize size,
- NSImageScaling scaling) {
- return GTMNSRectToCGRect(GTMScaleRectangleToSize(GTMCGRectToNSRect(scalee),
- GTMCGSizeToNSSize(size),
- scaling));
-}
-
diff --git a/AppKit/GTMGeometryUtils.m b/AppKit/GTMGeometryUtils.m
deleted file mode 100644
index efc543e..0000000
--- a/AppKit/GTMGeometryUtils.m
+++ /dev/null
@@ -1,152 +0,0 @@
-//
-// GTMGeometryUtils.m
-//
-// Copyright 2006-2008 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
-// of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-//
-
-#import "GTMGeometryUtils.h"
-
-float GTMGetMainDisplayHeight(void) {
- float height = 0;
- NSArray *screens = [NSScreen screens];
- // We may have a headless machine without any screens. In this case we
- // return 0.
- if ([screens count] > 0) {
- height = NSHeight([(NSScreen*)[screens objectAtIndex: 0] frame]);
- }
- return height;
-}
-
-
-// Rect conversion routines.
-HIRect GTMGlobalNSRectToHIRect(NSRect inRect) {
- HIRect theRect;
- theRect.origin = GTMGlobalNSPointToHIPoint(inRect.origin);
- theRect.origin.y -= inRect.size.height;
- theRect.size = CGSizeMake(inRect.size.width, inRect.size.height);
- return theRect;
-}
-
-
-HIRect GTMRectToHIRect(Rect inRect) {
- HIRect theRect;
- theRect.origin = CGPointMake(inRect.left,inRect.top);
- theRect.size = CGSizeMake(inRect.right - inRect.left, inRect.bottom - inRect.top);
- return theRect;
-}
-
-
-NSRect GTMGlobalHIRectToNSRect(HIRect inRect) {
- NSRect theRect;
- theRect.origin = GTMGlobalHIPointToNSPoint(inRect.origin);
- theRect.origin.y -= inRect.size.height;
- theRect.size = NSMakeSize(inRect.size.width, inRect.size.height);
- return theRect;
-}
-
-
-Rect GTMHIRectToRect(HIRect inRect) {
- Rect theRect;
- theRect.left = inRect.origin.x;
- theRect.right = ceilf(inRect.origin.x + inRect.size.width);
- theRect.top = inRect.origin.y;
- theRect.bottom = ceilf(inRect.origin.y + inRect.size.height);
- return theRect;
-}
-
-/// Align rectangles
-//
-// Args:
-// alignee - rect to be aligned
-// aligner - rect to be aligned to
-// alignment - alignment to be applied to alignee based on aligner
-
-NSRect GTMAlignRectangles(NSRect alignee, NSRect aligner, NSImageAlignment alignment) {
- switch (alignment) {
- case NSImageAlignTop:
- alignee.origin.x = aligner.origin.x + (NSWidth(aligner) * .5f - NSWidth(alignee) * .5f);
- alignee.origin.y = aligner.origin.y + NSHeight(aligner) - NSHeight(alignee);
- break;
-
- case NSImageAlignTopLeft:
- alignee.origin.x = aligner.origin.x;
- alignee.origin.y = aligner.origin.y + NSHeight(aligner) - NSHeight(alignee);
- break;
-
- case NSImageAlignTopRight:
- alignee.origin.x = aligner.origin.x + NSWidth(aligner) - NSWidth(alignee);
- alignee.origin.y = aligner.origin.y + NSHeight(aligner) - NSHeight(alignee);
- break;
-
- case NSImageAlignLeft:
- alignee.origin.x = aligner.origin.x;
- alignee.origin.y = aligner.origin.y + (NSHeight(aligner) * .5f - NSHeight(alignee) * .5f);
- break;
-
- case NSImageAlignBottomLeft:
- alignee.origin.x = aligner.origin.x;
- alignee.origin.y = aligner.origin.y;
- break;
-
- case NSImageAlignBottom:
- alignee.origin.x = aligner.origin.x + (NSWidth(aligner) * .5f - NSWidth(alignee) * .5f);
- alignee.origin.y = aligner.origin.y;
- break;
-
- case NSImageAlignBottomRight:
- alignee.origin.x = aligner.origin.x + NSWidth(aligner) - NSWidth(alignee);
- alignee.origin.y = aligner.origin.y;
- break;
-
- case NSImageAlignRight:
- alignee.origin.x = aligner.origin.x + NSWidth(aligner) - NSWidth(alignee);
- alignee.origin.y = aligner.origin.y + (NSHeight(aligner) * .5f - NSHeight(alignee) * .5f);
- break;
-
- default:
- case NSImageAlignCenter:
- alignee.origin.x = aligner.origin.x + (NSWidth(aligner) * .5f - NSWidth(alignee) * .5f);
- alignee.origin.y = aligner.origin.y + (NSHeight(aligner) * .5f - NSHeight(alignee) * .5f);
- break;
- }
- return alignee;
-}
-
-NSRect GTMScaleRectangleToSize(NSRect scalee, NSSize size, NSImageScaling scaling) {
- switch (scaling) {
- case NSScaleProportionally: {
- float height = NSHeight(scalee);
- float width = NSWidth(scalee);
- if (isnormal(height) && isnormal(width) &&
- (height > size.height || width > size.width)) {
- float horiz = size.width / width;
- float vert = size.height / height;
- float newScale = horiz < vert ? horiz : vert;
- scalee = GTMNSRectScale(scalee, newScale, newScale);
- }
- break;
- }
-
- case NSScaleToFit:
- scalee.size = size;
- break;
-
- case NSScaleNone:
- default:
- // Do nothing
- break;
- }
- return scalee;
-}
diff --git a/AppKit/GTMGeometryUtilsTest.m b/AppKit/GTMGeometryUtilsTest.m
deleted file mode 100644
index 0fad449..0000000
--- a/AppKit/GTMGeometryUtilsTest.m
+++ /dev/null
@@ -1,323 +0,0 @@
-//
-// GTMGeometryUtilsTest.m
-//
-// Copyright 2006-2008 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
-// of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-//
-
-#import <SenTestingKit/SenTestingKit.h>
-#import "GTMGeometryUtils.h"
-
-@interface GTMGeometryUtilsTest : SenTestCase
-@end
-
-@implementation GTMGeometryUtilsTest
-
-- (void)testGTMGetMainDisplayHeight {
- STAssertTrue(CGRectGetHeight(CGDisplayBounds(CGMainDisplayID())) == GTMGetMainDisplayHeight(), nil);
-}
-
-
-- (void)testGTMGlobalHIPointToNSPoint {
- HIPoint hiPoint = CGPointMake(12.5,14.5);
- NSPoint nsPoint = GTMGlobalHIPointToNSPoint(hiPoint);
- STAssertTrue(nsPoint.x == hiPoint.x &&
- nsPoint.y == GTMGetMainDisplayHeight() - hiPoint.y, nil);
-}
-
-
-- (void)testGTMGlobalNSPointToHIPoint {
- NSPoint nsPoint = NSMakePoint(12.5,14.5);
- HIPoint hiPoint = GTMGlobalNSPointToHIPoint(nsPoint);
- STAssertTrue(nsPoint.x == hiPoint.x &&
- nsPoint.y == GTMGetMainDisplayHeight() - hiPoint.y, nil);
-}
-
-
-- (void)testGTMGlobalCGPointToNSPoint {
- CGPoint cgPoint = CGPointMake(15.1,6.2);
- NSPoint nsPoint = GTMCGPointToNSPoint(cgPoint);
- STAssertTrue(CGPointEqualToPoint(*(CGPoint*)&nsPoint, cgPoint), nil);
-
-}
-
-
-- (void)testGTMGlobalNSPointToCGPoint {
- NSPoint nsPoint = NSMakePoint(10.2,1.5);
- CGPoint cgPoint = GTMNSPointToCGPoint(nsPoint);
- STAssertTrue(CGPointEqualToPoint(cgPoint, *(CGPoint*)&nsPoint), nil);
-}
-
-
-- (void)testGTMGlobalCGPointToHIPoint {
- CGPoint cgPoint = CGPointMake(12.5,14.5);
- HIPoint hiPoint = GTMGlobalCGPointToHIPoint(cgPoint);
- STAssertTrue(cgPoint.x == hiPoint.x &&
- cgPoint.y == GTMGetMainDisplayHeight() - hiPoint.y, nil);
-}
-
-
-- (void)testGTMGlobalHIPointToCGPoint {
- HIPoint hiPoint = CGPointMake(12.5,14.5);
- CGPoint cgPoint = GTMGlobalHIPointToCGPoint(hiPoint);
- STAssertTrue(cgPoint.x == hiPoint.x &&
- cgPoint.y == GTMGetMainDisplayHeight() - hiPoint.y, nil);
-}
-
-
-- (void)testGTMGlobalNSRectToHIRect {
- NSRect nsRect = NSMakeRect(40,16,17,18);
- HIRect hiRect = GTMGlobalNSRectToHIRect(nsRect);
- STAssertTrue(nsRect.origin.x == hiRect.origin.x &&
- nsRect.origin.y == GTMGetMainDisplayHeight() - hiRect.origin.y - hiRect.size.height &&
- nsRect.size.height == hiRect.size.height &&
- nsRect.size.width == hiRect.size.width, nil);
-}
-
-
-- (void)testGTMGlobalCGRectToHIRect {
- CGRect cgRect = CGRectMake(40,16,17,19.0);
- HIRect hiRect = GTMGlobalCGRectToHIRect(cgRect);
- STAssertTrue(cgRect.origin.x == hiRect.origin.x &&
- cgRect.origin.y == GTMGetMainDisplayHeight() - hiRect.origin.y - hiRect.size.height &&
- cgRect.size.height == hiRect.size.height &&
- cgRect.size.width == hiRect.size.width, nil);
-}
-
-
-- (void)testGTMGlobalHIRectToNSRect {
- HIRect hiRect = CGRectMake(40.2,16.3,17.2,18.9);
- NSRect nsRect = GTMGlobalHIRectToNSRect(hiRect);
- STAssertTrue(nsRect.origin.x == hiRect.origin.x &&
- nsRect.origin.y == GTMGetMainDisplayHeight() - hiRect.origin.y - hiRect.size.height &&
- nsRect.size.height == hiRect.size.height &&
- nsRect.size.width == hiRect.size.width, nil);
-}
-
-
-- (void)testGTMGlobalCGRectToNSRect {
- CGRect cgRect = CGRectMake(1.5,2.4,10.6,11.7);
- NSRect nsRect = GTMCGRectToNSRect(cgRect);
- STAssertTrue(CGRectEqualToRect(cgRect, *(CGRect*)&nsRect), nil);
-}
-
-
-- (void)testGTMGlobalNSRectToCGRect {
- NSRect nsRect = NSMakeRect(4.6,3.2,22.1,45.0);
- CGRect cgRect = GTMNSRectToCGRect(nsRect);
- STAssertTrue(CGRectEqualToRect(cgRect, *(CGRect*)&nsRect), nil);
-}
-
-
-- (void)testGTMGlobalHIRectToCGRect {
- HIRect hiRect = CGRectMake(40.2,16.3,17.2,18.9);
- CGRect cgRect = GTMGlobalHIRectToCGRect(hiRect);
- STAssertTrue(cgRect.origin.x == hiRect.origin.x &&
- cgRect.origin.y == GTMGetMainDisplayHeight() - hiRect.origin.y - hiRect.size.height &&
- cgRect.size.height == hiRect.size.height &&
- cgRect.size.width == hiRect.size.width, nil);
-}
-
-
-- (void)testGTMGlobalRectToNSRect {
- Rect rect = { 10,50,40,60 };
- NSRect nsRect = GTMGlobalRectToNSRect(rect);
- HIRect hiRect1 = GTMRectToHIRect(rect);
- HIRect hiRect2 = GTMGlobalNSRectToHIRect(nsRect);
- STAssertTrue(CGRectEqualToRect(hiRect1,hiRect2), nil);
-}
-
-
-- (void)testGTMGlobalNSRectToRect {
- NSRect nsRect = NSMakeRect(1.5,2.4,10.6,11.7);
- HIRect hiRect = GTMGlobalNSRectToHIRect(nsRect);
- Rect rect1 = GTMGlobalNSRectToRect(nsRect);
- Rect rect2 = GTMHIRectToRect(hiRect);
- STAssertTrue(rect1.left == rect2.left &&
- rect1.right == rect2.right &&
- rect1.top == rect2.top &&
- rect1.bottom == rect2.bottom, nil);
-}
-
-
-- (void)testGTMGlobalRectToHIRect {
- Rect rect = { 10,20,30,40 };
- HIRect hiRect = GTMRectToHIRect(rect);
- STAssertTrue(CGRectEqualToRect(hiRect, CGRectMake(20,10,20,20)), nil);
-}
-
-
-- (void)testGTMGlobalHIRectToRect {
- HIRect hiRect = CGRectMake(1.5,2.4,10.6,11.7);
- Rect rect = GTMHIRectToRect(hiRect);
- STAssertTrue(rect.left == 1 &&
- rect.right == 13 &&
- rect.top == 2 &&
- rect.bottom == 15, nil);
-}
-
-
-- (void)testGTMGlobalCGRectToRect {
- CGRect cgRect = CGRectMake(1.5,2.4,10.6,11.7);
- HIRect hiRect = GTMGlobalCGRectToHIRect(cgRect);
- Rect rect1 = GTMGlobalCGRectToRect(cgRect);
- Rect rect2 = GTMHIRectToRect(hiRect);
- STAssertTrue(rect1.left == rect2.left &&
- rect1.right == rect2.right &&
- rect1.top == rect2.top &&
- rect1.bottom == rect2.bottom, nil);
-}
-
-
-- (void)testGTMGlobalRectToCGRect {
- Rect rect = { 10,50,40,60 };
- CGRect nsRect = GTMGlobalRectToCGRect(rect);
- HIRect hiRect1 = GTMRectToHIRect(rect);
- HIRect hiRect2 = GTMGlobalCGRectToHIRect(nsRect);
- STAssertTrue(CGRectEqualToRect(hiRect1,hiRect2), nil);
-}
-
-
-- (void)testGTMCGSizeToNSSize {
- CGSize cgSize = {5,6};
- NSSize nsSize = GTMCGSizeToNSSize(cgSize);
- STAssertTrue(CGSizeEqualToSize(cgSize, *(CGSize*)&nsSize), nil);
-}
-
-
-- (void)testGTMNSSizeToCGSize {
- NSSize nsSize = {22,15};
- CGSize cgSize = GTMNSSizeToCGSize(nsSize);
- STAssertTrue(CGSizeEqualToSize(cgSize, *(CGSize*)&nsSize), nil);
-}
-
-- (void)testGTMDistanceBetweenPoints {
- NSPoint pt1 = NSMakePoint(0, 0);
- NSPoint pt2 = NSMakePoint(3, 4);
- STAssertEquals(GTMDistanceBetweenPoints(pt1, pt2), 5.0f, nil);
- STAssertEquals(GTMDistanceBetweenPoints(pt2, pt1), 5.0f, nil);
- pt1 = NSMakePoint(1, 1);
- pt2 = NSMakePoint(1, 1);
- STAssertEquals(GTMDistanceBetweenPoints(pt1, pt2), 0.0f, nil);
-}
-
-- (void)testGTMAlignRectangles {
- typedef struct {
- NSPoint expectedOrigin;
- NSImageAlignment alignment;
- } TestData;
-
- TestData data[] = {
- { {1,2}, NSImageAlignTop },
- { {0,2}, NSImageAlignTopLeft },
- { {2,2}, NSImageAlignTopRight },
- { {0,1}, NSImageAlignLeft },
- { {1,0}, NSImageAlignBottom },
- { {0,0}, NSImageAlignBottomLeft },
- { {2,0}, NSImageAlignBottomRight },
- { {2,1}, NSImageAlignRight },
- { {1,1}, NSImageAlignCenter },
- };
-
- NSRect rect1 = NSMakeRect(0, 0, 4, 4);
- NSRect rect2 = NSMakeRect(0, 0, 2, 2);
-
- for (int i = 0; i < sizeof(data) / sizeof(TestData); i++) {
- NSRect expectedRect;
- expectedRect.origin = data[i].expectedOrigin;
- expectedRect.size = NSMakeSize(2, 2);
- NSRect outRect = GTMAlignRectangles(rect2, rect1, data[i].alignment);
- STAssertEquals(outRect, expectedRect, nil);
- }
-}
-
-- (void)testGTMPointsOnRect {
- NSRect rect = NSMakeRect(0, 0, 2, 2);
- CGRect cgRect = GTMNSRectToCGRect(rect);
-
- NSPoint point = GTMNSMidLeft(rect);
- CGPoint cgPoint = GTMCGMidLeft(cgRect);
- STAssertEquals(point.x, cgPoint.x, nil);
- STAssertEquals(point.y, cgPoint.y, nil);
- STAssertEqualsWithAccuracy(point.y, 1.0f, 0.01f, nil);
- STAssertEqualsWithAccuracy(point.x, 0.0f, 0.01f, nil);
-
- point = GTMNSMidRight(rect);
- cgPoint = GTMCGMidRight(cgRect);
- STAssertEquals(point.x, cgPoint.x, nil);
- STAssertEquals(point.y, cgPoint.y, nil);
- STAssertEqualsWithAccuracy(point.y, 1.0f, 0.01f, nil);
- STAssertEqualsWithAccuracy(point.x, 2.0f, 0.01f, nil);
-
- point = GTMNSMidTop(rect);
- cgPoint = GTMCGMidTop(cgRect);
- STAssertEquals(point.x, cgPoint.x, nil);
- STAssertEquals(point.y, cgPoint.y, nil);
- STAssertEqualsWithAccuracy(point.y, 2.0f, 0.01f, nil);
- STAssertEqualsWithAccuracy(point.x, 1.0f, 0.01f, nil);
-
- point = GTMNSMidBottom(rect);
- cgPoint = GTMCGMidBottom(cgRect);
- STAssertEquals(point.x, cgPoint.x, nil);
- STAssertEquals(point.y, cgPoint.y, nil);
- STAssertEqualsWithAccuracy(point.y, 0.0f, 0.01f, nil);
- STAssertEqualsWithAccuracy(point.x, 1.0f, 0.01f, nil);
-}
-
-- (void)testGTMRectScaling {
- NSRect rect = NSMakeRect(1.0f, 2.0f, 5.0f, 10.0f);
- NSRect rect2 = NSMakeRect(1.0f, 2.0f, 1.0f, 12.0f);
- STAssertEquals(GTMNSRectScale(rect, 0.2f, 1.2f),
- rect2, nil);
- STAssertEquals(GTMCGRectScale(GTMNSRectToCGRect(rect), 0.2f, 1.2f),
- GTMNSRectToCGRect(rect2), nil);
-}
-
-- (void)testGTMScaleRectangleToSize {
- NSRect rect = NSMakeRect(0.0f, 0.0f, 10.0f, 10.0f);
- typedef struct {
- NSSize size_;
- NSSize newSize_;
- } Test;
- Test tests[] = {
- { { 5.0, 10.0 }, { 5.0, 5.0 } },
- { { 10.0, 5.0 }, { 5.0, 5.0 } },
- { { 10.0, 10.0 }, { 10.0, 10.0 } },
- { { 11.0, 11.0, }, { 10.0, 10.0 } },
- { { 5.0, 2.0 }, { 2.0, 2.0 } },
- { { 2.0, 5.0 }, { 2.0, 2.0 } },
- { { 2.0, 2.0 }, { 2.0, 2.0 } },
- { { 0.0, 10.0 }, { 0.0, 0.0 } }
- };
-
- for (size_t i = 0; i < sizeof(tests) / sizeof(Test); ++i) {
- NSRect result = GTMScaleRectangleToSize(rect, tests[i].size_,
- NSScaleProportionally);
- STAssertEquals(result, GTMNSRectOfSize(tests[i].newSize_), @"failed on test %z", i);
- }
-
- NSRect result = GTMScaleRectangleToSize(NSZeroRect, tests[0].size_,
- NSScaleProportionally);
- STAssertEquals(result, NSZeroRect, nil);
-
- result = GTMScaleRectangleToSize(rect, tests[0].size_,
- NSScaleToFit);
- STAssertEquals(result, GTMNSRectOfSize(tests[0].size_), nil);
-
- result = GTMScaleRectangleToSize(rect, tests[0].size_,
- NSScaleNone);
- STAssertEquals(result, rect, nil);
-
-}
-@end
diff --git a/AppKit/GTMLinearRGBShading.m b/AppKit/GTMLinearRGBShading.m
index ab5bda6..31f22ca 100644
--- a/AppKit/GTMLinearRGBShading.m
+++ b/AppKit/GTMLinearRGBShading.m
@@ -165,7 +165,7 @@ static void cShadeFunction(void *info, const float *inPos, float *outVals) {
// diposed if necessary in the dealloc call.
const CGFunctionCallbacks shadeFunctionCallbacks = { 0, &cShadeFunction, NULL };
- // TODO: (dmaclach): this code assumes that we have a range from 0.0f to 1.0f
+ // TODO: this code assumes that we have a range from 0.0f to 1.0f
// which may not be true according to the stops that the user has given us.
// In general you have stops at 0.0 and 1.0, so this will do for right now
// but may be an issue in the future.
diff --git a/AppKit/GTMNSBezierPath+CGPath.m b/AppKit/GTMNSBezierPath+CGPath.m
index 97464fc..c805f42 100644
--- a/AppKit/GTMNSBezierPath+CGPath.m
+++ b/AppKit/GTMNSBezierPath+CGPath.m
@@ -18,6 +18,7 @@
// the License.
//
#import "GTMNSBezierPath+CGPath.h"
+#import "GTMDefines.h"
@implementation NSBezierPath (GTMBezierPathCGPathAdditions)
@@ -58,7 +59,7 @@
CGPathCloseSubpath(thePath);
break;
default:
- NSLog(@"Unknown element at [NSBezierPath (GTMBezierPathCGPathAdditions) cgPath]");
+ _GTMDevLog(@"Unknown element at [NSBezierPath (GTMBezierPathCGPathAdditions) cgPath]");
break;
};
}
diff --git a/AppKit/GTMNSBezierPath+CGPathTest.m b/AppKit/GTMNSBezierPath+CGPathTest.m
index c8506d7..3ca11c3 100644
--- a/AppKit/GTMNSBezierPath+CGPathTest.m
+++ b/AppKit/GTMNSBezierPath+CGPathTest.m
@@ -20,7 +20,8 @@
#import <SenTestingKit/SenTestingKit.h>
#import "GTMNSBezierPath+CGPath.h"
-#import "GTMNSView+UnitTesting.h"
+#import "GTMAppKit+UnitTesting.h"
+#import "GTMSenTestCase.h"
@interface GTMNSBezierPath_CGPathTest : SenTestCase<GTMUnitTestViewDrawer>
@end
@@ -32,8 +33,8 @@
}
-// Draws all of our tests so that we can compare this to our stored TIFF file.
-- (void)unitTestViewDrawRect:(NSRect)rect contextInfo:(void*)contextInfo{
+// Draws all of our tests so that we can compare this to our stored image file.
+- (void)gtm_unitTestViewDrawRect:(NSRect)rect contextInfo:(void*)contextInfo{
NSBezierPath *thePath = [NSBezierPath bezierPath];
NSPoint theStart = NSMakePoint(20.0f, 20.0f);
@@ -59,17 +60,11 @@
[thePath closePath];
CGPathRef cgPath = [thePath gtm_createCGPath];
- if (nil == cgPath) {
- @throw [NSException failureInFile:[NSString stringWithCString:__FILE__]
- atLine:__LINE__
- withDescription:@"Nil CGPath"];
- }
+ STAssertNotNULL(cgPath, @"Nil CGPath");
+
CGContextRef cgContext = [[NSGraphicsContext currentContext] graphicsPort];
- if (nil == cgContext) {
- @throw [NSException failureInFile:[NSString stringWithCString:__FILE__]
- atLine:__LINE__
- withDescription:@"Nil CGContext"];
- }
+ STAssertNotNULL(cgContext, @"Nil cgContext");
+
CGContextAddPath(cgContext, cgPath);
CGContextStrokePath(cgContext);
CGPathRelease(cgPath);
diff --git a/AppKit/GTMNSBezierPath+CGPathTest.tif b/AppKit/GTMNSBezierPath+CGPathTest.tif
deleted file mode 100644
index a7fee9b..0000000
--- a/AppKit/GTMNSBezierPath+CGPathTest.tif
+++ /dev/null
Binary files differ
diff --git a/AppKit/GTMNSBezierPath+CGPathTest.tiff b/AppKit/GTMNSBezierPath+CGPathTest.tiff
new file mode 100644
index 0000000..98ec8f8
--- /dev/null
+++ b/AppKit/GTMNSBezierPath+CGPathTest.tiff
Binary files differ
diff --git a/AppKit/GTMNSBezierPath+RoundRectTest.m b/AppKit/GTMNSBezierPath+RoundRectTest.m
index 61bd2dd..6ff4a18 100644
--- a/AppKit/GTMNSBezierPath+RoundRectTest.m
+++ b/AppKit/GTMNSBezierPath+RoundRectTest.m
@@ -20,7 +20,7 @@
#import <SenTestingKit/SenTestingKit.h>
#import "GTMNSBezierPath+RoundRect.h"
-#import "GTMNSView+UnitTesting.h"
+#import "GTMAppKit+UnitTesting.h"
@interface GTMNSBezierPath_RoundRectTest : SenTestCase<GTMUnitTestViewDrawer>
@end
@@ -28,12 +28,12 @@
@implementation GTMNSBezierPath_RoundRectTest
- (void)testRoundRects {
- GTMAssertDrawingEqualToFile(self, NSMakeSize(330, 430), @"GTMNSBezierPath+RoundRectTest", nil, nil);
+ GTMAssertDrawingEqualToFile(self, NSMakeSize(330, 430),
+ @"GTMNSBezierPath+RoundRectTest", nil, nil);
}
-
// Draws all of our tests so that we can compare this to our stored TIFF file.
-- (void)unitTestViewDrawRect:(NSRect)rect contextInfo:(void*)contextInfo{
+- (void)gtm_unitTestViewDrawRect:(NSRect)rect contextInfo:(void*)contextInfo{
NSRect theRects[] = {
NSMakeRect(0.0f, 10.0f, 0.0f, 0.0f), //Empty Rect test
NSMakeRect(50.0f, 10.0f, 30.0f, 30.0f), //Square Test
@@ -50,25 +50,29 @@
for (i = 0; i < theLineWidthCount; ++i) {
for (j = 0; j < theRectCount; ++j) {
- NSBezierPath *roundRect = [NSBezierPath gtm_bezierPathWithRoundRect:theRects[j] cornerRadius:20.0f];
+ NSBezierPath *roundRect = [NSBezierPath gtm_bezierPathWithRoundRect:theRects[j]
+ cornerRadius:20.0f];
[roundRect setLineWidth: theLineWidths[i]];
[roundRect stroke];
float newWidth = 35.0f;
- if (i < theLineWidthCount - 1) newWidth += theLineWidths[i + 1] + theLineWidths[i];
+ if (i < theLineWidthCount - 1) {
+ newWidth += theLineWidths[i + 1] + theLineWidths[i];
+ }
theRects[j].origin.y += newWidth;
}
}
// Fill test
NSColor *theColors[] = {
- [NSColor colorWithDeviceRed:1.0f green:0.0f blue:0.0f alpha:1.0f],
- [NSColor colorWithDeviceRed:0.2f green:0.4f blue:0.6f alpha:0.4f]
+ [NSColor colorWithCalibratedRed:1.0f green:0.0f blue:0.0f alpha:1.0f],
+ [NSColor colorWithCalibratedRed:0.2f green:0.4f blue:0.6f alpha:0.4f]
};
const unsigned int theColorCount = sizeof(theColors)/sizeof(NSColor);
for (i = 0; i < theColorCount; ++i) {
for (j = 0; j < theRectCount; ++j) {
- NSBezierPath *roundRect = [NSBezierPath gtm_bezierPathWithRoundRect:theRects[j] cornerRadius:10.0f];
+ NSBezierPath *roundRect = [NSBezierPath gtm_bezierPathWithRoundRect:theRects[j]
+ cornerRadius:10.0f];
[theColors[i] setFill];
[roundRect fill];
theRects[j].origin.y += 35.0f;
@@ -81,7 +85,8 @@
for (i = 0; i < theFlatnessCount; i++) {
for (j = 0; j < theRectCount; ++j) {
- NSBezierPath *roundRect = [NSBezierPath gtm_bezierPathWithRoundRect:theRects[j] cornerRadius:6.0f];
+ NSBezierPath *roundRect = [NSBezierPath gtm_bezierPathWithRoundRect:theRects[j]
+ cornerRadius:6.0f];
[roundRect setFlatness:theFlatness[i]];
[roundRect stroke];
theRects[j].origin.y += 35.0f;
diff --git a/AppKit/GTMNSBezierPath+RoundRectTest.tif b/AppKit/GTMNSBezierPath+RoundRectTest.tif
deleted file mode 100644
index 7ce0d45..0000000
--- a/AppKit/GTMNSBezierPath+RoundRectTest.tif
+++ /dev/null
Binary files differ
diff --git a/AppKit/GTMNSBezierPath+RoundRectTest.tiff b/AppKit/GTMNSBezierPath+RoundRectTest.tiff
new file mode 100644
index 0000000..c41ab04
--- /dev/null
+++ b/AppKit/GTMNSBezierPath+RoundRectTest.tiff
Binary files differ
diff --git a/AppKit/GTMNSBezierPath+ShadingTest.10.4.tif b/AppKit/GTMNSBezierPath+ShadingTest.10.4.tif
deleted file mode 100644
index 44a09b5..0000000
--- a/AppKit/GTMNSBezierPath+ShadingTest.10.4.tif
+++ /dev/null
Binary files differ
diff --git a/AppKit/GTMNSBezierPath+ShadingTest.10.5.tif b/AppKit/GTMNSBezierPath+ShadingTest.10.5.tiff
index 6d4570a..040cb0d 100644
--- a/AppKit/GTMNSBezierPath+ShadingTest.10.5.tif
+++ b/AppKit/GTMNSBezierPath+ShadingTest.10.5.tiff
Binary files differ
diff --git a/AppKit/GTMNSBezierPath+ShadingTest.m b/AppKit/GTMNSBezierPath+ShadingTest.m
index bed6a4e..8b56cfb 100644
--- a/AppKit/GTMNSBezierPath+ShadingTest.m
+++ b/AppKit/GTMNSBezierPath+ShadingTest.m
@@ -21,7 +21,7 @@
#import <SenTestingKit/SenTestingKit.h>
#import "GTMLinearRGBShading.h"
-#import "GTMNSView+UnitTesting.h"
+#import "GTMAppKit+UnitTesting.h"
#import "GTMNSBezierPath+Shading.h"
@interface GTMNSBezierPath_ShadingTest : SenTestCase<GTMUnitTestViewDrawer>
@@ -34,7 +34,7 @@
}
-- (void)unitTestViewDrawRect:(NSRect)rect contextInfo:(void*)contextInfo{
+- (void)gtm_unitTestViewDrawRect:(NSRect)rect contextInfo:(void*)contextInfo {
NSColor *theColorArray[] = { [NSColor blueColor],
[NSColor redColor], [NSColor yellowColor],
diff --git a/AppKit/GTMNSColor+Theme.m b/AppKit/GTMNSColor+Theme.m
index 40326a7..67e8459 100644
--- a/AppKit/GTMNSColor+Theme.m
+++ b/AppKit/GTMNSColor+Theme.m
@@ -19,6 +19,7 @@
//
#import "GTMNSColor+Theme.h"
+#import "GTMDefines.h"
@implementation NSColor (GTMColorThemeAdditions)
@@ -37,9 +38,7 @@
blue:blue
alpha:1.0f];
} else {
-#ifdef DEBUG
- NSLog(@"Unable to create color for textcolor %d", textColor);
-#endif
+ _GTMDevLog(@"Unable to create color for textcolor %d", textColor);
}
return nsTextColor;
}
@@ -56,9 +55,7 @@
blue:rgbBrushColor.blue / 65535.0f
alpha:1.0f];
} else {
-#ifdef DEBUG
- NSLog(@"Unable to create color for brushcolor %d", brush);
-#endif
+ _GTMDevLog(@"Unable to create color for brushcolor %d", brush);
}
return nsBrushColor;
}
diff --git a/AppKit/GTMNSColor+ThemeTest.m b/AppKit/GTMNSColor+ThemeTest.m
index 4115dda..e7d2a77 100644
--- a/AppKit/GTMNSColor+ThemeTest.m
+++ b/AppKit/GTMNSColor+ThemeTest.m
@@ -82,21 +82,21 @@
{ 0.499992, 0.499992, 0.499992, 1.000000 },
{ 0.000000, 0.000000, 0.000000, 1.000000 }
};
-
- if ([GTMSystemVersion isLeopardOrGreater]) {
- // kThemeTextColorRootMenuDisabled changed to white in Leopard.
- colorValues[35][0] = 1.0;
- colorValues[35][1] = 1.0;
- colorValues[35][2] = 1.0;
- }
+
+ if ([GTMSystemVersion isLeopardOrGreater]) {
+ // kThemeTextColorRootMenuDisabled changed to white in Leopard.
+ colorValues[35][0] = 1.0;
+ colorValues[35][1] = 1.0;
+ colorValues[35][2] = 1.0;
+ }
for(int i = kThemeTextColorWhite; i < kThemeTextColorSystemDetail; i++) {
- if (i == 0) continue;
+ if (i == 0) continue; // There is no brush 0
NSColor *textColor = [NSColor gtm_colorWithThemeTextColor:i];
float nsComponents[5];
[textColor getComponents: nsComponents];
for(int j = 0; j < 4; j++) {
STAssertEqualsWithAccuracy(nsComponents[j], colorValues[i + 2][j], 0.000001,
- @"Theme Text Color %d is wrong", i);
+ @"Theme Text Color %d is wrong", i);
STAssertEqualObjects([textColor colorSpaceName], NSCalibratedRGBColorSpace,
@"Color space must be CalibratedRGB");
}
@@ -169,13 +169,16 @@
NSString *theme = [[NSWorkspace sharedWorkspace] gtm_themeAppearance];
if ([theme isEqualToString:(NSString*)kThemeAppearanceAquaGraphite]) {
+ // COV_NF_START
// These are the only two brushes that change with an appearance change
+ // In general we will be testing in blue, so this code won't get run
colorValues[21][0] = 0.605478;
colorValues[21][1] = 0.667979;
colorValues[21][2] = 0.738293;
colorValues[59][0] = 0.941192;
colorValues[59][1] = 0.941192;
colorValues[59][2] = 0.941192;
+ // COV_NF_END
}
for(int i = kThemeBrushWhite; i < kThemeBrushListViewColumnDivider; i++) {
// Brush "14" is the selection, so it will change depending on the system
diff --git a/AppKit/GTMNSWorkspace+ScreenSaver.m b/AppKit/GTMNSWorkspace+ScreenSaver.m
index 270f9bc..c86a73c 100644
--- a/AppKit/GTMNSWorkspace+ScreenSaver.m
+++ b/AppKit/GTMNSWorkspace+ScreenSaver.m
@@ -19,6 +19,7 @@
#import <Carbon/Carbon.h>
#import <ScreenSaver/ScreenSaver.h>
#import "GTMNSWorkspace+ScreenSaver.h"
+#import "GTMDefines.h"
// Interesting class descriptions extracted from ScreenSaver.framework using
// class-dump. Note that these are "not documented".
@@ -79,21 +80,25 @@
// step rather carefully.
Class screenSaverControllerClass = NSClassFromString(@"ScreenSaverController");
- NSAssert(screenSaverControllerClass,
- @"Are you linked with ScreenSaver.framework?"
- " Can't find ScreenSaverController class.");
+ _GTMDevAssert(screenSaverControllerClass,
+ @"Are you linked with ScreenSaver.framework?"
+ " Can't find ScreenSaverController class.");
if ([screenSaverControllerClass respondsToSelector:@selector(controller)]) {
controller = [ScreenSaverController controller];
if (controller) {
if ([controller respondsToSelector:@selector(screenSaverIsRunning)]) {
answer = [controller screenSaverIsRunning];
} else {
- NSLog(@"ScreenSaverController no longer supports -screenSaverIsRunning?");
+ // COV_NF_START
+ _GTMDevLog(@"ScreenSaverController no longer supports -screenSaverIsRunning?");
+ controller = nil;
+ // COV_NF_END
}
}
}
if (!controller) {
+ // COV_NF_START
// If we can't get the controller, chances are we are being run from the
// command line and don't have access to the window server. As such we are
// going to fallback to the older method of figuring out if a screen saver
@@ -106,7 +111,7 @@
= ProcessInformationCopyDictionary(&psn,
kProcessDictionaryIncludeAllInformationMask);
- require(cfProcessInfo, CantGetFrontProcessInfo);
+ require(cfProcessInfo, CantGetFrontProcess);
NSString *bundlePath = [(NSDictionary*)cfProcessInfo objectForKey:@"BundlePath"];
@@ -116,8 +121,8 @@
answer = [bundlePath hasSuffix:@"ScreenSaverEngine.app"] ||
[bundlePath hasSuffix:@"SecurityAgent.app"];
CFRelease(cfProcessInfo);
+ // COV_NF_END
}
-CantGetFrontProcessInfo:
CantGetFrontProcess:
return answer;
}
diff --git a/AppKit/GTMNSWorkspace+Theme.m b/AppKit/GTMNSWorkspace+Theme.m
index 86b9935..3afb801 100644
--- a/AppKit/GTMNSWorkspace+Theme.m
+++ b/AppKit/GTMNSWorkspace+Theme.m
@@ -35,7 +35,7 @@
ThemeScrollBarArrowStyle style = kThemeScrollBarArrowsInvalid;
OSStatus theStatus = GetThemeScrollBarArrowStyle(&style);
if (theStatus != noErr) {
- style = kThemeScrollBarArrowsInvalid;
+ style = kThemeScrollBarArrowsInvalid; // COV_NF_LINE
}
return style;
}