diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2012-02-21 18:30:10 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2012-02-21 18:30:10 +0000 |
commit | db66b39810ab292ee3914f31a4b961c3bdddd02c (patch) | |
tree | d7c30fc6993f36f096edc86de291f09a18f1323d /UnitTesting | |
parent | 840e30c5fd001d555e6ed75ab6d287cd5863fc09 (diff) |
[Author: thomasvl]
Fix error message to report nil image.
Fix test to use the right bundle, looks like the iOS 5 SDK might have
changed the behavior here and this was working by chance before.
R=dmaclach
DELTA=9 (6 added, 0 deleted, 3 changed)
Diffstat (limited to 'UnitTesting')
-rw-r--r-- | UnitTesting/GTMNSObject+UnitTesting.m | 6 | ||||
-rw-r--r-- | UnitTesting/GTMUIKit+UnitTestingTest.m | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/UnitTesting/GTMNSObject+UnitTesting.m b/UnitTesting/GTMNSObject+UnitTesting.m index 6bbc2e3..f72ba88 100644 --- a/UnitTesting/GTMNSObject+UnitTesting.m +++ b/UnitTesting/GTMNSObject+UnitTesting.m @@ -136,7 +136,11 @@ BOOL GTMIsObjectImageEqualToImageNamed(id object, failString = @"systemSettings not valid for taking image"; // COV_NF_LINE } } else { - failString = @"Object does not conform to GTMUnitTestingImaging protocol"; + if (object == nil) { + failString = @"Testing a nil image."; + } else { + failString = @"Object does not conform to GTMUnitTestingImaging protocol"; + } } if (error) { *error = failString; diff --git a/UnitTesting/GTMUIKit+UnitTestingTest.m b/UnitTesting/GTMUIKit+UnitTestingTest.m index 95bdd5a..4b0387c 100644 --- a/UnitTesting/GTMUIKit+UnitTestingTest.m +++ b/UnitTesting/GTMUIKit+UnitTestingTest.m @@ -42,8 +42,10 @@ - (void)testUIImage { NSString* name = @"GTMUIViewUnitTestingTest"; - UIImage* image = - [UIImage imageNamed:[name stringByAppendingPathExtension:@"png"]]; + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + NSString *imagePath = [bundle pathForResource:name ofType:@"png"]; + STAssertNotNil(imagePath, nil); + UIImage* image = [UIImage imageWithContentsOfFile:imagePath]; GTMAssertObjectImageEqualToImageNamed(image, name, nil); } |