aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AppKit/GTMCarbonEventTest.m9
-rw-r--r--AppKit/GTMGetURLHandlerTest.m6
-rw-r--r--AppKit/GTMNSImage+Scaling.h1
-rw-r--r--Foundation/GTMFileSystemKQueue.m2
-rw-r--r--Foundation/GTMNSAppleEventDescriptor+Foundation.m4
-rw-r--r--Foundation/GTMNSAppleEventDescriptor+FoundationTest.m7
-rw-r--r--Foundation/GTMNSArray+Merge.m2
-rw-r--r--Foundation/GTMNSFileManager+CarbonTest.m6
-rw-r--r--GTM.xcodeproj/project.pbxproj4
-rw-r--r--GTMDefines.h6
-rw-r--r--ReleaseNotes.txt6
-rw-r--r--UnitTesting/GTMNSObject+BindingUnitTesting.m22
-rw-r--r--UnitTesting/GTMUnitTestDevLog.h5
-rw-r--r--UnitTesting/GTMUnitTestDevLog.m16
-rw-r--r--UnitTesting/TestData/GTMUnitTestingWindow.10.5.6.tiffbin0 -> 21176 bytes
15 files changed, 76 insertions, 20 deletions
diff --git a/AppKit/GTMCarbonEventTest.m b/AppKit/GTMCarbonEventTest.m
index 0615271..a1a8b2b 100644
--- a/AppKit/GTMCarbonEventTest.m
+++ b/AppKit/GTMCarbonEventTest.m
@@ -208,7 +208,7 @@ static const UInt32 kTestParameterValue = 'bam ';
}
- (void)testEventHandler {
- [GTMUnitTestDevLog expectPattern:
+ [GTMUnitTestDevLogDebug expectPattern:
@"DebugAssert: GoogleToolboxForMac: event CantUseParams .*"];
STAssertErr([handler_ handleEvent:nil handler:nil], eventNotHandledErr, nil);
}
@@ -265,7 +265,7 @@ static const UInt32 kTestParameterValue = 'bam ';
UInt32 keyMods = (NSShiftKeyMask | NSControlKeyMask
| NSAlternateKeyMask | NSCommandKeyMask);
EventHotKeyRef hotKey;
- [GTMUnitTestDevLog expectPattern:@"DebugAssert: GoogleToolboxForMac: "
+ [GTMUnitTestDevLogDebug expectPattern:@"DebugAssert: GoogleToolboxForMac: "
@"newKey CantCreateKey .*"];
STAssertNULL([dispatcher registerHotKey:0x5
modifiers:keyMods
@@ -273,13 +273,16 @@ static const UInt32 kTestParameterValue = 'bam ';
action:nil
whenPressed:YES],
@"Shouldn't have created hotkey");
+#if DEBUG
+ // This test debug selector validation, so we only can do it in debug.
STAssertThrowsSpecificNamed([dispatcher registerHotKey:0x5
modifiers:keyMods
target:self
action:@selector(badSelector:)
whenPressed:YES],
NSException, NSInternalInconsistencyException,
- hotKey, @"Shouldn't have created hotkey");
+ @"Shouldn't have created hotkey");
+#endif
hotKey = [dispatcher registerHotKey:0x5
modifiers:keyMods
target:self
diff --git a/AppKit/GTMGetURLHandlerTest.m b/AppKit/GTMGetURLHandlerTest.m
index 98d3c89..30aa82f 100644
--- a/AppKit/GTMGetURLHandlerTest.m
+++ b/AppKit/GTMGetURLHandlerTest.m
@@ -59,12 +59,12 @@ static BOOL sURLHandlerWasHit;
- (void)testURLCall {
sURLHandlerWasHit = NO;
- [GTMUnitTestDevLog expectPattern:@"Class GTMGetURLHandlerBadClassWarning "
+ [GTMUnitTestDevLogDebug expectPattern:@"Class GTMGetURLHandlerBadClassWarning "
@"for URL handler GTMGetURLHandlerBadClassURL .*"];
- [GTMUnitTestDevLog expectPattern:@"Unable to get class "
+ [GTMUnitTestDevLogDebug expectPattern:@"Unable to get class "
@"GTMGetURLHandlerMissingClassWarning for URL handler "
@"GTMGetURLHandlerMissingClassURL .*"];
- [GTMUnitTestDevLog expectPattern:@"Missing GTMBundleURLClass for URL handler "
+ [GTMUnitTestDevLogDebug expectPattern:@"Missing GTMBundleURLClass for URL handler "
@"GTMGetURLHandlerMissingHandlerURL .*"];
STAssertTrue([self openURLString:@"gtmgeturlhandlertest://test.foo"], nil);
STAssertTrue(sURLHandlerWasHit, @"URL handler not called");
diff --git a/AppKit/GTMNSImage+Scaling.h b/AppKit/GTMNSImage+Scaling.h
index 6bf2dd5..7d48577 100644
--- a/AppKit/GTMNSImage+Scaling.h
+++ b/AppKit/GTMNSImage+Scaling.h
@@ -20,6 +20,7 @@
#import <Foundation/Foundation.h>
+#import "GTMDefines.h"
@interface NSImage (GTMNSImageScaling)
diff --git a/Foundation/GTMFileSystemKQueue.m b/Foundation/GTMFileSystemKQueue.m
index e2c399e..050d68f 100644
--- a/Foundation/GTMFileSystemKQueue.m
+++ b/Foundation/GTMFileSystemKQueue.m
@@ -18,7 +18,7 @@
#import "GTMFileSystemKQueue.h"
#import <unistd.h>
-
+#import "GTMDefines.h"
#import "GTMDebugSelectorValidation.h"
diff --git a/Foundation/GTMNSAppleEventDescriptor+Foundation.m b/Foundation/GTMNSAppleEventDescriptor+Foundation.m
index 14f256d..d0c26ec 100644
--- a/Foundation/GTMNSAppleEventDescriptor+Foundation.m
+++ b/Foundation/GTMNSAppleEventDescriptor+Foundation.m
@@ -234,6 +234,10 @@ static NSMutableDictionary *gTypeMap = nil;
return [GTMFourCharCode fourCharCodeWithFourCharCode:[self typeCodeValue]];
}
+- (NSAppleEventDescriptor*)gtm_appleEventDescriptor {
+ return self;
+}
+
@end
@implementation NSObject (GTMAppleEventDescriptorObjectAdditions)
diff --git a/Foundation/GTMNSAppleEventDescriptor+FoundationTest.m b/Foundation/GTMNSAppleEventDescriptor+FoundationTest.m
index 833fd5a..6df19ab 100644
--- a/Foundation/GTMNSAppleEventDescriptor+FoundationTest.m
+++ b/Foundation/GTMNSAppleEventDescriptor+FoundationTest.m
@@ -575,6 +575,13 @@
STAssertEquals([desc descriptorType], (DescType)typeKeyword, nil);
}
+- (void)testDescriptorWithDescriptor {
+ NSAppleEventDescriptor *desc
+ = [NSAppleEventDescriptor descriptorWithString:@"foo"];
+ NSAppleEventDescriptor *desc2 = [desc gtm_appleEventDescriptor];
+ STAssertEqualObjects(desc, desc2, nil);
+}
+
- (void)handleEvent:(NSAppleEventDescriptor*)event
withReply:(NSAppleEventDescriptor*)reply {
gotEvent_ = YES;
diff --git a/Foundation/GTMNSArray+Merge.m b/Foundation/GTMNSArray+Merge.m
index 725aa8a..da58a02 100644
--- a/Foundation/GTMNSArray+Merge.m
+++ b/Foundation/GTMNSArray+Merge.m
@@ -44,7 +44,7 @@
// Sort and merge the contents of |self| with |newArray|.
NSArray *sortedMergedArray = nil;
if ([self count] && [newArray count]) {
- NSMutableArray *mergingArray = [self mutableCopy];
+ NSMutableArray *mergingArray = [[self mutableCopy] autorelease];
[mergingArray sortUsingSelector:comparer];
NSArray *sortedNewArray
= [newArray sortedArrayUsingSelector:comparer];
diff --git a/Foundation/GTMNSFileManager+CarbonTest.m b/Foundation/GTMNSFileManager+CarbonTest.m
index ae58840..76692b0 100644
--- a/Foundation/GTMNSFileManager+CarbonTest.m
+++ b/Foundation/GTMNSFileManager+CarbonTest.m
@@ -48,8 +48,8 @@
STAssertEqualObjects(path, path4, nil);
// Failure cases
- [GTMUnitTestDevLog expectPattern:@"DebugAssert: "
- @"GoogleToolboxForMac: FSPathMakeRef.*"];
+ [GTMUnitTestDevLogDebug expectPattern:@"DebugAssert: "
+ @"GoogleToolboxForMac: FSPathMakeRef.*"];
STAssertNULL([fileManager gtm_FSRefForPath:@"/ptah/taht/dosent/esixt/"],
nil);
@@ -59,7 +59,7 @@
STAssertNil([fileManager gtm_pathFromAliasData:nil], nil);
STAssertNil([fileManager gtm_pathFromAliasData:[NSData data]], nil);
- [GTMUnitTestDevLog expectPattern:@"DebugAssert: "
+ [GTMUnitTestDevLogDebug expectPattern:@"DebugAssert: "
@"GoogleToolboxForMac: FSPathMakeRef.*"];
STAssertNil([fileManager gtm_aliasDataForPath:@"/ptah/taht/dosent/esixt/"], nil);
STAssertNil([fileManager gtm_aliasDataForPath:@""], nil);
diff --git a/GTM.xcodeproj/project.pbxproj b/GTM.xcodeproj/project.pbxproj
index 8b241aa..1faf2b1 100644
--- a/GTM.xcodeproj/project.pbxproj
+++ b/GTM.xcodeproj/project.pbxproj
@@ -62,6 +62,7 @@
8B1B49180E5F8E2100A08972 /* GTMExceptionalInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B1B49160E5F8E2100A08972 /* GTMExceptionalInlines.h */; settings = {ATTRIBUTES = (Public, ); }; };
8B1B49190E5F8E2100A08972 /* GTMExceptionalInlines.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B1B49170E5F8E2100A08972 /* GTMExceptionalInlines.m */; };
8B1B49260E5F97C800A08972 /* GTMExceptionalInlinesTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B1B491B0E5F904C00A08972 /* GTMExceptionalInlinesTest.m */; };
+ 8B2789960EF855FB00D68C01 /* GTMUnitTestingWindow.10.5.6.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 8B2789950EF855FB00D68C01 /* GTMUnitTestingWindow.10.5.6.tiff */; };
8B3344210DBF7A36009FD32C /* GTMNSAppleScript+HandlerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B3344170DBF7A36009FD32C /* GTMNSAppleScript+HandlerTest.m */; };
8B3344230DBF7A36009FD32C /* GTMNSAppleEventDescriptor+HandlerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B33441A0DBF7A36009FD32C /* GTMNSAppleEventDescriptor+HandlerTest.m */; };
8B3344250DBF7A36009FD32C /* GTMNSAppleEventDescriptor+FoundationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B33441D0DBF7A36009FD32C /* GTMNSAppleEventDescriptor+FoundationTest.m */; };
@@ -352,6 +353,7 @@
8B1B49160E5F8E2100A08972 /* GTMExceptionalInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTMExceptionalInlines.h; sourceTree = "<group>"; };
8B1B49170E5F8E2100A08972 /* GTMExceptionalInlines.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMExceptionalInlines.m; sourceTree = "<group>"; };
8B1B491B0E5F904C00A08972 /* GTMExceptionalInlinesTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMExceptionalInlinesTest.m; sourceTree = "<group>"; };
+ 8B2789950EF855FB00D68C01 /* GTMUnitTestingWindow.10.5.6.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = GTMUnitTestingWindow.10.5.6.tiff; sourceTree = "<group>"; };
8B3344170DBF7A36009FD32C /* GTMNSAppleScript+HandlerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSAppleScript+HandlerTest.m"; sourceTree = "<group>"; };
8B3344180DBF7A36009FD32C /* GTMNSAppleScript+Handler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSAppleScript+Handler.m"; sourceTree = "<group>"; };
8B3344190DBF7A36009FD32C /* GTMNSAppleScript+Handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMNSAppleScript+Handler.h"; sourceTree = "<group>"; };
@@ -680,6 +682,7 @@
children = (
84B91B890EA3CC2E0087500F /* GTMUnitTestingImage.10.6.0.tiff */,
84B91B8A0EA3CC2E0087500F /* GTMUnitTestingWindow.10.6.0.tiff */,
+ 8B2789950EF855FB00D68C01 /* GTMUnitTestingWindow.10.5.6.tiff */,
8B45A2DE0DA51A7E001148C5 /* GTMUnitTestingTest.nib */,
8B45A6B90DA67DD5001148C5 /* GTMUnitTestingImage.gtmUTState */,
8B45A5F50DA5EB9F001148C5 /* GTMUnitTestingWindow.gtmUTState */,
@@ -1199,6 +1202,7 @@
8BEEA90F0DA7446300894774 /* GTMUnitTestingView.tiff in Resources */,
84B91B8B0EA3CC2E0087500F /* GTMUnitTestingImage.10.6.0.tiff in Resources */,
84B91B8C0EA3CC2E0087500F /* GTMUnitTestingWindow.10.6.0.tiff in Resources */,
+ 8B2789960EF855FB00D68C01 /* GTMUnitTestingWindow.10.5.6.tiff in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/GTMDefines.h b/GTMDefines.h
index 968f868..5242e88 100644
--- a/GTMDefines.h
+++ b/GTMDefines.h
@@ -74,6 +74,12 @@
#endif
#endif
+// Give ourselves a consistent way of exporting things if we have visibility
+// set to hidden.
+#if !defined (GTM_EXPORT)
+ #define GTM_EXPORT __attribute__((visibility("default")))
+#endif
+
// _GTMDevLog & _GTMDevAssert
//
// _GTMDevLog & _GTMDevAssert are meant to be a very lightweight shell for
diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt
index b0c06e3..cd07252 100644
--- a/ReleaseNotes.txt
+++ b/ReleaseNotes.txt
@@ -198,6 +198,12 @@ Changes since 1.5.1
- Added GTMNSFileManager+Carbon which contains routines for path <-> Alias
conversion and path <-> FSRef conversion.
+- Added GTM_EXPORT as a standard way of exporting symbols.
+
+- Added GTMUnitTestDevLogDebug which extends GTMUnitTestDevLog to only look
+ for the messages in debug builds, to make it easier to validate messages
+ that are only present in debug builds.
+
Release 1.5.1
Changes since 1.5.0
diff --git a/UnitTesting/GTMNSObject+BindingUnitTesting.m b/UnitTesting/GTMNSObject+BindingUnitTesting.m
index 1ce1c88..7a14ad6 100644
--- a/UnitTesting/GTMNSObject+BindingUnitTesting.m
+++ b/UnitTesting/GTMNSObject+BindingUnitTesting.m
@@ -374,7 +374,8 @@ BOOL GTMDoExposedBindingsFunctionCorrectly(NSObject *object,
SInt32 major, minor, bugFix;
[GTMSystemVersion getMajor:&major minor:&minor bugFix:&bugFix];
if (major <= 10 && minor <= 5 && bugFix <= 5) {
- // rdar://5849154 - NSScroller exposes binding with no value class for NSValueBinding
+ // rdar://5849154 - NSScroller exposes binding with no value
+ // class for NSValueBinding
[array addObject:NSValueBinding];
}
if ([GTMSystemVersion isBuildLessThanOrEqualTo:kGTMSystemBuild10_6_0_WWDC]) {
@@ -404,10 +405,12 @@ BOOL GTMDoExposedBindingsFunctionCorrectly(NSObject *object,
NSMutableArray *array = [super gtm_unitTestExposedBindingsTestValues:binding];
if ([binding isEqualToString:NSAlignmentBinding]) {
if ([GTMSystemVersion isBuildLessThanOrEqualTo:kGTMSystemBuild10_6_0_WWDC]) {
- // rdar://5851487 - If NSAlignmentBinding for a NSTextField is set to -1 and then got it returns 7
+ // rdar://5851487 - If NSAlignmentBinding for a NSTextField is set to -1
+ // and then got it returns 7
+ NSNumber *textAlignment = [NSNumber numberWithInt:NSNaturalTextAlignment];
GTMBindingUnitTestData *dataToRemove =
[GTMBindingUnitTestData testWithValue:[NSNumber numberWithInt:-1]
- expecting:[NSNumber numberWithInt:NSNaturalTextAlignment]];
+ expecting:textAlignment];
[array removeObject:dataToRemove];
GTMBindingUnitTestData *dataToAdd =
[GTMBindingUnitTestData testWithValue:[NSNumber numberWithInt:-1]
@@ -428,9 +431,10 @@ BOOL GTMDoExposedBindingsFunctionCorrectly(NSObject *object,
NSMutableArray *array = [super gtm_unitTestExposedBindingsToIgnore];
SInt32 major, minor, bugFix;
[GTMSystemVersion getMajor:&major minor:&minor bugFix:&bugFix];
- if (major <= 10 && minor <= 5 && bugFix <= 5) {
- // rdar://5851491 - Setting NSAlignmentBinding of search field to NSCenterTextAlignment broken
- // Broken on 10.5.5 and below.
+ if (major <= 10 && minor <= 5 && bugFix <= 6) {
+ // rdar://5851491 - Setting NSAlignmentBinding of search field to
+ // NSCenterTextAlignment broken
+ // Broken on 10.5.6 and below.
[array addObject:NSAlignmentBinding];
}
// Not KVC Compliant
@@ -504,7 +508,8 @@ BOOL GTMDoExposedBindingsFunctionCorrectly(NSObject *object,
- (NSMutableArray*)gtm_unitTestExposedBindingsToIgnore {
NSMutableArray *array = [super gtm_unitTestExposedBindingsToIgnore];
if ([GTMSystemVersion isBuildLessThanOrEqualTo:kGTMSystemBuild10_6_0_WWDC]) {
- //rdar://5849335 - NSTextView only partially KVC compliant for key NSAttributedStringBinding
+ //rdar://5849335 - NSTextView only partially KVC compliant for key
+ // NSAttributedStringBinding
[array addObject:NSAttributedStringBinding];
}
// Not KVC Compliant
@@ -524,7 +529,8 @@ BOOL GTMDoExposedBindingsFunctionCorrectly(NSObject *object,
- (NSMutableArray*)gtm_unitTestExposedBindingsToIgnore {
NSMutableArray *array = [super gtm_unitTestExposedBindingsToIgnore];
if ([GTMSystemVersion isBuildLessThanOrEqualTo:kGTMSystemBuild10_6_0_WWDC]) {
- // rdar://5849248 - NSTabView exposes binding with no value class for NSSelectedIdentifierBinding
+ // rdar://5849248 - NSTabView exposes binding with no value class
+ // for NSSelectedIdentifierBinding
[array addObject:NSSelectedIdentifierBinding];
}
// Not KVC Compliant
diff --git a/UnitTesting/GTMUnitTestDevLog.h b/UnitTesting/GTMUnitTestDevLog.h
index 55ec44c..d88ef2e 100644
--- a/UnitTesting/GTMUnitTestDevLog.h
+++ b/UnitTesting/GTMUnitTestDevLog.h
@@ -67,4 +67,7 @@
+ (void)resetExpectedLogs;
@end
-
+// Does the same as GTMUnitTestDevLog, but the logs are only expected in debug.
+// ie-the expect requests don't count in release builds.
+@interface GTMUnitTestDevLogDebug : GTMUnitTestDevLog
+@end
diff --git a/UnitTesting/GTMUnitTestDevLog.m b/UnitTesting/GTMUnitTestDevLog.m
index a0c31b3..227eb11 100644
--- a/UnitTesting/GTMUnitTestDevLog.m
+++ b/UnitTesting/GTMUnitTestDevLog.m
@@ -185,3 +185,19 @@ casesOfPattern:(NSString*)format
}
}
@end
+
+
+@implementation GTMUnitTestDevLogDebug
+
++ (void)expect:(NSUInteger)n
+casesOfPattern:(NSString*)format
+ args:(va_list)args {
+#if DEBUG
+ // In debug, let the base work happen
+ [super expect:n casesOfPattern:format args:args];
+#else
+ // nothing when not in debug
+#endif
+}
+
+@end
diff --git a/UnitTesting/TestData/GTMUnitTestingWindow.10.5.6.tiff b/UnitTesting/TestData/GTMUnitTestingWindow.10.5.6.tiff
new file mode 100644
index 0000000..9179576
--- /dev/null
+++ b/UnitTesting/TestData/GTMUnitTestingWindow.10.5.6.tiff
Binary files differ