Skip to content
Browse files

Merge branch 'master' of github.com:gabriel/gh-unit

Conflicts:
	Classes-iOS/GHImageDiffView.m
	Classes-iOS/GHUnitIOSTestView.h
	Classes-iOS/GHUnitIOSTestView.m
	Classes/SharedUI/GHTestViewModel.m
	Libraries/YelpKit/YKUIImageViewControl.m
	Project-iOS/GHUnitIOS.xcodeproj/project.pbxproj
	XcodeConfig/Shared.xcconfig
  • Loading branch information...
2 parents 0530b1a + c1512f6 commit e726c7b2dc9e00a5d0241f2261bd58955cfe11f2 @gabriel gabriel committed
Showing with 233 additions and 291 deletions.
  1. +5 −5 Classes-iOS/GHImageDiffView.h
  2. +24 −21 Classes-iOS/GHImageDiffView.m
  3. +3 −6 Classes-iOS/GHUIImageViewControl.m
  4. +5 −5 Classes-iOS/GHUnitIOSTestView.h
  5. +37 −37 Classes-iOS/GHUnitIOSTestView.m
  6. +14 −14 Classes-iOS/GHUnitIOSTestViewController.m
  7. +13 −13 Classes-iOS/GHUnitIOSViewController.m
  8. +1 −1 Classes/GHTest/GHTest+JUnitXML.m
  9. +9 −0 Classes/GHTestCase.h
  10. +4 −0 Classes/GHTestCase.m
  11. +13 −10 Classes/GHViewTestCase.h
  12. +37 −40 Classes/GHViewTestCase.m
  13. +3 −3 Classes/SharedUI/GHTestViewModel.m
  14. BIN Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/GHUnitIOS
  15. +5 −5 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHImageDiffView.h
  16. +9 −0 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHTestCase.h
  17. +5 −5 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHUnitIOSTestView.h
  18. +13 −10 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHViewTestCase.h
  19. +1 −1 Examples/MyTestable-iOS/MyTestable/MyTestableAppDelegate.h
  20. +3 −3 Examples/MyTestable-iOS/MyTestable/MyTestableAppDelegate.m
  21. +1 −1 Examples/MyTestable-iOS/MyTestable/iPad/MyTestableAppDelegate_iPad.h
  22. +1 −6 Examples/MyTestable-iOS/MyTestable/iPad/MyTestableAppDelegate_iPad.m
  23. +1 −1 Examples/MyTestable-iOS/MyTestable/iPad/MyTestableViewController_iPad.h
  24. +1 −39 Examples/MyTestable-iOS/MyTestable/iPad/MyTestableViewController_iPad.m
  25. +1 −1 Examples/MyTestable-iOS/MyTestable/iPhone/MyTestableAppDelegate_iPhone.h
  26. +1 −6 Examples/MyTestable-iOS/MyTestable/iPhone/MyTestableAppDelegate_iPhone.m
  27. +1 −1 Examples/MyTestable-iOS/MyTestable/iPhone/MyTestableViewController_iPhone.h
  28. +1 −39 Examples/MyTestable-iOS/MyTestable/iPhone/MyTestableViewController_iPhone.m
  29. +1 −2 Examples/MyTestable-iOS/MyTestable/iPhone/MyTestableViewController_iPhone.xib
  30. +1 −1 Examples/MyTestable-iOS/MyTestable/main.m
  31. BIN Examples/MyTestable-iOS/TestImages/MyViewTest-testIPadViewController-0-UIView.png
  32. BIN Examples/MyTestable-iOS/TestImages/MyViewTest-testIPadViewController-1-0-UIView.png
  33. BIN Examples/MyTestable-iOS/TestImages/MyViewTest-testIPhoneViewController-0-UIView.png
  34. BIN Examples/MyTestable-iOS/TestImages/MyViewTest-testIPhoneViewController-1-0-UIView.png
  35. +1 −1 Examples/MyTestable-iOS/Tests/MyViewTest.m
  36. +4 −4 Project-iOS/GHUnitIOS.xcodeproj/project.pbxproj
  37. +13 −10 README.md
  38. +1 −0 Scripts/iOSFramework.sh
