FoneMonkey Class

Preview:

Citation preview

Class ListHere are the classes, structs, unions and interfaces with brief descriptions:FMCommandEvent The FoneMonkey command object used for recording and playback FoneMonkeyAPI The public API for the FoneMonkey framework UIControl(FoneMonkey) FoneMonkey UIControl event handling extensions UIEvent(Synthesize) UIEvent extensions for simulating touch events UITouch(Synthesize) UITouch extensions for synthesizing touch events

UIView(FoneMonkey)FoneMonkey UIView extensions provide recording and playback of Touch and Motion events

File ListHere is a list of all files with brief descriptions:FMCommandEvent.h [code]FoneMonkeyAPI.h [code]TouchSynthesis.h [code]UIControl+FMready.h [code]UIView+FMReady.h [code]

FMCommandEvent Class ReferenceThe FoneMonkey command object used for recording and playback. More...

#import <FMCommandEvent.h>

List of all members.

Public Member Functions(id) - init:className:monkeyID:args:

(id) - initWithDict:

(id) - execute

Static Public Member Functions(FMCommandEvent *) + command:className:monkeyID:args:

Create a new FMCommandEvent.

PropertiesUIView * source

The component corresponding to the supplied className and monkeyID.

NSString * command

NSString * className

NSString * monkeyID

NSString * lastResult

NSArray * args

NSMutableDictionary * dict

Detailed Description

The FoneMonkey command object used for recording and playback.

Member Function Documentation

+ (FMCommandEvent*) command: (NSString *) cmd

className: (NSString *) name

monkeyID: (NSString *) id

args: (NSArray *) array

Create a new FMCommandEvent.

- (id) execute

- (id) init: (NSString *) cmd

className: (NSString *) className

monkeyID: (NSString *) monkeyID

args: (NSArray *) args

- (id) initWithDict: (NSMutableDictionary *) dict

Property Documentation- (NSArray *) args [read, write, retain]

- (NSString *) className [read, write, retain]

- (NSString *) command [read, write, retain]

- (NSMutableDictionary *) dict [read, write, retain]

- (NSString *) lastResult [read, write, retain]

- (NSString *) monkeyID [read, write, retain]

- (UIView *) source [read, assign]

The component corresponding to the supplied className and monkeyID.

The documentation for this class was generated from the following file:

00001 /* This file is part of FoneMonkey.00002 00003 FoneMonkey is free software: you can redistribute it and/or modify00004 it under the terms of the GNU General Public License as published by00005 the Free Software Foundation, either version 3 of the License, or00006 (at your option) any later version.00007 00008 FoneMonkey is distributed in the hope that it will be useful,00009 but WITHOUT ANY WARRANTY; without even the implied warranty of00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the00011 GNU General Public License for more details.00012 00013 You should have received a copy of the GNU General Public License00014 along with FoneMonkey. If not, see <http://www.gnu.org/licenses/>. */00015 //00016 // FMCommandEvent.h00017 // FoneMonkey00018 //00019 // Created by Stuart Stern on 10/14/09.00020 // Copyright 2009 Gorilla Logic, Inc. All rights reserved.00021 //00022 00023 #import <Foundation/Foundation.h>00024 #import <UIKit/UIKit.h>00025 #import <Foundation/NSArray.h>00026 00030 @interface FMCommandEvent : NSObject <NSCopying> {00031 00032 UIView* source;00033 NSString* command;00034 NSString* className;00035 NSString* monkeyID; 00036 NSArray* args;00037 NSMutableDictionary* dict;00038 NSString* lastResult;00039 }00043 + (FMCommandEvent*) command:(NSString*)cmd className:(NSString*)name monkeyID:(NSString*)id args:(NSArray*)array;00044 - (id) init:(NSString*)cmd className:(NSString*)className monkeyID:(NSString*)monkeyID args:(NSArray*)args;00045 - (id) initWithDict:(NSMutableDictionary*)dict;00046 - (id) execute;00050 @property (readonly) UIView* source;

