Skip to content
This repository was archived by the owner on Aug 7, 2019. It is now read-only.

Commit 5053bf1

Browse files
author
Onur Guengoeren
committed
fixed changing to stopped state after no continuos playback url is given
1 parent 4c920f2 commit 5053bf1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

OrigamiEngine/ORGMEngine.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ - (void)observeValueForKeyPath:(NSString *)keyPath
191191
});
192192
} else if ([keyPath isEqualToString:@"endOfInput"]) {
193193
NSURL *nextUrl = [_delegate engineExpectsNextUrl:self];
194-
if (!nextUrl)
194+
if (!nextUrl) {
195+
[self setCurrentState:ORGMEngineStateStopped];
195196
return;
197+
}
196198

197199
dispatch_async(dispatch_get_main_queue(), ^{
198200
[self setNextUrl:nextUrl withDataFlush:NO];

OrigamiEngineTests/EngineTests.m

+10
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,14 @@ - (void)testEngineDelegateShouldRequestNextTrackFromDelegate {
7878
STAssertTrue(_tester.trackRequested, nil);
7979
}
8080

81+
- (void)testEngineShouldChangeStateToStoppedIfNoNextTrackIsGiven {
82+
NSDate *loopUntil = [NSDate dateWithTimeIntervalSinceNow:3.0];
83+
while ([loopUntil timeIntervalSinceNow] > 0) {
84+
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
85+
beforeDate:loopUntil];
86+
}
87+
STAssertTrue(_engine.currentState, ORGMEngineStateStopped);
88+
}
89+
90+
8191
@end

0 commit comments

Comments
 (0)