Permalink
Browse files

Merge branch 'master' into symbiote_ux

Conflicts:
	frank_static_resources.bundle/symbiote.js
  • Loading branch information...
2 parents e83f66d + ebb5507 commit 2e73e01ac67964ff8aca253a24553ccd00481a44 @moredip committed Jul 3, 2011
@@ -115,6 +115,7 @@
D603944D135BD1E900116449 /* UISpecCommandReceiver.m in Sources */ = {isa = PBXBuildFile; fileRef = D6039410135BD1E900116449 /* UISpecCommandReceiver.m */; };
D603945D135BD22000116449 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D603945C135BD22000116449 /* CFNetwork.framework */; };
D6C8BCE5137CD613000EF521 /* UIQueryScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = D6C8BCE4137CD613000EF521 /* UIQueryScrollView.m */; };
+ D6D17BF513A2673700F9C1A8 /* VisibleTouch.m in Sources */ = {isa = PBXBuildFile; fileRef = D6D17BF413A2673700F9C1A8 /* VisibleTouch.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -275,6 +276,8 @@
D603945C135BD22000116449 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
D6C8BCE3137CD613000EF521 /* UIQueryScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIQueryScrollView.h; sourceTree = "<group>"; };
D6C8BCE4137CD613000EF521 /* UIQueryScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIQueryScrollView.m; sourceTree = "<group>"; };
+ D6D17BF313A2673700F9C1A8 /* VisibleTouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibleTouch.h; sourceTree = "<group>"; };
+ D6D17BF413A2673700F9C1A8 /* VisibleTouch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VisibleTouch.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -516,6 +519,8 @@
D60393C1135BD1E900116449 /* dsl */ = {
isa = PBXGroup;
children = (
+ D6D17BF313A2673700F9C1A8 /* VisibleTouch.h */,
+ D6D17BF413A2673700F9C1A8 /* VisibleTouch.m */,
D60393C2135BD1E900116449 /* Recordable.h */,
D60393C3135BD1E900116449 /* Recordable.m */,
D60393C4135BD1E900116449 /* UIChildren.h */,
@@ -797,6 +802,7 @@
D603944C135BD1E900116449 /* StaticResourcesRoute.m in Sources */,
D603944D135BD1E900116449 /* UISpecCommandReceiver.m in Sources */,
D6C8BCE5137CD613000EF521 /* UIQueryScrollView.m in Sources */,
+ D6D17BF513A2673700F9C1A8 /* VisibleTouch.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -128,6 +128,7 @@
D6C73C8B1321BB2F00C731A2 /* AccessibilityCheckCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = D6C73C8A1321BB2F00C731A2 /* AccessibilityCheckCommand.m */; };
D6C73C9E1321BB5D00C731A2 /* AccessibilityCheckCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = D6C73C8A1321BB2F00C731A2 /* AccessibilityCheckCommand.m */; };
D6C8BCAB137CD2EE000EF521 /* UIQueryScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = D6C8BCAA137CD2EE000EF521 /* UIQueryScrollView.m */; };
+ D6D17C0413A2679A00F9C1A8 /* VisibleTouch.m in Sources */ = {isa = PBXBuildFile; fileRef = D6D17C0313A2679A00F9C1A8 /* VisibleTouch.m */; };
D6D79B5711D7FB7C003E0E60 /* Operation.m in Sources */ = {isa = PBXBuildFile; fileRef = D6D79B5611D7FB7C003E0E60 /* Operation.m */; };
D6D79B7611D7FC73003E0E60 /* frank_static_resources.bundle in Resources */ = {isa = PBXBuildFile; fileRef = D6D79B7511D7FC73003E0E60 /* frank_static_resources.bundle */; };
/* End PBXBuildFile section */
@@ -332,6 +333,8 @@
D6C73C8A1321BB2F00C731A2 /* AccessibilityCheckCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AccessibilityCheckCommand.m; sourceTree = "<group>"; };
D6C8BCA9137CD2EE000EF521 /* UIQueryScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIQueryScrollView.h; sourceTree = "<group>"; };
D6C8BCAA137CD2EE000EF521 /* UIQueryScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIQueryScrollView.m; sourceTree = "<group>"; };
+ D6D17C0213A2679A00F9C1A8 /* VisibleTouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibleTouch.h; sourceTree = "<group>"; };
+ D6D17C0313A2679A00F9C1A8 /* VisibleTouch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VisibleTouch.m; sourceTree = "<group>"; };
D6D79B5511D7FB7C003E0E60 /* Operation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Operation.h; sourceTree = "<group>"; };
D6D79B5611D7FB7C003E0E60 /* Operation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Operation.m; sourceTree = "<group>"; };
D6D79B7511D7FC73003E0E60 /* frank_static_resources.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = frank_static_resources.bundle; path = ../../frank_static_resources.bundle; sourceTree = SOURCE_ROOT; };
@@ -735,6 +738,8 @@
D6A8360011CDC594001B8585 /* dsl */ = {
isa = PBXGroup;
children = (
+ D6D17C0213A2679A00F9C1A8 /* VisibleTouch.h */,
+ D6D17C0313A2679A00F9C1A8 /* VisibleTouch.m */,
D6A8360111CDC594001B8585 /* Recordable.h */,
D6A8360211CDC594001B8585 /* Recordable.m */,
D6A8360311CDC594001B8585 /* UIChildren.h */,
@@ -1030,6 +1035,7 @@
D6AE0919128CA0C000CDC4C4 /* AppCommand.m in Sources */,
D6C73C8B1321BB2F00C731A2 /* AccessibilityCheckCommand.m in Sources */,
D6C8BCAB137CD2EE000EF521 /* UIQueryScrollView.m in Sources */,
+ D6D17C0413A2679A00F9C1A8 /* VisibleTouch.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -0,0 +1,8 @@
+Feature: Various scenarios that exercise different parts of Frank
+
+Background:
+ Given I launch the app
+
+Scenario: Counting number of rows in a table section
+ Then I should see 3 rows in section 0
+
@@ -14,10 +14,22 @@
end
end
+Then /^I should see (\d+) rows in section (\d+)$/ do |expected_num_rows, section|
+ section = section.to_i
+ expected_num_rows = expected_num_rows.to_i
+ num_rows_array = frankly_map( "tableView first", "numberOfRowsInSection:", section )
+ raise "no table found" if num_rows_array.empty?
+ num_rows_array.first.should eq(expected_num_rows)
+end
+
When /^I touch the "([^\"]*)" nav bar button$/ do |mark|
touch( "navigationButton marked:'#{mark}'" )
end
+When /^I touch the screen at \((\d+),(\d+)\)$/ do |x, y|
+ frankly_map( "view:'UILayoutContainerView'", "touchx:y:", x, y )
+end
+
Then /^I should see an alert view saying "([^\"]*)"$/ do |expected_mark|
check_element_exists( "alertView view marked:'#{expected_mark}'" )
end
@@ -0,0 +1,12 @@
+Feature: Demonstrating the touchx:y: api
+
+Background:
+ Given I launch the app
+
+Scenario: Add test user
+ # about where "Larry Stooge" row should be in main screen
+ When I touch the screen at (80,90)
+ Then I wait to see a navigation bar titled "User Profile"
+ And I should see "Larry"
+ And I should see "Stooge"
+ And I should see "larry@stooges.com"
@@ -407,6 +407,8 @@ $(document).ready(function() {
hideLoadingUI();
}
});
+
+ return false;
}
function updateAccessibleViews( views ) {
@@ -9,7 +9,8 @@ +(id)withTarget:(id)target {
}
-(id)initWithTarget:(id)_target {
- if (self = [super init]) {
+ self = [super init];
+ if (self) {
self.target = _target;
}
return self;
@@ -15,7 +15,8 @@ +(id)withValue:(const void *)aValue objCType:(const char *)aTypeDescription file
}
-(id)initWithValue:(const void *)aValue objCType:(const char *)aTypeDescription file:(const char *)aFile line:(int)aLine isFailureTest:(BOOL)failureTest{
- if (self = [super init]) {
+ self = [super init];
+ if (self) {
//NSLog(@" UIExpectation initWithValue %s, %s, %d", aTypeDescription, aFile, aLine);
typeDescription = aTypeDescription;
value = [[NSNumberCreator numberWithValue:aValue objCType:aTypeDescription] retain];
@@ -10,7 +10,8 @@ +(id)withQuery:(UIQuery *)query {
}
-(id)initWithQuery:(UIQuery *)_query {
- if (self = [super init]) {
+ self = [super init];
+ if (self) {
self.query = _query;
}
return self;
@@ -11,7 +11,9 @@ +(id)withValue:(const void *)aValue objCType:(const char *)aTypeDescription matc
}
-(id)initWithValue:(const void *)aValue objCType:(const char *)aTypeDescription matchSelector:(SEL)aMatchSelector {
- if (self = [super init]) {
+
+ self = [super init];
+ if (self) {
expectedTypeDescription = aTypeDescription;
expectedValue = [NSNumberCreator numberWithValue:aValue objCType:aTypeDescription];
matchSelector = aMatchSelector;
View
@@ -65,6 +65,7 @@ UIQuery * $(NSMutableString *script, ...);
-(UIQuery *)path;
-(UIQuery *)inspect;
- (UIQuery *)touch;
+- (UIQuery *)touchx:(NSNumber *)x y:(NSNumber *)y;
- (UIQuery *)touchxy:(NSNumber *)x ycoord:(NSNumber *)y;
-(NSString *)description;
-(void)logRange:(NSString *)prefix range:(NSRange)range;
@@ -99,3 +100,13 @@ UIQuery * $(NSMutableString *script, ...);
@end
+@interface UIEvent (Synthesis)
+- (id)initWithTouch:(UITouch *)touch;
+@end
+
+@interface UITouch (Synthesize)
+- (id)initInView:(UIView *)view;
+- (id)initInView:(UIView *)view xcoord:(int)x ycoord:(int)y;
+- (void)setPhase:(UITouchPhase)phase;
+- (void)setLocationInWindow:(CGPoint)location;
+@end
View
@@ -17,6 +17,7 @@
#import "UIFilter.h"
#import "UIBug.h"
#import "UIQueryExpectation.h"
+#import "VisibleTouch.h"
@implementation UIQuery
@@ -418,26 +419,54 @@ - (UIQuery *)touch {
return [UIQuery withViews:views className:className];
}
-- (UIQuery *)touchxy:(NSNumber *)x ycoord:(NSNumber *)y {
+- (UIQuery *)touchxy:(NSNumber *)x ycoord:(NSNumber *)y
+{
+ return [self touchx:x y:y]; // call new function name but allow for choice
+}
+
+- (UIQuery *)touchx:(NSNumber *)x y:(NSNumber *)y {
//NSLog(@"UIQuery - (UIQuery *)touchxy:(int)x ycoord:(int)y = %@, %@", x, y);
[[UIQueryExpectation withQuery:self] exist:@"before you can touch it"];
- for (UIView *view in [self targetViews]) {
- UITouch *touch = [[UITouch alloc] initInView:view xcoord:[x intValue] ycoord:[y intValue]];
- UIEvent *eventDown = [[NSClassFromString(@"UITouchesEvent") alloc] initWithTouch:touch];
- NSSet *touches = [[NSMutableSet alloc] initWithObjects:&touch count:1];
+ for (UIView *aView in [self targetViews]) {
+ UITouch *aTouch = [[UITouch alloc] initInView:aView xcoord:[x intValue] ycoord:[y intValue]];
+
+ // Create a view to display a visible touch on the screen with a center of the touch
+ CGPoint thePoint = CGPointMake([x floatValue], [y floatValue]);
+ UIView *visibleTouch = [[VisibleTouch alloc] initWithCenter:thePoint];
+ [[aView window] addSubview:visibleTouch];
+ [[aView window] bringSubviewToFront:visibleTouch];
+
+ UIEvent *eventDown = [[NSClassFromString(@"UITouchesEvent") alloc] initWithTouch:aTouch];
+ NSSet *touches = [[NSMutableSet alloc] initWithObjects:&aTouch count:1];
- [touch.view touchesBegan:touches withEvent:eventDown];
-
- UIEvent *eventUp = [[NSClassFromString(@"UITouchesEvent") alloc] initWithTouch:touch];
- [touch setPhase:UITouchPhaseEnded];
-
- [touch.view touchesEnded:touches withEvent:eventDown];
+ [aTouch.view touchesBegan:touches withEvent:eventDown];
+
+ // Send event to the gesture recognizers
+ for (UIGestureRecognizer *recognizer in [aView gestureRecognizers])
+ {
+ [recognizer touchesBegan:touches withEvent:eventDown];
+ }
+
+ [self wait:.25]; // Pause so touch can be seen
+
+ UIEvent *eventUp = [[NSClassFromString(@"UITouchesEvent") alloc] initWithTouch:aTouch];
+ [aTouch setPhase:UITouchPhaseEnded];
+ [aTouch.view touchesEnded:touches withEvent:eventDown];
+
+ for (UIGestureRecognizer *recognizer in [aView gestureRecognizers])
+ {
+ [recognizer touchesEnded:touches withEvent:eventDown];
+ }
+
+ [visibleTouch removeFromSuperview];
+ [visibleTouch release];
+
[eventDown release];
[eventUp release];
[touches release];
- [touch release];
+ [aTouch release];
[self wait:.5];
}
return [UIQuery withViews:views className:className];
@@ -0,0 +1,19 @@
+//
+// VisibleTouch.h
+// myMusicStand
+//
+// Simple class to provide a circle similar to the one provide by
+// the ios simulator this makes debugging touches easier
+//
+// Created by Steve Solomon on 6/8/11.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface VisibleTouch : UIView
+
+// Designated Initializer all others throw exceptions =)
+- (id)initWithCenter:(CGPoint)ctr;
+
+@end
@@ -0,0 +1,60 @@
+//
+// VisibleTouch.m
+// myMusicStand
+//
+// Created by Steve Solomon on 6/8/11.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+#define BORDER 3 // border size what we draw
+#import "VisibleTouch.h"
+
+@implementation VisibleTouch
+
+- (id)initWithFrame:(CGRect)frame
+{
+ @throw @"Illegal instance please use initWithCenter method instead";
+}
+
+- (id)init
+{
+ @throw @"Illegal instance please use initWithCenter method instead";
+}
+
+- (id)initWithCenter:(CGPoint)ctr
+{
+ self = [super initWithFrame:CGRectMake(0, 0, 54, 54)];
+
+ if (self)
+ {
+ [self setCenter:ctr];
+ [self setBackgroundColor:[UIColor clearColor]];
+ }
+
+ return self;
+}
+
+- (void)drawRect:(CGRect)rect
+{
+ CGContextRef context = UIGraphicsGetCurrentContext();
+
+ // Clear our dirty rect
+ CGContextClearRect(context, rect);
+
+ // Shadow for circle
+ CGContextSaveGState(context);
+ CGContextSetShadowWithColor(context, CGSizeMake(2, 2), 5, [[UIColor blackColor] CGColor]);
+
+ // Draw circle
+ CGContextSetFillColorWithColor(context, [[UIColor lightGrayColor] CGColor]);
+ // draw circle with border on all sides
+ rect.origin.x += 3;
+ rect.origin.y += 3;
+ rect.size.width -= 6;
+ rect.size.height -= 6;
+ CGContextFillEllipseInRect(context, rect);
+
+ CGContextRestoreGState(context);
+}
+
+
+@end
@@ -8,7 +8,8 @@ @implementation ReturnCacher
@synthesize callCache;
-(id)initWithTarget:(id)_target {
- if (self = [super initWithTarget:_target]) {
+ self = [super initWithTarget:_target];
+ if (self) {
self.callCache = [[[CallCache alloc] init] autorelease];
}
return self;
View
@@ -63,7 +63,8 @@ - (id)initWithPoint:(CGPoint)point {
[UIBug swizzleMethodOnClass:[UIApplication class] originalSelector:@selector(sendEvent:) fromClass:[UIBug class] alternateSelector:@selector(mySendEvent:)];
swizzleWasDone = YES;
}
- if (self = [super initWithImage:[UIImage imageNamed:@"UISpec.bundle/images/uibug.png"] highlightedImage:[UIImage imageNamed:@"UISpec.bundle/images/uibug2.png"]]) {
+ self = [super initWithImage:[UIImage imageNamed:@"UISpec.bundle/images/uibug.png"] highlightedImage:[UIImage imageNamed:@"UISpec.bundle/images/uibug2.png"]];
+ if (self) {
self.userInteractionEnabled = YES;
self.frame = CGRectMake(point.x, point.y, self.frame.size.width, self.frame.size.height);
}
@@ -17,7 +17,8 @@ -(BOOL)becomeFirstResponder {
@implementation UIConsole
- (id)init {
- if (self = [super initWithFrame:CGRectMake(0,20,320,16)]) {
+ self = [super initWithFrame:CGRectMake(0,20,320,16)];
+ if (self) {
self.backgroundColor = [UIColor whiteColor];
scriptField = [[MyTextField alloc] initWithFrame:CGRectMake(0, 0, 265, 16)];
scriptField.autocorrectionType = UITextAutocorrectionTypeNo;
@@ -19,7 +19,8 @@ +(BOOL)inBrowserMode {
}
-(id)initWithView:(UIView *)_targetView {
- if (self = [super initWithStyle:UITableViewStyleGrouped]) {
+ self = [super initWithStyle:UITableViewStyleGrouped];
+ if (self) {
self.targetView = _targetView;
if ([_targetView respondsToSelector:@selector(subviews)]) {
self.targetSubviews = targetView.subviews;
@@ -9,7 +9,8 @@ +(id)withTarget:(id)target {
}
-(id)initWithTarget:(id)_target {
- if (self = [super init]) {
+ self = [super init];
+ if (self) {
self.target = _target;
}
return self;
Oops, something went wrong.

0 comments on commit 2e73e01

Please sign in to comment.