00051 @property (nonatomic, retain) NSString* command;00052 @property (nonatomic, retain) NSString* className;00053 @property (nonatomic, retain) NSString* monkeyID;00054 @property (nonatomic, retain) NSString* lastResult;00055 @property (nonatomic, retain) NSArray* args;00056 @property (nonatomic, retain) NSMutableDictionary* dict;00057 @end

FoneMonkeyAPI Class ReferenceThe public API for the FoneMonkey framework. More...

#import <FoneMonkeyAPI.h>

List of all members.

Static Public Member Functions(void) + record:command:args:

Appends the command to the end of the currently recording script.

(void) + continueRecording

When handling an event, a component MUST call either record:command:args or continueRecording before returning.

(NSString *) + playCommands:

Play the supplied array of FMCommandEvents.

(NSString *) + playFile:

Play the commands from the named script file.

(UIView *) + viewWithMonkeyID:havingClass:

Find the view with the specified monkeyID and class.

Detailed Description

The public API for the FoneMonkey framework.

Member Function Documentation

+ (void) continueRecording

When handling an event, a component MUST call either record:command:args or continueRecording before returning.

Neglecting to do so will permanently suspend the FoneMonkey console.

+ (NSString*) playCommands: (NSArray *) commands

Play the supplied array of FMCommandEvents.

Returns:

nil if all comamnds run successfully and an error or failure message otherwise.

+ (NSString*) playFile: (NSString *) file

Play the commands from the named script file.

Returns:

nil if all comamnds run successfully and an error or failure message otherwise.

+ (void) record: (UIView *) sender

command: (NSString *) command

args: (NSArray *) args

Appends the command to the end of the currently recording script.

Parameters:

sender the component for which this command is to be recorded

command the name of the command.

args an array of the command's arguments

+ (UIView*) viewWithMonkeyID: (NSString *) monkeyID

havingClass: (NSString *) className

Find the view with the specified monkeyID and class.

Parameters:

monkeyID the id to search for

className the string name of the class

Returns:

the view or nil if no view is found.

The documentation for this class was generated from the following file:

FoneMonkeyAPI.h

00001 /* This file is part of FoneMonkey.00002 00003 FoneMonkey is free software: you can redistribute it and/or modify00004 it under the terms of the GNU General Public License as published by00005 the Free Software Foundation, either version 3 of the License, or00006 (at your option) any later version.00007 00008 FoneMonkey is distributed in the hope that it will be useful,00009 but WITHOUT ANY WARRANTY; without even the implied warranty of00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the00011 GNU General Public License for more details.00012 00013 You should have received a copy of the GNU General Public License00014 along with FoneMonkey. If not, see <http://www.gnu.org/licenses/>. */00015 //00016 // FoneMonkeyAPI.h00017 // FoneMonkey00018 //00019 // Created by Stuart Stern on 2/6/10.00020 // Copyright (c) 2010 Gorilla Logic, Inc. All rights reserved.00021 //00022 00023 00031 #import "TouchSynthesis.h"00032 #import "FMCommandEvent.h"00033 #import "UIView+FMReady.h"00034 #import "UIControl+FMready.h"00035 00038 @interface FoneMonkeyAPI : NSObject00044 + (void) record:(UIView*)sender command:(NSString*)command args:(NSArray*)args;00045 00049 + (void) continueRecording;00050 00055 + (NSString*) playCommands:(NSArray*)commands;00056 00061 + (NSString*) playFile:(NSString*)file;

00062 00069 + (UIView*) viewWithMonkeyID:(NSString*)monkeyID havingClass:(NSString*)className;00070 00071 @end

UIControl(FoneMonkey) Class Reference

FoneMonkey UIControl event handling extensions. More...

#import <UIControl+FMready.h>

List of all members.

Public Member Functions(UIControlEvents) - monkeyEventsToHandle

The events to be recorded for this UIControl class.

