Permalink
Browse files

Renaming originalImage->savedImage OriginalImage->SavedImage to be mo…

…re descriptive
  • Loading branch information...
1 parent 61fe509 commit 51adf4156df99374bd3e2a83446fb14b4a4a68d7 @johnboiles johnboiles committed Nov 1, 2011
@@ -33,14 +33,14 @@
UIScrollView *scrollView_;
UISegmentedControl *segmentedControl_;
- UIImageView *originalImageView_;
+ UIImageView *savedImageView_;
UIImageView *renderedImageView_;
UIImageView *diffImageView_;
}
-- (void)setOriginalImage:(UIImage *)originalImage renderedImage:(UIImage *)renderedImage diffImage:(UIImage *)diffImage;
+- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage diffImage:(UIImage *)diffImage;
-- (void)showOriginalImage;
+- (void)showSavedImage;
- (void)showRenderedImage;
@@ -47,9 +47,9 @@ - (id)initWithFrame:(CGRect)frame {
[self addSubview:segmentedControl_];
[segmentedControl_ release];
- originalImageView_ = [[UIImageView alloc] initWithFrame:CGRectZero];
- [scrollView_ addSubview:originalImageView_];
- [originalImageView_ release];
+ savedImageView_ = [[UIImageView alloc] initWithFrame:CGRectZero];
+ [scrollView_ addSubview:savedImageView_];
+ [savedImageView_ release];
renderedImageView_ = [[UIImageView alloc] initWithFrame:CGRectZero];
[scrollView_ addSubview:renderedImageView_];
@@ -69,35 +69,35 @@ - (void)layoutSubviews {
segmentedControl_.frame = CGRectMake((self.frame.size.width - 300) / 2, self.frame.size.height - 40, 300, 30);
}
-- (void)setOriginalImage:(UIImage *)originalImage renderedImage:(UIImage *)renderedImage diffImage:(UIImage *)diffImage {
- originalImageView_.image = originalImage;
- [originalImageView_ sizeToFit];
- [segmentedControl_ setEnabled:!!originalImage forSegmentAtIndex:0];
+- (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];
[segmentedControl_ setEnabled:!!diffImage forSegmentAtIndex:2];
- scrollView_.contentSize = CGSizeMake(MAX(originalImage.size.width, renderedImage.size.width), MAX(originalImage.size.height, renderedImage.size.height));
+ scrollView_.contentSize = CGSizeMake(MAX(savedImage.size.width, renderedImage.size.width), MAX(savedImage.size.height, renderedImage.size.height));
}
-- (void)showOriginalImage {
- originalImageView_.hidden = NO;
+- (void)showSavedImage {
+ savedImageView_.hidden = NO;
renderedImageView_.hidden = YES;
diffImageView_.hidden = YES;
segmentedControl_.selectedSegmentIndex = 0;
}
- (void)showRenderedImage {
- originalImageView_.hidden = YES;
+ savedImageView_.hidden = YES;
renderedImageView_.hidden = NO;
diffImageView_.hidden = YES;
segmentedControl_.selectedSegmentIndex = 1;
}
- (void)showDiffImage {
- originalImageView_.hidden = YES;
+ savedImageView_.hidden = YES;
renderedImageView_.hidden = YES;
diffImageView_.hidden = NO;
segmentedControl_.selectedSegmentIndex = 2;
@@ -106,7 +106,7 @@ - (void)showDiffImage {
#pragma mark UISegmentedControl
- (void)segmentedControlDidChange:(UISegmentedControl *)segmentedControl {
- if (segmentedControl.selectedSegmentIndex == 0) [self showOriginalImage];
+ if (segmentedControl.selectedSegmentIndex == 0) [self showSavedImage];
else if (segmentedControl.selectedSegmentIndex == 1) [self showRenderedImage];
else if (segmentedControl.selectedSegmentIndex == 2) [self showDiffImage];
}
@@ -33,7 +33,7 @@
@class GHUnitIOSTestView;
@protocol GHUnitIOSTestViewDelegate <NSObject>
-- (void)testViewDidSelectOriginalImage:(GHUnitIOSTestView *)testView;
+- (void)testViewDidSelectSavedImage:(GHUnitIOSTestView *)testView;
- (void)testViewDidSelectRenderedImage:(GHUnitIOSTestView *)testView;
- (void)testViewDidApproveChange:(GHUnitIOSTestView *)testView;
@end
@@ -43,7 +43,7 @@
// TODO(johnb): Perhaps hold a scrollview here as subclassing UIViews can be weird.
- YKUIImageViewControl *originalImageView_;
+ YKUIImageViewControl *savedImageView_;
YKUIImageViewControl *renderedImageView_;
UIButton *approveButton_;
@@ -52,7 +52,7 @@
}
@property(assign, nonatomic) id<GHUnitIOSTestViewDelegate> controlDelegate;
-- (void)setOriginalImage:(UIImage *)originalImage renderedImage:(UIImage *)renderedImage text:(NSString *)text;
+- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage text:(NSString *)text;
- (void)setText:(NSString *)text;
@@ -45,13 +45,13 @@ - (id)initWithFrame:(CGRect)frame {
[self addSubview:textLabel_];
[textLabel_ release];
- originalImageView_ = [[YKUIImageViewControl alloc] initWithFrame:CGRectMake(10, 10, 145, 100)];
- [originalImageView_ addTarget:self action:@selector(_selectOriginalImage) forControlEvents:UIControlEventTouchUpInside];
- [originalImageView_.layer setBorderWidth:2.0];
- [originalImageView_.layer setBorderColor:[UIColor blackColor].CGColor];
- originalImageView_.hidden = YES;
- [self addSubview:originalImageView_];
- [originalImageView_ release];
+ savedImageView_ = [[YKUIImageViewControl 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_];
+ [savedImageView_ release];
renderedImageView_ = [[YKUIImageViewControl alloc] initWithFrame:CGRectMake(165, 10, 145, 100)];
[renderedImageView_ addTarget:self action:@selector(_selectRenderedImage) forControlEvents:UIControlEventTouchUpInside];
@@ -77,19 +77,19 @@ - (id)initWithFrame:(CGRect)frame {
*/
- (void)_layout {
CGFloat y = 10;
- CGRect originalImageFrame = 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 (renderedImageView_.image && !renderedImageView_.hidden) {
@@ -99,7 +99,7 @@ - (void)_layout {
renderedImageView_.frame = renderedImageFrame;
}
- y += roundf(MAX(originalImageFrame.size.height, renderedImageFrame.size.height) + 10);
+ y += roundf(MAX(savedImageFrame.size.height, renderedImageFrame.size.height) + 10);
if (!approveButton_.hidden) {
approveButton_.frame = CGRectMake(10, y, 300, 30);
@@ -113,8 +113,8 @@ - (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)_selectRenderedImage {
@@ -125,9 +125,9 @@ - (void)_approveChange {
[controlDelegate_ testViewDidApproveChange:self];
}
-- (void)setOriginalImage:(UIImage *)originalImage renderedImage:(UIImage *)renderedImage text:(NSString *)text {
- originalImageView_.image = originalImage;
- originalImageView_.hidden = originalImage ? NO : YES;
+- (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;
@@ -136,7 +136,7 @@ - (void)setOriginalImage:(UIImage *)originalImage renderedImage:(UIImage *)rende
}
- (void)setText:(NSString *)text {
- originalImageView_.hidden = YES;
+ savedImageView_.hidden = YES;
renderedImageView_.hidden = YES;
approveButton_.hidden = YES;
textLabel_.text = text;
@@ -69,10 +69,10 @@ - (void)_runTest {
- (void)_showImageDiff {
if (!imageDiffView_) imageDiffView_ = [[GHImageDiffView alloc] initWithFrame:CGRectZero];
- UIImage *originalImage = [testNode_.test.exception.userInfo objectForKey:@"OriginalImage"];
+ 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 renderedImage:renderedImage diffImage:diffImage];
+ [imageDiffView_ setSavedImage:savedImage renderedImage:renderedImage diffImage:diffImage];
UIViewController *viewController = [[UIViewController alloc] init];
viewController.view = imageDiffView_;
[self.navigationController pushViewController:viewController animated:YES];
@@ -88,13 +88,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 *savedImage = [exceptionUserInfo objectForKey:@"SavedImage"];
UIImage *renderedImage = [exceptionUserInfo objectForKey:@"RenderedImage"];
- [testView_ setOriginalImage:originalImage renderedImage:renderedImage text:text];
+ [testView_ setSavedImage:savedImage renderedImage:renderedImage text:text];
} else if ([testNode_.test.exception.name isEqualToString:@"GHViewUnavailableException"]) {
NSDictionary *exceptionUserInfo = testNode_.test.exception.userInfo;
UIImage *renderedImage = [exceptionUserInfo objectForKey:@"RenderedImage"];
- [testView_ setOriginalImage:nil renderedImage:renderedImage text:text];
+ [testView_ setSavedImage:nil renderedImage:renderedImage text:text];
} else {
[testView_ setText:text];
}
@@ -113,9 +113,9 @@ - (void)setTest:(id<GHTest>)test {
#pragma mark Delegates (GHUnitIOSTestView)
-- (void)testViewDidSelectOriginalImage:(GHUnitIOSTestView *)testView {
+- (void)testViewDidSelectSavedImage:(GHUnitIOSTestView *)testView {
[self _showImageDiff];
- [imageDiffView_ showOriginalImage];
+ [imageDiffView_ showSavedImage];
}
- (void)testViewDidSelectRenderedImage:(GHUnitIOSTestView *)testView {
View
@@ -241,7 +241,7 @@ - (void)verifyView:(UIView *)view filename:(NSString *)filename lineNumber:(int)
} 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_++;
@@ -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;
@@ -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,16 +43,16 @@
// TODO(johnb): Perhaps hold a scrollview here as subclassing UIViews can be weird.
- YKUIImageViewControl *originalImageView_;
- YKUIImageViewControl *newImageView_;
+ YKUIImageViewControl *savedImageView_;
+ YKUIImageViewControl *renderedImageView_;
UIButton *approveButton_;
UILabel *textLabel_;
}
@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;

0 comments on commit 51adf41

Please sign in to comment.