Skip to content
Browse files

Finished ObjC codegen. Also fixed bug where console was being display…

…ed on top of running ocunit tests.

git-svn-id: https://svn.gorillalogic.com/svn/fonemonkey4/trunk@36 72bb13d0-f000-403e-beb8-1553beae081e
  • Loading branch information...
1 parent bde3290 commit 161eed7150ac914454bbe0f9a629f90cc35c9012 sstern committed Jan 10, 2011
Showing with 29 additions and 11 deletions.
  1. +1 −1 FMBuildStampDefines.h
  2. +1 −2 FoneMonkey+OCUnit.m
  3. +17 −2 FoneMonkey.m
  4. +1 −1 UIView+FMReady.m
  5. +9 −5 iPhone/FMConsoleController.m
View
2 FMBuildStampDefines.h
@@ -1,2 +1,2 @@
-#define FM_BUILD_STAMP @"BUILD 110103.1625"
+#define FM_BUILD_STAMP @"BUILD 110109.1854"
#define FM_VERSION @"4.0.d"
View
3 FoneMonkey+OCUnit.m
@@ -26,13 +26,12 @@ @implementation FoneMonkey (OCUnit)
- (void) runTests:(SenTestSuite*) suite {
// We're a thread
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SenTestRun* run = [suite run];
if (getenv("FM_ENABLE_AUTOEXIT")) {
int exitStatus = (([run totalFailureCount] == 0U) ? 0 : 1);
exit(exitStatus);
}
-
[pool release];
}
View
19 FoneMonkey.m
@@ -271,7 +271,7 @@ - (NSString*) lastResult {
}
- (void) play:(BOOL)waitUntilDone {
- state = FMStatePlaying;
+ state = FMStatePlaying;
NSThread* thread = [[NSThread alloc] initWithTarget:self selector:@selector(runCommands) object:nil];
[thread start];
if (waitUntilDone) {
@@ -284,6 +284,8 @@ - (void) play:(BOOL)waitUntilDone {
}
- (NSString*) playAndWait {
+ state = FMStatePlaying;
+ [_console performSelectorOnMainThread:@selector(hideConsoleAndThen:) withObject:nil waitUntilDone:YES];
[self play:YES];
return [self lastResult];
}
@@ -581,6 +583,14 @@ - (void) openConsole {
[_console showConsole];
}
+- (void) hideConsole {
+ [_console hideConsole];
+}
+
+- (void) closeConsole {
+ [_console hideConsoleAndThen:nil];
+}
+
- (void) saveOCScript:(NSString* ) filename {
NSString *path = [[NSBundle mainBundle] pathForResource:
@"objc" ofType:@"template"];
@@ -595,7 +605,12 @@ - (void) saveOCScript:(NSString* ) filename {
for (i = 0; i < [commands count]; i++) {
FMCommandEvent* command = [self commandAt:i];
Class c = NSClassFromString(command.className);
- NSString* occmd = [c objcCommandEvent:command];
+ NSString* occmd;
+ if (c) {
+ occmd = [c objcCommandEvent:command];
+ } else {
+ occmd = [UIView objcCommandEvent:command];
+ }
if ([occmd hasPrefix:@"//"]) {
[code appendFormat:@"\t%@\n", occmd];
} else {
View
2 UIView+FMReady.m
@@ -285,7 +285,7 @@ + (NSString*) objcCommandEvent:(FMCommandEvent*)command {
[args setString:@"[NSArray arrayWithObjects:"];
NSString* arg;
for (arg in command.args) {
- [args appendFormat:@"\"%@\", ", [FMUtils stringByOcEscapingQuotesAndNewlines:arg]];
+ [args appendFormat:@"@\"%@\", ", [FMUtils stringByOcEscapingQuotesAndNewlines:arg]];
}
[args appendString:@"nil]"];
}
View
14 iPhone/FMConsoleController.m
@@ -93,7 +93,11 @@ - (void)viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playingDone:)
name:FMNotificationPlayingDone object:nil];
- [theMonkey suspend];
+ // OCUnit may have already started up some tests
+ if ([FoneMonkey sharedMonkey].state != FMStatePlaying) {
+ // Show the console
+ [theMonkey suspend];
+ }
}
@@ -202,7 +206,9 @@ -(void)showLess
}
- (void) monkeySuspended:(NSNotification*) notification {
- [self showConsole];
+ if ([FoneMonkey sharedMonkey].state != FMStatePlaying) {
+ [self showConsole];
+ }
}
@@ -395,11 +401,9 @@ - (void) play {
}
- (void) hideConsole {
- [self doMonkeyAction:controlBar];
-
+ [self doMonkeyAction:controlBar];
}
-
- (IBAction) doMonkeyAction:(id)sender {
UISegmentedControl* seg = ((UISegmentedControl*)sender);
NSInteger index = seg.selectedSegmentIndex;

0 comments on commit 161eed7

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