(void) - handleMonkeyEventFromSender:forEvent:

Prepare a UIControlEvent event for recording.

(void) - subscribeToMonkeyEvents

Register for events to be recorded.

Detailed Description

FoneMonkey UIControl event handling extensions.

Override to modify UIControl recording of UIControlEvents.

Member Function Documentation

- (void) handleMonkeyEventFromSender: (id) sender

forEvent: (UIEvent *) event

Prepare a UIControlEvent event for recording.

- (UIControlEvents) monkeyEventsToHandle

The events to be recorded for this UIControl class.

Defaults to none.

- (void) subscribeToMonkeyEvents

Register for events to be recorded.

The documentation for this class was generated from the following file:

UIControl+FMready.h

00001 /* This file is part of FoneMonkey.00002 00003 FoneMonkey is free software: you can redistribute it and/or modify00004 it under the terms of the GNU General Public License as published by00005 the Free Software Foundation, either version 3 of the License, or00006 (at your option) any later version.00007 00008 FoneMonkey is distributed in the hope that it will be useful,00009 but WITHOUT ANY WARRANTY; without even the implied warranty of00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the00011 GNU General Public License for more details.00012 00013 You should have received a copy of the GNU General Public License00014 along with FoneMonkey. If not, see <http://www.gnu.org/licenses/>. */00015 //00016 // UIControl+FoneMonkey.h00017 // FoneMonkey00018 //00019 // Created by Stuart Stern on 10/13/09.00020 // Copyright 2009 Gorilla Logic, Inc. All rights reserved.00021 //00022 00023 #import <Foundation/Foundation.h>00024 #import <UIKit/UIControl.h>00025 00029 @interface UIControl (FoneMonkey)00030 00034 - (UIControlEvents)monkeyEventsToHandle;00035 00039 - (void) handleMonkeyEventFromSender:(id)sender forEvent:(UIEvent*)event;00040 00044 - (void) subscribeToMonkeyEvents;00045 00046 @end

UIEvent(Synthesize) Class ReferenceUIEvent extensions for simulating touch events. More...

#import <TouchSynthesis.h>

List of all members.

Public Member Functions(id) - initWithTouch:

Static Public Member Functions(void) + performTouchLeftInView:

(void) + performTouchRightInView:

(void) + performTouchInView:

(void) + performTouchInView:at:

(void) + performTouchInView:at:withCount:

(void) + performTouchInView:at:forPhase:

(void) + performTouchDownInView:at:

(void) + performTouchUpInView:at:

(void) + performMoveInView:from:to:

Detailed Description

UIEvent extensions for simulating touch events.

Member Function Documentation

- (id) initWithTouch: (UITouch *) touch

+ (void) performMoveInView: (UIView *) view

from: (CGPoint) from

to: (CGPoint) to

+ (void) performTouchDownInView: (UIView *) view

at: (CGPoint) point

+ (void) performTouchInView: (UIView *) view

+ (void) performTouchInView: (UIView *) view

at: (CGPoint) point

+ (void) performTouchInView: (UIView *) view

at: (CGPoint) point

forPhase: (UITouchPhase) phase

+ (void) performTouchInView: (UIView *) view

at: (CGPoint) point

withCount: (NSInteger) count

+ (void) performTouchLeftInView: (UIView *) view

+ (void) performTouchRightInView: (UIView *) view

+ (void) performTouchUpInView: (UIView *) view

at: (CGPoint) point

The documentation for this class was generated from the following file:

TouchSynthesis.h 00001 /* This file is part of FoneMonkey. 00002 00003 FoneMonkey is free software: you can redistribute it and/or

modify 00004 it under the terms of the GNU General Public License as

published by 00005 the Free Software Foundation, either version 3 of the License,

or 00006 (at your option) any later version. 00007 00008 FoneMonkey is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public

License 00014 along with FoneMonkey. If not, see

<http://www.gnu.org/licenses/>. */ 00015 // 00016 // TouchSynthesis.h 00017 // SelfTesting 00018 // 00019 // Created by Matt Gallagher on 23/11/08. 00020 // Copyright 2008 Matt Gallagher. All rights reserved. 00021 // 00022 // Permission is given to use this source code file, free of

