Added support for {DELAY=<delay>} to allow for custom delay in command execution instead of using dedicated UI and settings for this

This commit is contained in:
Michael Starke
2019-06-17 15:38:12 +02:00
parent 3ef2c01859
commit 8d66621803
5 changed files with 62 additions and 17 deletions

View File

@@ -31,7 +31,7 @@
[super tearDown];
}
- (void)testValidDelayCommands {
- (void)testLocalDelayCommands {
/* Command 1 */
MPAutotypeContext *context = [[MPAutotypeContext alloc] initWithEntry:self.entry andSequence:@"{DELAY 200}"];
NSArray *commands = [MPAutotypeCommand commandsForContext:context];
@@ -41,8 +41,23 @@
XCTAssertTrue([commands.firstObject isKindOfClass:[MPAutotypeDelay class]], @"Command is Delay command");
MPAutotypeDelay *delay = commands.firstObject;
XCTAssertEqual(delay.delay, 200, @"Delay is 200 ms");
XCTAssertFalse(delay.isGlobal, @"Delay is no global delay");
}
- (void)testGlobalDelayCommands {
/* Command 1 */
MPAutotypeContext *context = [[MPAutotypeContext alloc] initWithEntry:self.entry andSequence:@"{DELAY=200}"];
NSArray *commands = [MPAutotypeCommand commandsForContext:context];
XCTAssertEqual(commands.count, 1);
/* {DELAY=200} */
XCTAssertTrue([commands.firstObject isKindOfClass:MPAutotypeDelay.class], @"Command is Delay command");
MPAutotypeDelay *delay = commands.firstObject;
XCTAssertEqual(delay.delay, 200, @"Delay is 200 ms");
XCTAssertTrue(delay.isGlobal, @"Delay is global delay");
}
- (void)testDelayExecution {
MPAutotypeDelay *delay = [[MPAutotypeDelay alloc] initWithDelay:200];
XCTestExpectation *expectation = [self expectationWithDescription:delay.description];