View
10 Classes-iOS/GHImageDiffView.h
@@ -33,16 +33,16 @@
UIScrollView *scrollView_;
UISegmentedControl *segmentedControl_;
- UIImageView *originalImageView_;
- UIImageView *newImageView_;
+ UIImageView *savedImageView_;
+ UIImageView *renderedImageView_;
UIImageView *diffImageView_;
}
-- (void)setOriginalImage:(UIImage *)originalImage newImage:(UIImage *)newImage diffImage:(UIImage *)diffImage;
+- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage diffImage:(UIImage *)diffImage;
-- (void)showOriginalImage;
+- (void)showSavedImage;
-- (void)showNewImage;
+- (void)showRenderedImage;
- (void)showDiffImage;
View
45 Classes-iOS/GHImageDiffView.m
@@ -39,17 +39,17 @@ - (id)initWithFrame:(CGRect)frame {
[self addSubview:scrollView_];
segmentedControl_ = [[UISegmentedControl alloc] initWithFrame:CGRectZero];
- [segmentedControl_ insertSegmentWithTitle:@"Original" atIndex:0 animated:NO];
+ [segmentedControl_ insertSegmentWithTitle:@"Saved" atIndex:0 animated:NO];
[segmentedControl_ insertSegmentWithTitle:@"New" atIndex:1 animated:NO];
[segmentedControl_ insertSegmentWithTitle:@"Diff" atIndex:2 animated:NO];
[segmentedControl_ addTarget:self action:@selector(segmentedControlDidChange:) forControlEvents:UIControlEventValueChanged];
[self addSubview:segmentedControl_];
- originalImageView_ = [[UIImageView alloc] initWithFrame:CGRectZero];
- [scrollView_ addSubview:originalImageView_];
+ savedImageView_ = [[UIImageView alloc] initWithFrame:CGRectZero];
+ [scrollView_ addSubview:savedImageView_];
- newImageView_ = [[UIImageView alloc] initWithFrame:CGRectZero];
- [scrollView_ addSubview:newImageView_];
+ renderedImageView_ = [[UIImageView alloc] initWithFrame:CGRectZero];
+ [scrollView_ addSubview:renderedImageView_];
diffImageView_ = [[UIImageView alloc] initWithFrame:CGRectZero];
[scrollView_ addSubview:diffImageView_];
@@ -64,33 +64,36 @@ - (void)layoutSubviews {
segmentedControl_.frame = CGRectMake((self.frame.size.width - 300) / 2, self.frame.size.height - 40, 300, 30);
}
-- (void)setOriginalImage:(UIImage *)originalImage newImage:(UIImage *)newImage diffImage:(UIImage *)diffImage {
- originalImageView_.image = originalImage;
- [originalImageView_ sizeToFit];
- newImageView_.image = newImage;
- [newImageView_ sizeToFit];
+- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage diffImage:(UIImage *)diffImage {
+ savedImageView_.image = savedImage;
+ [savedImageView_ sizeToFit];
+ [segmentedControl_ setEnabled:!!savedImage forSegmentAtIndex:0];
+ renderedImageView_.image = renderedImage;
+ [renderedImageView_ sizeToFit];
+ [segmentedControl_ setEnabled:!!renderedImage forSegmentAtIndex:1];
diffImageView_.image = diffImage;
[diffImageView_ sizeToFit];
- scrollView_.contentSize = CGSizeMake(MAX(originalImage.size.width, newImage.size.width), MAX(originalImage.size.height, newImage.size.height));
+ [segmentedControl_ setEnabled:!!diffImage forSegmentAtIndex:2];
+ scrollView_.contentSize = CGSizeMake(MAX(savedImage.size.width, renderedImage.size.width), MAX(savedImage.size.height, renderedImage.size.height));
}
-- (void)showOriginalImage {
- originalImageView_.hidden = NO;
- newImageView_.hidden = YES;
+- (void)showSavedImage {
+ savedImageView_.hidden = NO;
+ renderedImageView_.hidden = YES;
diffImageView_.hidden = YES;
segmentedControl_.selectedSegmentIndex = 0;
}
-- (void)showNewImage {
- originalImageView_.hidden = YES;
- newImageView_.hidden = NO;
+- (void)showRenderedImage {
+ savedImageView_.hidden = YES;
+ renderedImageView_.hidden = NO;
diffImageView_.hidden = YES;
segmentedControl_.selectedSegmentIndex = 1;
}
- (void)showDiffImage {
- originalImageView_.hidden = YES;
- newImageView_.hidden = YES;
+ savedImageView_.hidden = YES;
+ renderedImageView_.hidden = YES;
diffImageView_.hidden = NO;
segmentedControl_.selectedSegmentIndex = 2;
}
@@ -98,8 +101,8 @@ - (void)showDiffImage {
#pragma mark UISegmentedControl
- (void)segmentedControlDidChange:(UISegmentedControl *)segmentedControl {
- if (segmentedControl.selectedSegmentIndex == 0) [self showOriginalImage];
- else if (segmentedControl.selectedSegmentIndex == 1) [self showNewImage];
+ if (segmentedControl.selectedSegmentIndex == 0) [self showSavedImage];
+ else if (segmentedControl.selectedSegmentIndex == 1) [self showRenderedImage];
else if (segmentedControl.selectedSegmentIndex == 2) [self showDiffImage];
}
View
9 Classes-iOS/GHUIImageViewControl.m
@@ -32,6 +32,7 @@
@implementation GHUIImageViewControl
+@dynamic image;
@synthesize imageView=_imageView;
- (id)initWithFrame:(CGRect)frame {
@@ -60,12 +61,8 @@ - (void)setHighlighted:(BOOL)highlighted {
_imageView.highlighted = highlighted;
}
-- (UIImage *)image {
- return _imageView.image;
-}
-
-- (void)setImage:(UIImage *)image {
- _imageView.image = image;
+- (id)forwardingTargetForSelector:(SEL)aSelector {
+ return _imageView;
}
@end
View
10 Classes-iOS/GHUnitIOSTestView.h
@@ -33,8 +33,8 @@
@class GHUnitIOSTestView;
@protocol GHUnitIOSTestViewDelegate <NSObject>
-- (void)testViewDidSelectOriginalImage:(GHUnitIOSTestView *)testView;
-- (void)testViewDidSelectNewImage:(GHUnitIOSTestView *)testView;
+- (void)testViewDidSelectSavedImage:(GHUnitIOSTestView *)testView;
+- (void)testViewDidSelectRenderedImage:(GHUnitIOSTestView *)testView;
- (void)testViewDidApproveChange:(GHUnitIOSTestView *)testView;
@end
@@ -43,8 +43,8 @@
// TODO(johnb): Perhaps hold a scrollview here as subclassing UIViews can be weird.
- GHUIImageViewControl *originalImageView_;
- GHUIImageViewControl *newImageView_;
+ GHUIImageViewControl *savedImageView_;
+ GHUIImageViewControl *renderedImageView_;
UIButton *approveButton_;
@@ -52,7 +52,7 @@
}
@property(unsafe_unretained, nonatomic) id<GHUnitIOSTestViewDelegate> controlDelegate;
-- (void)setOriginalImage:(UIImage *)originalImage newImage:(UIImage *)newImage text:(NSString *)text;
+- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage text:(NSString *)text;
- (void)setText:(NSString *)text;
View
74 Classes-iOS/GHUnitIOSTestView.m
@@ -44,19 +44,19 @@ - (id)initWithFrame:(CGRect)frame {
textLabel_.numberOfLines = 0;
[self addSubview:textLabel_];
- originalImageView_ = [[GHUIImageViewControl alloc] initWithFrame:CGRectMake(10, 10, 145, 100)];
- [originalImageView_ addTarget:self action:@selector(_selectOriginalImage) forControlEvents:UIControlEventTouchUpInside];
- [originalImageView_.layer setBorderWidth:2.0f];
- [originalImageView_.layer setBorderColor:[UIColor blackColor].CGColor];
- originalImageView_.hidden = YES;
- [self addSubview:originalImageView_];
-
- newImageView_ = [[GHUIImageViewControl alloc] initWithFrame:CGRectMake(165, 10, 145, 100)];
- [newImageView_ addTarget:self action:@selector(_selectNewImage) forControlEvents:UIControlEventTouchUpInside];
- [newImageView_.layer setBorderWidth:2.0f];
- [newImageView_.layer setBorderColor:[UIColor blackColor].CGColor];
- newImageView_.hidden = YES;
- [self addSubview:newImageView_];
+ savedImageView_ = [[GHUIImageViewControl alloc] initWithFrame:CGRectMake(10, 10, 145, 100)];
+ [savedImageView_ addTarget:self action:@selector(_selectSavedImage) forControlEvents:UIControlEventTouchUpInside];
+ [savedImageView_.layer setBorderWidth:2.0];
+ [savedImageView_.layer setBorderColor:[UIColor blackColor].CGColor];
+ savedImageView_.hidden = YES;
+ [self addSubview:savedImageView_];
+
+ renderedImageView_ = [[GHUIImageViewControl alloc] initWithFrame:CGRectMake(165, 10, 145, 100)];
+ [renderedImageView_ addTarget:self action:@selector(_selectRenderedImage) forControlEvents:UIControlEventTouchUpInside];
+ [renderedImageView_.layer setBorderWidth:2.0];
+ [renderedImageView_.layer setBorderColor:[UIColor blackColor].CGColor];
+ renderedImageView_.hidden = YES;
+ [self addSubview:renderedImageView_];
approveButton_ = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[approveButton_ addTarget:self action:@selector(_approveChange) forControlEvents:UIControlEventTouchUpInside];
@@ -74,29 +74,29 @@ - (id)initWithFrame:(CGRect)frame {
*/
- (void)_layout {
CGFloat y = 10;
- CGRect originalImageFrame = CGRectZero;
- CGRect newImageFrame = CGRectZero;
+ CGRect savedImageFrame = CGRectZero;
+ CGRect renderedImageFrame = CGRectZero;
CGRect textLabelFrame = textLabel_.frame;
textLabelFrame.size.height = [textLabel_.text sizeWithFont:textLabel_.font constrainedToSize:CGSizeMake(textLabel_.frame.size.width, 10000) lineBreakMode:UILineBreakModeWordWrap].height;
textLabel_.frame = textLabelFrame;
- if (originalImageView_.image && !originalImageView_.hidden) {
+ if (savedImageView_.image && !savedImageView_.hidden) {
// Adjust image views to their sizes, maintaining constant width
- CGFloat aspectRatio = originalImageView_.image.size.height / originalImageView_.image.size.width;
- originalImageFrame = originalImageView_.frame;
- originalImageFrame.size.height = aspectRatio * originalImageFrame.size.width;
- originalImageView_.frame = originalImageFrame;
+ CGFloat aspectRatio = savedImageView_.image.size.height / savedImageView_.image.size.width;
+ savedImageFrame = savedImageView_.frame;
+ savedImageFrame.size.height = aspectRatio * savedImageFrame.size.width;
+ savedImageView_.frame = savedImageFrame;
}
- if (newImageView_.image && !newImageView_.hidden) {
- CGFloat aspectRatio = newImageView_.image.size.height / newImageView_.image.size.width;
- newImageFrame = newImageView_.frame;
- newImageFrame.size.height = aspectRatio * newImageFrame.size.width;
- newImageView_.frame = newImageFrame;
+ if (renderedImageView_.image && !renderedImageView_.hidden) {
+ CGFloat aspectRatio = renderedImageView_.image.size.height / renderedImageView_.image.size.width;
+ renderedImageFrame = renderedImageView_.frame;
+ renderedImageFrame.size.height = aspectRatio * renderedImageFrame.size.width;
+ renderedImageView_.frame = renderedImageFrame;
}
- y += MAX(originalImageFrame.size.height, newImageFrame.size.height) + 10;
+ y += roundf(MAX(savedImageFrame.size.height, renderedImageFrame.size.height) + 10);
if (!approveButton_.hidden) {
approveButton_.frame = CGRectMake(10, y, 300, 30);
@@ -110,31 +110,31 @@ - (void)_layout {
self.contentSize = CGSizeMake(self.frame.size.width, textViewFrame.origin.y + textViewFrame.size.height + 10);
}
-- (void)_selectOriginalImage {
- [controlDelegate_ testViewDidSelectOriginalImage:self];
+- (void)_selectSavedImage {
+ [controlDelegate_ testViewDidSelectSavedImage:self];
}
-- (void)_selectNewImage {
- [controlDelegate_ testViewDidSelectNewImage:self];
+- (void)_selectRenderedImage {
+ [controlDelegate_ testViewDidSelectRenderedImage:self];
}
- (void)_approveChange {
[controlDelegate_ testViewDidApproveChange:self];
}
-- (void)setOriginalImage:(UIImage *)originalImage newImage:(UIImage *)newImage text:(NSString *)text {
- originalImageView_.image = originalImage;
- originalImageView_.hidden = originalImage ? NO : YES;
- newImageView_.image = newImage;
- newImageView_.hidden = NO;
+- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage text:(NSString *)text {
+ savedImageView_.image = savedImage;
+ savedImageView_.hidden = savedImage ? NO : YES;
+ renderedImageView_.image = renderedImage;
+ renderedImageView_.hidden = NO;
approveButton_.hidden = NO;
textLabel_.text = text;
[self _layout];
}
- (void)setText:(NSString *)text {
- originalImageView_.hidden = YES;
- newImageView_.hidden = YES;
+ savedImageView_.hidden = YES;
+ renderedImageView_.hidden = YES;
approveButton_.hidden = YES;
textLabel_.text = text;
[self _layout];
View
28 Classes-iOS/GHUnitIOSTestViewController.m
@@ -62,10 +62,10 @@ - (void)_runTest {
- (void)_showImageDiff {
if (!imageDiffView_) imageDiffView_ = [[GHImageDiffView alloc] initWithFrame:CGRectZero];
- UIImage *originalImage = [testNode_.test.exception.userInfo objectForKey:@"OriginalImage"];
- UIImage *newImage = [testNode_.test.exception.userInfo objectForKey:@"NewImage"];
+ UIImage *savedImage = [testNode_.test.exception.userInfo objectForKey:@"SavedImage"];
+ UIImage *renderedImage = [testNode_.test.exception.userInfo objectForKey:@"RenderedImage"];
UIImage *diffImage = [testNode_.test.exception.userInfo objectForKey:@"DiffImage"];
- [imageDiffView_ setOriginalImage:originalImage newImage:newImage diffImage:diffImage];
+ [imageDiffView_ setSavedImage:savedImage renderedImage:renderedImage diffImage:diffImage];
UIViewController *viewController = [[UIViewController alloc] init];
viewController.view = imageDiffView_;
[self.navigationController pushViewController:viewController animated:YES];
@@ -80,13 +80,13 @@ - (NSString *)updateTestView {
if (stackTrace) [text appendFormat:@"\n%@\n", stackTrace];
if ([testNode_.test.exception.name isEqualToString:@"GHViewChangeException"]) {
NSDictionary *exceptionUserInfo = testNode_.test.exception.userInfo;
- UIImage *originalImage = [exceptionUserInfo objectForKey:@"OriginalImage"];
- UIImage *newImage = [exceptionUserInfo objectForKey:@"NewImage"];
- [testView_ setOriginalImage:originalImage newImage:newImage text:text];
+ UIImage *savedImage = [exceptionUserInfo objectForKey:@"SavedImage"];
+ UIImage *renderedImage = [exceptionUserInfo objectForKey:@"RenderedImage"];
+ [testView_ setSavedImage:savedImage renderedImage:renderedImage text:text];
} else if ([testNode_.test.exception.name isEqualToString:@"GHViewUnavailableException"]) {
NSDictionary *exceptionUserInfo = testNode_.test.exception.userInfo;
- UIImage *newImage = [exceptionUserInfo objectForKey:@"NewImage"];
- [testView_ setOriginalImage:nil newImage:newImage text:text];
+ UIImage *renderedImage = [exceptionUserInfo objectForKey:@"RenderedImage"];
+ [testView_ setSavedImage:nil renderedImage:renderedImage text:text];
} else {
[testView_ setText:text];
}
@@ -104,21 +104,21 @@ - (void)setTest:(id<GHTest>)test {
#pragma mark Delegates (GHUnitIOSTestView)
-- (void)testViewDidSelectOriginalImage:(GHUnitIOSTestView *)testView {
+- (void)testViewDidSelectSavedImage:(GHUnitIOSTestView *)testView {
[self _showImageDiff];
- [imageDiffView_ showOriginalImage];
+ [imageDiffView_ showSavedImage];
}
-- (void)testViewDidSelectNewImage:(GHUnitIOSTestView *)testView {
+- (void)testViewDidSelectRenderedImage:(GHUnitIOSTestView *)testView {
[self _showImageDiff];
- [imageDiffView_ showNewImage];
+ [imageDiffView_ showRenderedImage];
}
- (void)testViewDidApproveChange:(GHUnitIOSTestView *)testView {
// Save new image as the approved version
NSString *imageFilename = [testNode_.test.exception.userInfo objectForKey:@"ImageFilename"];
- UIImage *newImage = [testNode_.test.exception.userInfo objectForKey:@"NewImage"];
- [GHViewTestCase saveToDocumentsWithImage:newImage filename:imageFilename];
+ UIImage *renderedImage = [testNode_.test.exception.userInfo objectForKey:@"RenderedImage"];
+ [GHViewTestCase saveToDocumentsWithImage:renderedImage filename:imageFilename];
[self _runTest];
}
View
26 Classes-iOS/GHUnitIOSViewController.m
@@ -29,12 +29,12 @@
#import "GHUnitIOSViewController.h"
-NSString *const GHUnitPrefixKey = @"Prefix";
+NSString *const GHUnitTextFilterKey = @"TextFilter";
NSString *const GHUnitFilterKey = @"Filter";
@interface GHUnitIOSViewController ()
-- (NSString *)_prefix;
-- (void)_setPrefix:(NSString *)prefix;
+- (NSString *)_textFilter;
+- (void)_setTextFilter:(NSString *)textFilter;
- (void)_setFilterIndex:(NSInteger)index;
- (NSInteger)_filterIndex;
@end
@@ -74,8 +74,8 @@ - (void)loadView {
view_ = [[GHUnitIOSView alloc] initWithFrame:CGRectMake(0, 0, 320, 344)];
view_.searchBar.delegate = self;
- NSString *prefix = [self _prefix];
- if (prefix) view_.searchBar.text = prefix;
+ NSString *textFilter = [self _textFilter];
+ if (textFilter) view_.searchBar.text = textFilter;
view_.filterControl.selectedSegmentIndex = [self _filterIndex];
[view_.filterControl addTarget:self action:@selector(_filterChanged:) forControlEvents:UIControlEventValueChanged];
view_.tableView.delegate = self;
@@ -93,7 +93,7 @@ - (GHUnitIOSTableViewDataSource *)dataSource {
}
- (void)reload {
- [self.dataSource.root setTextFilter:[self _prefix]];
+ [self.dataSource.root setTextFilter:[self _textFilter]];
[self.dataSource.root setFilter:[self _filterIndex]];
[view_.tableView reloadData];
}
@@ -127,12 +127,12 @@ - (void)_exit {
#pragma mark Properties
-- (NSString *)_prefix {
- return [[NSUserDefaults standardUserDefaults] objectForKey:GHUnitPrefixKey];
+- (NSString *)_textFilter {
+ return [[NSUserDefaults standardUserDefaults] objectForKey:GHUnitTextFilterKey];
}
-- (void)_setPrefix:(NSString *)prefix {
- [[NSUserDefaults standardUserDefaults] setObject:prefix forKey:GHUnitPrefixKey];
+- (void)_setTextFilter:(NSString *)textFilter {
+ [[NSUserDefaults standardUserDefaults] setObject:textFilter forKey:GHUnitTextFilterKey];
[[NSUserDefaults standardUserDefaults] synchronize];
}
@@ -289,8 +289,8 @@ - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
[self searchBarSearchButtonClicked:searchBar];
return;
}
- NSString *prefix = [self _prefix];
- searchBar.text = (prefix ? prefix : @"");
+ NSString *textFilter = [self _textFilter];
+ searchBar.text = (textFilter ? textFilter : @"");
[searchBar resignFirstResponder];
[searchBar setShowsCancelButton:NO animated:YES];
}
@@ -299,7 +299,7 @@ - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
[searchBar resignFirstResponder];
[searchBar setShowsCancelButton:NO animated:YES];
- [self _setPrefix:searchBar.text];
+ [self _setTextFilter:searchBar.text];
[self reload];
}
View
2 Classes/GHTest/GHTest+JUnitXML.m
@@ -38,7 +38,7 @@ @implementation GHTest(JUnitXML)
- (NSString *)JUnitXML {
return [NSString stringWithFormat:
@"<testcase name=\"%@\" classname=\"%@\" time=\"%0.4f\">%@</testcase>",
- self.name, [self class], self.interval,
+ self.name, [self.target class], self.interval,
(self.exception ? [NSString stringWithFormat:@"<failure message=\"%@\">%@</failure>", [[self.exception description] gtm_stringBySanitizingAndEscapingForXML],
[[GHTesting descriptionForException:self.exception] gtm_stringBySanitizingAndEscapingForXML]] : @"")];
}
View
9 Classes/GHTestCase.h
@@ -149,4 +149,13 @@
*/
- (void)log:(NSString *)message;
+/*!
+ Whether the test class should be run as a part of command line tests.
+ By default this is NO. Subclasses can override this method to disable
+ test classes that are problematic at the command line.
+
+ @result YES if this test class is disabled for command line tests
+ */
+- (BOOL)isCLIDisabled;
+
@end
View
4 Classes/GHTestCase.m
@@ -54,6 +54,10 @@ - (void)handleException:(NSException *)exception {
NSLog(@"%@", [GHTesting descriptionForException:exception]);
}
+- (BOOL)isCLIDisabled {
+ return NO;
+}
+
#pragma mark Logging
- (void)log:(NSString *)message {
View
23 Classes/GHViewTestCase.h
@@ -71,7 +71,19 @@ reason:@"GHVerifyView can only be called from within a GHViewTestCase class"] ra
After changes to views are approved in the simulator, the CopyTestImages.sh script
should be run manually in Terminal. This script copies any approved view changes
- back to the project directory.
+ back to the project directory. Images are saved with filenames of the following format:
+
+ [test class name]-[test selector name]-[UIScreen scale]-[# of call to GHVerifyView in selector]-[view class name].png
+
+ Note that because of differences in text rendering between retina and non-retina
+ devices/simulators, different images are saved for test runs using retina then
+ non-retina.
+
+ Also note that there are commonly rendering differences across iOS versions.
+ Therefore it is common for tests to fail when they are run using a different iOS
+ version then the one that created the saved test image. This also applies to tests
+ that are run at the command line (the xcodebuild flag '-sdk iphonesimulator'
+ usually corresponds to the latest iOS simulator available).
*/
@interface GHViewTestCase : GHTestCase {
NSInteger imageVerifyCount_;
@@ -91,15 +103,6 @@ reason:@"GHVerifyView can only be called from within a GHViewTestCase class"] ra
+ (void)saveToDocumentsWithImage:(UIImage *)image filename:(NSString *)filename;
/*!
- Whether the test class should be run as a part of command line tests.
- By default this is YES since there are some small differences in rendering
- from the command line vs rendering in the simulator
-
- @result YES if this test class is disabled for command line tests
- */
-- (BOOL)isCLIDisabled;
-
-/*!
Size for a given view. Subclasses can override this to provide custom sizes
for views before rendering. The default implementation returns contentSize
for scrollviews and returns self.frame.size for all other views.
View
77 Classes/GHViewTestCase.m
@@ -41,7 +41,7 @@ + (NSString *)pathForFilename:(NSString *)filename;
+ (void)createImagesDirectory;
+ (UIImage *)imageWithView:(UIView *)view;
+ (UIImage *)readImageWithFilename:(NSString *)name;
-+ (BOOL)compareImage:(UIImage *)image withNewImage:(UIImage *)newImage;
++ (BOOL)compareImage:(UIImage *)image withRenderedImage:(UIImage *)renderedImage;
@end
@implementation GHViewTestCase
@@ -108,18 +108,18 @@ + (void)clearTestImages {
}
}
-+ (BOOL)compareImage:(UIImage *)image withNewImage:(UIImage *)newImage {
- if (!image || !newImage) return NO;
++ (BOOL)compareImage:(UIImage *)image withRenderedImage:(UIImage *)renderedImage {
+ if (!image || !renderedImage) return NO;
// If the images are different sizes, just fail
- if ((image.size.width != newImage.size.width) || (image.size.height != newImage.size.height)) {
+ if ((image.size.width != renderedImage.size.width) || (image.size.height != renderedImage.size.height)) {
GHUDebug(@"Images are differnt sizes");
return NO;
}
// Allocate a buffer big enough to hold all the pixels
GHPixel *imagePixels = (GHPixel *) calloc(1, image.size.width * image.size.height * sizeof(GHPixel));
- GHPixel *newImagePixels = (GHPixel *) calloc(1, image.size.width * image.size.height * sizeof(GHPixel));
+ GHPixel *renderedImagePixels = (GHPixel *) calloc(1, image.size.width * image.size.height * sizeof(GHPixel));
- if (!imagePixels || !newImagePixels) {
+ if (!imagePixels || !renderedImagePixels) {
GHUDebug(@"Unable to create pixel array for image comparieson.");
return NO;
}
@@ -131,54 +131,54 @@ + (BOOL)compareImage:(UIImage *)image withNewImage:(UIImage *)newImage {
CGImageGetColorSpace(image.CGImage),
kCGImageAlphaPremultipliedLast
);
- CGContextRef newImageContext = CGBitmapContextCreate((void *)newImagePixels,
- newImage.size.width,
- newImage.size.height,
+ CGContextRef renderedImageContext = CGBitmapContextCreate((void *)renderedImagePixels,
+ renderedImage.size.width,
+ renderedImage.size.height,
8,
- newImage.size.width * 4,
- CGImageGetColorSpace(newImage.CGImage),
+ renderedImage.size.width * 4,
+ CGImageGetColorSpace(renderedImage.CGImage),
kCGImageAlphaPremultipliedLast
);
- if (!imageContext || !newImageContext) {
+ if (!imageContext || !renderedImageContext) {
GHUDebug(@"Unable to create image contexts for image comparison");
CGContextRelease(imageContext);
- CGContextRelease(newImageContext);
+ CGContextRelease(renderedImageContext);
return NO;
}
// Draw the image in the bitmap
CGContextDrawImage(imageContext, CGRectMake(0.0f, 0.0f, image.size.width, image.size.height), image.CGImage);
- CGContextDrawImage(newImageContext, CGRectMake(0.0f, 0.0f, newImage.size.width, newImage.size.height), newImage.CGImage);
+ CGContextDrawImage(renderedImageContext, CGRectMake(0.0f, 0.0f, renderedImage.size.width, renderedImage.size.height), renderedImage.CGImage);
for (int x = 0; x < image.size.width; x++) {
for (int y = 0; y < image.size.height; y++) {
NSInteger pixelIndex = x * y;
- if ((imagePixels[pixelIndex].r != newImagePixels[pixelIndex].r)
- || (imagePixels[pixelIndex].g != newImagePixels[pixelIndex].g)
- || (imagePixels[pixelIndex].b != newImagePixels[pixelIndex].b)) {
+ if ((imagePixels[pixelIndex].r != renderedImagePixels[pixelIndex].r)
+ || (imagePixels[pixelIndex].g != renderedImagePixels[pixelIndex].g)
+ || (imagePixels[pixelIndex].b != renderedImagePixels[pixelIndex].b)) {
NSLog(@"Image was different at pixel (%d, %d). Old was (r%d, g%d, b%d), new was (r%d, g%d, b%d)", x, y,
imagePixels[pixelIndex].r, imagePixels[pixelIndex].g, imagePixels[pixelIndex].b,
- newImagePixels[pixelIndex].r, newImagePixels[pixelIndex].g, newImagePixels[pixelIndex].b);
+ renderedImagePixels[pixelIndex].r, renderedImagePixels[pixelIndex].g, renderedImagePixels[pixelIndex].b);
CGContextRelease(imageContext);
- CGContextRelease(newImageContext);
+ CGContextRelease(renderedImageContext);
free(imagePixels);
- free(newImagePixels);
+ free(renderedImagePixels);
return NO;
}
}
}
CGContextRelease(imageContext);
- CGContextRelease(newImageContext);
+ CGContextRelease(renderedImageContext);
free(imagePixels);
- free(newImagePixels);
+ free(renderedImagePixels);
return YES;
}
-+ (UIImage *)diffWithImage:(UIImage *)image newImage:(UIImage *)newImage {
- if (!image || !newImage) return nil;
++ (UIImage *)diffWithImage:(UIImage *)image renderedImage:(UIImage *)renderedImage {
+ if (!image || !renderedImage) return nil;
// Use the largest size and width
- CGSize imageSize = CGSizeMake(MAX(image.size.width, newImage.size.width), MAX(image.size.height, newImage.size.height));
+ CGSize imageSize = CGSizeMake(MAX(image.size.width, renderedImage.size.width), MAX(image.size.height, renderedImage.size.height));
UIGraphicsBeginImageContext(imageSize);
CGContextRef context = UIGraphicsGetCurrentContext();
@@ -187,7 +187,7 @@ + (UIImage *)diffWithImage:(UIImage *)image newImage:(UIImage *)newImage {
// Overlay the new image inverted and at half alpha
CGContextSetAlpha(context, 0.5f);
CGContextBeginTransparencyLayer(context, NULL);
- [newImage drawInRect:CGRectMake(0, 0, newImage.size.width, newImage.size.height)];
+ [renderedImage drawInRect:CGRectMake(0, 0, renderedImage.size.width, renderedImage.size.height)];
CGContextSetBlendMode(context, kCGBlendModeDifference);
CGContextSetFillColorWithColor(context,[UIColor whiteColor].CGColor);
CGContextFillRect(context, CGRectMake(0, 0, image.size.width, image.size.height));
@@ -197,18 +197,10 @@ + (UIImage *)diffWithImage:(UIImage *)image newImage:(UIImage *)newImage {
return returnImage;
}
-
- (void)_setUp {
imageVerifyCount_ = 0;
}
-- (BOOL)isCLIDisabled {
- // There seem to be some weird text rendering inconsistencies when views are rendered
- // when run from the command line, vs when views are rendered in the simulator. For now
- // We're only supporting tests in the simulator.
- return YES;
-}
-
- (CGSize)sizeForView:(UIView *)view {
// If the view is a UIScrollView, return the contentSize
if ([view isKindOfClass:[UIScrollView class]]) {
@@ -224,8 +216,13 @@ - (void)verifyView:(UIView *)view filename:(NSString *)filename lineNumber:(int)
// Fail if the view has CGSizeZero
if (CGSizeEqualToSize(view.frame.size, CGSizeZero)) [[NSException ghu_failureInFile:filename atLine:lineNumber withDescription:@"View must have a nonzero size in GHVerifyView"] raise];
- // View testing file names have the format [test class name]-[test selector name]-[# of verify in selector]-[view class name]
- NSString *imageFilename = [NSString stringWithFormat:@"%@-%@-%d-%@.png", NSStringFromClass([self class]), NSStringFromSelector(currentSelector_), imageVerifyCount_, NSStringFromClass([view class])];
+ // View testing file names have the format [test class name]-[test selector name]-[UIScreen scale]-[# of verify in selector]-[view class name]
+ NSString *imageFilename = [NSString stringWithFormat:@"%@-%@-%1.0f-%d-%@.png",
+ NSStringFromClass([self class]),
+ NSStringFromSelector(currentSelector_),
+ [[UIScreen mainScreen] scale],
+ imageVerifyCount_,
+ NSStringFromClass([view class])];
UIImage *originalViewImage = [[self class] readImageWithFilename:imageFilename];
CGSize viewSize = [self sizeForView:view];
@@ -233,7 +230,7 @@ - (void)verifyView:(UIView *)view filename:(NSString *)filename lineNumber:(int)
UIImage *newViewImage = [[self class] imageWithView:view];
NSMutableDictionary *exceptionDictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
- newViewImage, @"NewImage",
+ newViewImage, @"RenderedImage",
imageFilename, @"ImageFilename",
[NSNumber numberWithInteger:lineNumber], GHTestLineNumberKey,
filename, GHTestFilenameKey,
@@ -241,10 +238,10 @@ - (void)verifyView:(UIView *)view filename:(NSString *)filename lineNumber:(int)
if (!originalViewImage) {
GHUDebug(@"No image available for filename %@", filename);
[[NSException exceptionWithName:@"GHViewUnavailableException" reason:@"No image saved for view" userInfo:exceptionDictionary] raise];
- } else if (![[self class] compareImage:originalViewImage withNewImage:newViewImage]) {
- UIImage *diffImage = [[self class] diffWithImage:originalViewImage newImage:newViewImage];
+ } else if (![[self class] compareImage:originalViewImage withRenderedImage:newViewImage]) {
+ UIImage *diffImage = [[self class] diffWithImage:originalViewImage renderedImage:newViewImage];
[exceptionDictionary setObject:diffImage forKey:@"DiffImage"];
- [exceptionDictionary setObject:originalViewImage forKey:@"OriginalImage"];
+ [exceptionDictionary setObject:originalViewImage forKey:@"SavedImage"];
[[NSException exceptionWithName:@"GHViewChangeException" reason:@"View has changed" userInfo:exceptionDictionary] raise];
}
imageVerifyCount_++;
View
6 Classes/SharedUI/GHTestViewModel.m
@@ -243,7 +243,7 @@ - (void)_applyFilters {
for(GHTestNode *childNode in children_) {
[childNode setTextFilter:textFilter_];
if (textFilter_) {
- if ([self.name hasPrefix:textFilter_] || [childNode.name hasPrefix:textFilter_] || [childNode hasChildren])
+ if (([self.name rangeOfString:textFilter_].location != NSNotFound) || ([childNode.name rangeOfString:textFilter_].location != NSNotFound) || [childNode hasChildren])
[textFiltered addObject:childNode];
}
}
@@ -259,8 +259,8 @@ - (void)_applyFilters {
filteredChildren_ = [NSMutableArray array];
for(GHTestNode *childNode in children_) {
- if ((!textFilter_ || [textFiltered containsObject:childNode]) &&
- ((filter_ == GHTestNodeFilterNone || [filtered containsObject:childNode]) || [childNode hasChildren])) {
+ if (((!textFilter_ || [textFiltered containsObject:childNode]) &&
+ (filter_ == GHTestNodeFilterNone || [filtered containsObject:childNode])) || [childNode hasChildren]) {
[filteredChildren_ addObject:childNode];
if (![childNode hasChildren]) {
[childNode.test setDisabled:NO];
View
BIN Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/GHUnitIOS
Binary file not shown.
View
10 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHImageDiffView.h
@@ -33,16 +33,16 @@
UIScrollView *scrollView_;
UISegmentedControl *segmentedControl_;
- UIImageView *originalImageView_;
- UIImageView *newImageView_;
+ UIImageView *savedImageView_;
+ UIImageView *renderedImageView_;
UIImageView *diffImageView_;
}
-- (void)setOriginalImage:(UIImage *)originalImage newImage:(UIImage *)newImage diffImage:(UIImage *)diffImage;
+- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage diffImage:(UIImage *)diffImage;
-- (void)showOriginalImage;
+- (void)showSavedImage;
-- (void)showNewImage;
+- (void)showRenderedImage;
- (void)showDiffImage;
View
9 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHTestCase.h
@@ -149,4 +149,13 @@
*/
- (void)log:(NSString *)message;
+/*!
+ Whether the test class should be run as a part of command line tests.
+ By default this is NO. Subclasses can override this method to disable
+ test classes that are problematic at the command line.
+
+ @result YES if this test class is disabled for command line tests
+ */
+- (BOOL)isCLIDisabled;
+
@end
View
10 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHUnitIOSTestView.h
@@ -33,8 +33,8 @@
@class GHUnitIOSTestView;
@protocol GHUnitIOSTestViewDelegate <NSObject>
-- (void)testViewDidSelectOriginalImage:(GHUnitIOSTestView *)testView;
-- (void)testViewDidSelectNewImage:(GHUnitIOSTestView *)testView;
+- (void)testViewDidSelectSavedImage:(GHUnitIOSTestView *)testView;
+- (void)testViewDidSelectRenderedImage:(GHUnitIOSTestView *)testView;
- (void)testViewDidApproveChange:(GHUnitIOSTestView *)testView;
@end
@@ -43,8 +43,8 @@
// TODO(johnb): Perhaps hold a scrollview here as subclassing UIViews can be weird.
- YKUIImageViewControl *originalImageView_;
- YKUIImageViewControl *newImageView_;
+ YKUIImageViewControl *savedImageView_;
+ YKUIImageViewControl *renderedImageView_;
UIButton *approveButton_;
@@ -52,7 +52,7 @@
}
@property(assign, nonatomic) id<GHUnitIOSTestViewDelegate> controlDelegate;
-- (void)setOriginalImage:(UIImage *)originalImage newImage:(UIImage *)newImage text:(NSString *)text;
+- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage text:(NSString *)text;
- (void)setText:(NSString *)text;
View
23 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHViewTestCase.h
@@ -71,7 +71,19 @@ reason:@"GHVerifyView can only be called from within a GHViewTestCase class"] ra
After changes to views are approved in the simulator, the CopyTestImages.sh script
should be run manually in Terminal. This script copies any approved view changes
- back to the project directory.
+ back to the project directory. Images are saved with filenames of the following format:
+
+ [test class name]-[test selector name]-[UIScreen scale]-[# of call to GHVerifyView in selector]-[view class name].png
+
+ Note that because of differences in text rendering between retina and non-retina
+ devices/simulators, different images are saved for test runs using retina then
+ non-retina.
+
+ Also note that there are commonly rendering differences across iOS versions.
+ Therefore it is common for tests to fail when they are run using a different iOS
+ version then the one that created the saved test image. This also applies to tests
+ that are run at the command line (the xcodebuild flag '-sdk iphonesimulator'
+ usually corresponds to the latest iOS simulator available).
*/
@interface GHViewTestCase : GHTestCase {
NSInteger imageVerifyCount_;
@@ -91,15 +103,6 @@ reason:@"GHVerifyView can only be called from within a GHViewTestCase class"] ra
+ (void)saveToDocumentsWithImage:(UIImage *)image filename:(NSString *)filename;
/*!
- Whether the test class should be run as a part of command line tests.
- By default this is YES since there are some small differences in rendering
- from the command line vs rendering in the simulator
-
- @result YES if this test class is disabled for command line tests
- */
-- (BOOL)isCLIDisabled;
-
-/*!
Size for a given view. Subclasses can override this to provide custom sizes
for views before rendering. The default implementation returns contentSize
for scrollviews and returns self.frame.size for all other views.
View
2 Examples/MyTestable-iOS/MyTestable/MyTestableAppDelegate.h
@@ -3,7 +3,7 @@
// MyTestable
//
// Created by Gabriel Handford on 7/16/11.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Copyright 2011. All rights reserved.
//
#import <UIKit/UIKit.h>
View
6 Examples/MyTestable-iOS/MyTestable/MyTestableAppDelegate.m
@@ -3,7 +3,7 @@
// MyTestable
//
// Created by Gabriel Handford on 7/16/11.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Copyright 2011. All rights reserved.
//
#import "MyTestableAppDelegate.h"
@@ -17,7 +17,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
{
// Override point for customization after application launch.
[self.window makeKeyAndVisible];
- return YES;
+ return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
@@ -62,7 +62,7 @@ - (void)applicationWillTerminate:(UIApplication *)application
- (void)dealloc
{
[_window release];
- [super dealloc];
+ [super dealloc];
}
@end
View
2 Examples/MyTestable-iOS/MyTestable/iPad/MyTestableAppDelegate_iPad.h
@@ -3,7 +3,7 @@
// MyTestable
//
// Created by Gabriel Handford on 7/16/11.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Copyright 2011. All rights reserved.
//
#import <UIKit/UIKit.h>
View
7 Examples/MyTestable-iOS/MyTestable/iPad/MyTestableAppDelegate_iPad.m
@@ -3,16 +3,11 @@
// MyTestable
//
// Created by Gabriel Handford on 7/16/11.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Copyright 2011. All rights reserved.
//
#import "MyTestableAppDelegate_iPad.h"
@implementation MyTestableAppDelegate_iPad
-- (void)dealloc
-{
- [super dealloc];
-}
-
@end
View
2 Examples/MyTestable-iOS/MyTestable/iPad/MyTestableViewController_iPad.h
@@ -3,7 +3,7 @@
// MyTestable
//
// Created by John Boiles on 10/26/11.
-// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2011. All rights reserved.
//
#import <UIKit/UIKit.h>
View
40 Examples/MyTestable-iOS/MyTestable/iPad/MyTestableViewController_iPad.m
@@ -3,49 +3,11 @@
// MyTestable
//
// Created by John Boiles on 10/26/11.
-// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2011. All rights reserved.
//
#import "MyTestableViewController_iPad.h"
@implementation MyTestableViewController_iPad
-- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
-{
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if (self) {
- // Custom initialization
- }
- return self;
-}
-
-- (void)didReceiveMemoryWarning
-{
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
-
- // Release any cached data, images, etc that aren't in use.
-}
-
-#pragma mark - View lifecycle
-
-- (void)viewDidLoad
-{
- [super viewDidLoad];
- // Do any additional setup after loading the view from its nib.
-}
-
-- (void)viewDidUnload
-{
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
-}
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
-{
- // Return YES for supported orientations
- return YES;
-}
-
@end
View
2 Examples/MyTestable-iOS/MyTestable/iPhone/MyTestableAppDelegate_iPhone.h
@@ -3,7 +3,7 @@
// MyTestable
//
// Created by Gabriel Handford on 7/16/11.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Copyright 2011. All rights reserved.
//
#import <UIKit/UIKit.h>
View
7 Examples/MyTestable-iOS/MyTestable/iPhone/MyTestableAppDelegate_iPhone.m
@@ -3,16 +3,11 @@
// MyTestable
//
// Created by Gabriel Handford on 7/16/11.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Copyright 2011. All rights reserved.
//
#import "MyTestableAppDelegate_iPhone.h"
@implementation MyTestableAppDelegate_iPhone
-- (void)dealloc
-{
- [super dealloc];
-}
-
@end
View
2 Examples/MyTestable-iOS/MyTestable/iPhone/MyTestableViewController_iPhone.h
@@ -3,7 +3,7 @@
// MyTestable
//
// Created by John Boiles on 10/26/11.
-// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2011. All rights reserved.
//
#import <UIKit/UIKit.h>
View
40 Examples/MyTestable-iOS/MyTestable/iPhone/MyTestableViewController_iPhone.m
@@ -3,49 +3,11 @@
// MyTestable
//
// Created by John Boiles on 10/26/11.
-// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2011. All rights reserved.
//
#import "MyTestableViewController_iPhone.h"
@implementation MyTestableViewController_iPhone
-- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
-{
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if (self) {
- // Custom initialization
- }
- return self;
-}
-
-- (void)didReceiveMemoryWarning
-{
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
-
- // Release any cached data, images, etc that aren't in use.
-}
-
-#pragma mark - View lifecycle
-
-- (void)viewDidLoad
-{
- [super viewDidLoad];
- // Do any additional setup after loading the view from its nib.
-}
-
-- (void)viewDidUnload
-{
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
-}
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
-{
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
-}
-
@end
View
3 Examples/MyTestable-iOS/MyTestable/iPhone/MyTestableViewController_iPhone.xib
@@ -74,7 +74,6 @@
<string key="NSFrame">{{10, 161}, {310, 137}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:328</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -179,7 +178,7 @@ X3wgIC9fX3x8X198ICAKL19fX19fLyAgICAgIFwvICAgICAgICAgICBcLw</string>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">10</int>
+ <int key="maxID">15</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
View
2 Examples/MyTestable-iOS/MyTestable/main.m
@@ -3,7 +3,7 @@
// MyTestable
//
// Created by Gabriel Handford on 7/16/11.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Copyright 2011. All rights reserved.
//
#import <UIKit/UIKit.h>
View
BIN Examples/MyTestable-iOS/TestImages/MyViewTest-testIPadViewController-0-UIView.png
Deleted file not rendered
View
BIN Examples/MyTestable-iOS/TestImages/MyViewTest-testIPadViewController-1-0-UIView.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN Examples/MyTestable-iOS/TestImages/MyViewTest-testIPhoneViewController-0-UIView.png
Deleted file not rendered
View
BIN Examples/MyTestable-iOS/TestImages/MyViewTest-testIPhoneViewController-1-0-UIView.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2 Examples/MyTestable-iOS/Tests/MyViewTest.m
@@ -3,7 +3,7 @@
// MyTestable
//
// Created by John Boiles on 10/26/11.
-// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
+// Copyright (c) 2011. All rights reserved.
//
#import <GHUnitIOS/GHUnit.h>
View
8 Project-iOS/GHUnitIOS.xcodeproj/project.pbxproj
@@ -145,8 +145,6 @@
00CEA042156C2E0B00BA3276 /* GHUIImageViewControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 00CEA03F156C2E0B00BA3276 /* GHUIImageViewControl.h */; };
00CEA043156C2E0B00BA3276 /* GHUIImageViewControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 00CEA040156C2E0B00BA3276 /* GHUIImageViewControl.m */; };
00CEA044156C2E0B00BA3276 /* GHUIImageViewControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 00CEA040156C2E0B00BA3276 /* GHUIImageViewControl.m */; };
- 00CEA045156C2E1C00BA3276 /* GHImageDiffView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4228635614595D0400BF3ED2 /* GHImageDiffView.h */; };
- 00CEA046156C2E2100BA3276 /* GHImageDiffView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4228635714595D0400BF3ED2 /* GHImageDiffView.m */; };
421C7B8F13F0AF1D00E21E74 /* GHUnitIOSTestView.h in Headers */ = {isa = PBXBuildFile; fileRef = 421C7B8D13F0AF1D00E21E74 /* GHUnitIOSTestView.h */; };
421C7B9013F0AF1D00E21E74 /* GHUnitIOSTestView.h in Headers */ = {isa = PBXBuildFile; fileRef = 421C7B8D13F0AF1D00E21E74 /* GHUnitIOSTestView.h */; };
421C7B9113F0AF1D00E21E74 /* GHUnitIOSTestView.m in Sources */ = {isa = PBXBuildFile; fileRef = 421C7B8E13F0AF1D00E21E74 /* GHUnitIOSTestView.m */; };
@@ -157,6 +155,8 @@
422863141458BC1200BF3ED2 /* GHViewTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 422863101458BC1200BF3ED2 /* GHViewTestCase.m */; };
4228635814595D0400BF3ED2 /* GHImageDiffView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4228635614595D0400BF3ED2 /* GHImageDiffView.h */; };
4228635914595D0400BF3ED2 /* GHImageDiffView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4228635714595D0400BF3ED2 /* GHImageDiffView.m */; };
+ 423AF3371460965C00F04DC7 /* GHImageDiffView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4228635714595D0400BF3ED2 /* GHImageDiffView.m */; };
+ 423AF3391460969000F04DC7 /* GHImageDiffView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4228635614595D0400BF3ED2 /* GHImageDiffView.h */; };
42A678EF1401423D0060D1B5 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42A678EE1401423D0060D1B5 /* QuartzCore.framework */; };
/* End PBXBuildFile section */
@@ -640,7 +640,7 @@
421C7B9013F0AF1D00E21E74 /* GHUnitIOSTestView.h in Headers */,
422863121458BC1200BF3ED2 /* GHViewTestCase.h in Headers */,
00CEA042156C2E0B00BA3276 /* GHUIImageViewControl.h in Headers */,
- 00CEA045156C2E1C00BA3276 /* GHImageDiffView.h in Headers */,
+ 423AF3391460969000F04DC7 /* GHImageDiffView.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -836,7 +836,7 @@
421C7B9213F0AF1D00E21E74 /* GHUnitIOSTestView.m in Sources */,
422863141458BC1200BF3ED2 /* GHViewTestCase.m in Sources */,
00CEA044156C2E0B00BA3276 /* GHUIImageViewControl.m in Sources */,
- 00CEA046156C2E2100BA3276 /* GHImageDiffView.m in Sources */,
+ 423AF3371460965C00F04DC7 /* GHImageDiffView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
23 README.md
@@ -16,27 +16,30 @@ It can be used standalone or with other testing frameworks like SenTestingKit or
- Include as a framework in your projects
- Determine whether views have changed (UI verification)
- Quickly approve and record view changes
-- View image diff to see where views have chaned
+- View image diff to see where views have changed
+
+## Documentation
+
+- [How to install, create and run tests](http://gabriel.github.com/gh-unit/docs/index.html)
+- [Online documentation](http://gabriel.github.com/gh-unit/)
+- [Google Group](http://groups.google.com/group/ghunit)
## Install (Docset)
- Open Xcode, Preferences and select the Documentation tab.
- Select the plus icon (bottom left) and specify: `http://gabriel.github.com/gh-unit/publish/me.rel.GHUnit.atom`
-## Links
-
-- [Online documentation](http://gabriel.github.com/gh-unit/)
-- [How to install, create and run tests](http://gabriel.github.com/gh-unit/docs/index.html)
-- [Google Group](http://groups.google.com/group/ghunit)
## Mac OS X
-![GHUnit-0.4.18](http://rel.me.s3.amazonaws.com/gh-unit/images/GHUnit-0.4.18.png)
+![GHUnit-0.4.18](http://rel.me.s3.amazonaws.com/images/GHUnit-0.4.18.png)
## iOS
-![GHUnit-IPhone-0.4.18](http://rel.me.s3.amazonaws.com/gh-unit/images/GHUnit-IPhone-0.4.18.png)
+![GHUnit-IPhone-0.4.18](http://rel.me.s3.amazonaws.com/images/GHUnit-IPhone-0.4.18.png)
+
+![GHUnit-IPhone-0.4.34](https://johnboiles.s3.amazonaws.com/ghunittestview.png)
-![GHUnit-IPhone-0.4.33](https://johnboiles.s3.amazonaws.com/GHUnitTestViewer.jpg)
+![GHUnit-IPhone-0.4.34](https://johnboiles.s3.amazonaws.com/ghunitnewimage.png)
-![GHUnit-IPhone-0.4.33](https://johnboiles.s3.amazonaws.com/GHUnitImageViewer.jpg)
+![GHUnit-IPhone-0.4.34](https://johnboiles.s3.amazonaws.com/ghunitdiff.png)
View
1 Scripts/iOSFramework.sh
@@ -71,6 +71,7 @@ cp ../Classes/Mock/*.h $FRAMEWORK_DIR/Headers/
cp ../Classes/GHTest/*.h $FRAMEWORK_DIR/Headers/
cp ../Classes/SharedUI/*.h $FRAMEWORK_DIR/Headers/
cp ../Classes-iOS/*.h $FRAMEWORK_DIR/Headers/
+cp ../Classes/Mock/*.h $FRAMEWORK_DIR/Headers/
cp Framework.plist $FRAMEWORK_DIR/Resources/Info.plist
echo ""

0 comments on commit e726c7b

Please sign in to comment.
Something went wrong with that request. Please try again.