charge, in any 00023 // project, commercial or otherwise, entirely at your risk, with

the condition 00024 // that any redistribution (in part or whole) of source code must

retain 00025 // this copyright and permission notice. Attribution in compiled

projects is 00026 // appreciated but not required. 00027 // 00028 // Modified extensively for FoneMonkey by Stu Stern, Gorilla

Logic, November, 2009 00029 // 00030 00031 00032 #import <UIKit/UIKit.h> 00033 00034 // 00035 // UITouch (Synthesize) 00039 @interface UITouch (Synthesize) 00040 00041 - (id)initInView:(UIView *)view;

00042 - (void)setPhase:(UITouchPhase)phase; 00043 - (void)setLocationInWindow:(CGPoint)location; 00044 00045 00046 @end 00047 00048 00052 @interface UIEvent (Synthesize) 00053 00054 - (id)initWithTouch:(UITouch *)touch; 00055 + (void)performTouchLeftInView:(UIView*)view; 00056 + (void)performTouchRightInView:(UIView*)view; 00057 + (void)performTouchInView:(UIView*)view; 00058 + (void)performTouchInView:(UIView*)view at:(CGPoint)point; 00059 + (void)performTouchInView:(UIView*)view at:(CGPoint)point

withCount:(NSInteger)count; 00060 + (void)performTouchInView:(UIView*)view at:(CGPoint)point

forPhase:(UITouchPhase)phase; 00061 + (void)performTouchDownInView:(UIView*)view at:(CGPoint)point; 00062 + (void)performTouchUpInView:(UIView*)view at:(CGPoint)point; 00063 + (void)performMoveInView:(UIView *)view from:(CGPoint)from to:

(CGPoint)to; 00064 @end

UITouch(Synthesize) Class ReferenceUITouch extensions for synthesizing touch events. More...

#import <TouchSynthesis.h>

List of all members.

Public Member Functions(id) - initInView:

(void) - setPhase:

(void) - setLocationInWindow:

Detailed Description

UITouch extensions for synthesizing touch events.

Member Function Documentation

- (id) initInView: (UIView *) view

- (void) setLocationInWindow: (CGPoint) location

- (void) setPhase: (UITouchPhase) phase

The documentation for this class was generated from the following file:

TouchSynthesis.h 00001 /* This file is part of FoneMonkey. 00002 00003 FoneMonkey is free software: you can redistribute it and/or

modify 00004 it under the terms of the GNU General Public License as

published by 00005 the Free Software Foundation, either version 3 of the License,

or 00006 (at your option) any later version. 00007 00008 FoneMonkey is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public

License 00014 along with FoneMonkey. If not, see

<http://www.gnu.org/licenses/>. */ 00015 // 00016 // TouchSynthesis.h 00017 // SelfTesting 00018 // 00019 // Created by Matt Gallagher on 23/11/08. 00020 // Copyright 2008 Matt Gallagher. All rights reserved. 00021 // 00022 // Permission is given to use this source code file, free of

charge, in any 00023 // project, commercial or otherwise, entirely at your risk, with

the condition 00024 // that any redistribution (in part or whole) of source code must

retain 00025 // this copyright and permission notice. Attribution in compiled

projects is 00026 // appreciated but not required. 00027 // 00028 // Modified extensively for FoneMonkey by Stu Stern, Gorilla

Logic, November, 2009 00029 //

