Permalink
Browse files

Added test for UIColor and UIControl category

  • Loading branch information...
1 parent 43b0958 commit d018409032b5df5482f28f23e25b3279facadf4e @soffes soffes committed Apr 15, 2011
Showing with 64 additions and 1 deletion.
  1. +9 −1 SSToolkit.xcodeproj/project.pbxproj
  2. +24 −0 Tests/ColorCategoryTest.m
  3. +31 −0 Tests/ControlCategoryTest.m
@@ -100,6 +100,8 @@
B28219DE12FA8EB500BAF3C6 /* SSRatingPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = B28219DC12FA8EB500BAF3C6 /* SSRatingPicker.m */; };
B28C6D0712FBE5C400667755 /* SSRatingPickerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B28C6D0512FBE5C400667755 /* SSRatingPickerViewController.h */; };
B28C6D0812FBE5C400667755 /* SSRatingPickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B28C6D0612FBE5C400667755 /* SSRatingPickerViewController.m */; };
+ B2A5D4D6135873B300AC4BA7 /* ColorCategoryTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B2A5D4D5135873B300AC4BA7 /* ColorCategoryTest.m */; };
+ B2A5D4DE1358748700AC4BA7 /* ControlCategoryTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B2A5D4DD1358748700AC4BA7 /* ControlCategoryTest.m */; };
B2AAE65C1281B73E0068EE7F /* SSNavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = B2AAE65A1281B73E0068EE7F /* SSNavigationController.h */; };
B2AAE65D1281B73E0068EE7F /* SSNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = B2AAE65B1281B73E0068EE7F /* SSNavigationController.m */; };
B2ABC6921329D14300521D20 /* SSCollectionViewTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = B2ABC6901329D14300521D20 /* SSCollectionViewTableViewCell.h */; };
@@ -129,7 +131,7 @@
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
- remoteGlobalIDString = D2AAC07D0554694100DB518D /* SSToolkit */;
+ remoteGlobalIDString = D2AAC07D0554694100DB518D;
remoteInfo = SSToolkit;
};
/* End PBXContainerItemProxy section */
@@ -231,6 +233,8 @@
B28219DC12FA8EB500BAF3C6 /* SSRatingPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSRatingPicker.m; sourceTree = "<group>"; };
B28C6D0512FBE5C400667755 /* SSRatingPickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSRatingPickerViewController.h; sourceTree = "<group>"; };
B28C6D0612FBE5C400667755 /* SSRatingPickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSRatingPickerViewController.m; sourceTree = "<group>"; };
+ B2A5D4D5135873B300AC4BA7 /* ColorCategoryTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ColorCategoryTest.m; sourceTree = "<group>"; };
+ B2A5D4DD1358748700AC4BA7 /* ControlCategoryTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ControlCategoryTest.m; sourceTree = "<group>"; };
B2AAE65A1281B73E0068EE7F /* SSNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSNavigationController.h; sourceTree = "<group>"; };
B2AAE65B1281B73E0068EE7F /* SSNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSNavigationController.m; sourceTree = "<group>"; };
B2ABC6901329D14300521D20 /* SSCollectionViewTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSCollectionViewTableViewCell.h; sourceTree = "<group>"; };
@@ -334,6 +338,8 @@
isa = PBXGroup;
children = (
B23910BF1357E07A00ADE21B /* ArrayCategoryTest.m */,
+ B2A5D4D5135873B300AC4BA7 /* ColorCategoryTest.m */,
+ B2A5D4DD1358748700AC4BA7 /* ControlCategoryTest.m */,
B23910C11357E08600ADE21B /* DataCategoryTest.m */,
B23910A61357DED300ADE21B /* DateCategoryTest.m */,
B23910A71357DED300ADE21B /* DictionaryCategoryTest.m */,
@@ -688,6 +694,8 @@
B23910C01357E07A00ADE21B /* ArrayCategoryTest.m in Sources */,
B23910C21357E08600ADE21B /* DataCategoryTest.m in Sources */,
B23910C41357E08E00ADE21B /* URLCategoryTest.m in Sources */,
+ B2A5D4D6135873B300AC4BA7 /* ColorCategoryTest.m in Sources */,
+ B2A5D4DE1358748700AC4BA7 /* ControlCategoryTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -0,0 +1,24 @@
+//
+// ColorCategoryTest.m
+// SSToolkit
+//
+// Created by Sam Soffes on 4/15/11.
+// Copyright 2011 Sam Soffes. All rights reserved.
+//
+
+#import <SSToolkit/UIColor+SSToolkitAdditions.h>
+
+@interface ColorCategoryTest : GHTestCase
+@end
+
+@implementation ColorCategoryTest
+
+- (void)testAlpha {
+ UIColor *color = [UIColor blackColor];
+ GHAssertEquals([color alpha], 1.0f, nil);
+
+ color = [UIColor colorWithRed:0.3f green:0.4f blue:0.5f alpha:0.6f];
+ GHAssertEquals([color alpha], 0.6f, nil);
+}
+
+@end
@@ -0,0 +1,31 @@
+//
+// ControlCategoryTest.m
+// SSToolkit
+//
+// Created by Sam Soffes on 4/15/11.
+// Copyright 2011 Sam Soffes. All rights reserved.
+//
+
+#import <SSToolkit/UIControl+SSToolkitAdditions.h>
+
+@interface ControlCategoryTest : GHTestCase
+@end
+
+@implementation ControlCategoryTest
+
+- (void)testRemoveAllTargets {
+ NSString *anotherObject = @"hi";
+
+ UIControl *control = [[UIControl alloc] initWithFrame:CGRectZero];
+ [control addTarget:self action:@selector(description) forControlEvents:UIControlEventTouchUpInside];
+ [control addTarget:anotherObject action:@selector(description) forControlEvents:UIControlEventTouchUpInside];
+
+ NSSet *targets = [NSSet setWithObjects:self, anotherObject, nil];
+ GHAssertEqualObjects([control allTargets], targets, nil);
+
+ [control removeAllTargets];
+
+ GHAssertTrue([[control allTargets] count] == 0, nil);
+}
+
+@end

0 comments on commit d018409

Please sign in to comment.