00030 00031 00032 #import <UIKit/UIKit.h> 00033 00034 // 00035 // UITouch (Synthesize) 00039 @interface UITouch (Synthesize) 00040 00041 - (id)initInView:(UIView *)view; 00042 - (void)setPhase:(UITouchPhase)phase; 00043 - (void)setLocationInWindow:(CGPoint)location; 00044 00045 00046 @end 00047 00048 00052 @interface UIEvent (Synthesize) 00053 00054 - (id)initWithTouch:(UITouch *)touch; 00055 + (void)performTouchLeftInView:(UIView*)view; 00056 + (void)performTouchRightInView:(UIView*)view; 00057 + (void)performTouchInView:(UIView*)view; 00058 + (void)performTouchInView:(UIView*)view at:(CGPoint)point; 00059 + (void)performTouchInView:(UIView*)view at:(CGPoint)point

withCount:(NSInteger)count; 00060 + (void)performTouchInView:(UIView*)view at:(CGPoint)point

forPhase:(UITouchPhase)phase; 00061 + (void)performTouchDownInView:(UIView*)view at:(CGPoint)point; 00062 + (void)performTouchUpInView:(UIView*)view at:(CGPoint)point; 00063 + (void)performMoveInView:(UIView *)view from:(CGPoint)from to:

(CGPoint)to; 00064 @end

UIView(FoneMonkey) Class ReferenceFoneMonkey UIView extensions provide recording and playback of Touch and Motion events. More...

#import <UIView+FMReady.h>

List of all members.

Public Member Functions(void) - playbackMonkeyEvent:

Interpret the command and generate the necessary UI events for the component.

(NSString *) - monkeyID

A string value uniquely identifying this instance of the component class.

(BOOL) - shouldRecordMonkeyTouch:

Returns YES if the supplied touch should be recorded.

(void) - handleMonkeyTouchEvent:withEvent:

Evaluates touch events and records corresponding command.

(void) - handleMonkeyMotionEvent:

Evaluates motion (shake) event and records corresponding command.

(BOOL) - isFMEnabled

Returns NO if recording should be disabled for the component.

(BOOL) - swapsWith:

Returns YES if this component might have been substituted for one with the supplied class name.

(void) - fmAssureAutomationInit

Called to give an component's automation extension an opportunity to init itself.

Static Public Member Functions(NSString

*) + uiAutomationCommand:

Return the corresponding UIAutomation command executable by Instruments.

(NSString *) + objcCommandEvent:

Return the corresponding CommandEvent source executable in ObjC.

Detailed Description

FoneMonkey UIView extensions provide recording and playback of Touch and Motion events.

UIView subclasses can override one or more of these methods to cusotmize recording and playback logic for a class.

Member Function Documentation

- (void) fmAssureAutomationInit

Called to give an component's automation extension an opportunity to init itself.

May (will) be called multiple (countless) times.

- (void) handleMonkeyMotionEvent: (UIEvent *) event

Evaluates motion (shake) event and records corresponding command.

- (void) handleMonkeyTouchEvent: (NSSet *) touches

withEvent: (UIEvent *) event

Evaluates touch events and records corresponding command.

- (BOOL) isFMEnabled

Returns NO if recording should be disabled for the component.

By default, returns YES for UIView subclasses, but NO for UIView class instances (since these are component containers).

- (NSString*) monkeyID

A string value uniquely identifying this instance of the component class.

+ (NSString*) objcCommandEvent: (FMCommandEvent *) command

Return the corresponding CommandEvent source executable in ObjC.

- (void) playbackMonkeyEvent: (FMCommandEvent *) event

Interpret the command and generate the necessary UI events for the component.

- (BOOL) shouldRecordMonkeyTouch: (UITouch *) touch

Returns YES if the supplied touch should be recorded.

By default, returns YES if touch.phase == UITouchPhaseEnded and NO otherwise. Override this method to filter which touch events should be recorded for a class.

- (BOOL) swapsWith: (NSString *) className

Returns YES if this component might have been substituted for one with the supplied class name.

The only known example of component swapping is UIToolbarTextButton which swaps with UINavigationButton on an iPad multiview controller.

+ (NSString*) uiAutomationCommand: (FMCommandEvent *) command

Return the corresponding UIAutomation command executable by Instruments.

The documentation for this class was generated from the following file:

UIView+FMReady.h 00001 /* This file is part of FoneMonkey. 00002 00003 FoneMonkey is free software: you can redistribute it and/or

modify 00004 it under the terms of the GNU General Public License as

published by 00005 the Free Software Foundation, either version 3 of the License,

or 00006 (at your option) any later version.

00007 00008 FoneMonkey is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public

License 00014 along with FoneMonkey. If not, see

<http://www.gnu.org/licenses/>. */ 00015 // 00016 // UIResponder+FMReady.h 00017 // FoneMonkey 00018 // 00019 // Created by Stuart Stern on 10/19/09. 00020 // Copyright 2009 Gorilla Logic, Inc.. All rights reserved. 00021 // 00022 00023 #import <Foundation/Foundation.h> 00024 #import <UIKit/UIKit.h> 00025 @class FMCommandEvent; 00026 00030 @interface UIView (FoneMonkey) 00033 - (void) playbackMonkeyEvent:(FMCommandEvent*)event; 00037 - (NSString*) monkeyID; 00038 00042 - (BOOL) shouldRecordMonkeyTouch:(UITouch*)touch; 00043 00047 - (void) handleMonkeyTouchEvent:(NSSet*)touches withEvent:

(UIEvent*)event; 00051 - (void) handleMonkeyMotionEvent:(UIEvent*)event; 00052 00056 - (BOOL) isFMEnabled; 00057 00062 - (BOOL) swapsWith:(NSString*)className; 00063 00067 + (NSString*) uiAutomationCommand:(FMCommandEvent*)command; 00068 00072 + (NSString*) objcCommandEvent:(FMCommandEvent*)command; 00073 00078 - (void) fmAssureAutomationInit; 00079 00080 @end

- f - fmAssureAutomationInit : UIView(FoneMonkey)

- h - handleMonkeyEventFromSender:forEvent: : UIControl(FoneMonkey) handleMonkeyMotionEvent: : UIView(FoneMonkey)

handleMonkeyTouchEvent:withEvent: : UIView(FoneMonkey)

- i - init:className:monkeyID:args: : FMCommandEvent initInView: : UITouch(Synthesize)

initWithDict: : FMCommandEvent

initWithTouch: : UIEvent(Synthesize)

isFMEnabled : UIView(FoneMonkey)

- l - lastResult : FMCommandEvent

- m - monkeyEventsToHandle : UIControl(FoneMonkey) monkeyID : UIView(FoneMonkey) , FMCommandEvent

- o - objcCommandEvent: : UIView(FoneMonkey)

- p - performMoveInView:from:to: : UIEvent(Synthesize) performTouchDownInView:at: : UIEvent(Synthesize)

performTouchInView: : UIEvent(Synthesize)

performTouchInView:at: : UIEvent(Synthesize)

performTouchInView:at:forPhase: : UIEvent(Synthesize)

performTouchInView:at:withCount: : UIEvent(Synthesize)

performTouchLeftInView: : UIEvent(Synthesize)

performTouchRightInView: : UIEvent(Synthesize)

performTouchUpInView:at: : UIEvent(Synthesize)

playbackMonkeyEvent: : UIView(FoneMonkey)

playCommands: : FoneMonkeyAPI

playFile: : FoneMonkeyAPI

- r - record:command:args: : FoneMonkeyAPI

- s - setLocationInWindow: : UITouch(Synthesize) setPhase: : UITouch(Synthesize)

shouldRecordMonkeyTouch: : UIView(FoneMonkey)

source : FMCommandEvent

subscribeToMonkeyEvents : UIControl(FoneMonkey)

swapsWith: : UIView(FoneMonkey)

- u - uiAutomationCommand: : UIView(FoneMonkey)

- v - viewWithMonkeyID:havingClass: : FoneMonkeyAPI

Recommended