This commit is contained in:
Jonathan Willing 2013-01-08 21:36:04 -06:00
Родитель c35ab2e75e
Коммит fd55f3569a
2 изменённых файлов: 5 добавлений и 10 удалений

Просмотреть файл

@ -21,8 +21,7 @@
}
- (void (^)(BOOL))rbl_completionBlock {
NSAssert([self.delegate isKindOfClass:[RBLCAAnimationDelegate class]],
@"Wrong delegate for the animation. Expected %@, but instead got %@.", [RBLCAAnimationDelegate class], [self.delegate class]);
NSAssert([self.delegate isKindOfClass:RBLCAAnimationDelegate.class], @"Wrong delegate for animation %@. Expected %@, but instead got %@.", self, RBLCAAnimationDelegate.class, [self.delegate class]);
return [(RBLCAAnimationDelegate *)self.delegate completion];
}

Просмотреть файл

@ -36,18 +36,14 @@ it(@"should should fire once animation is completed", ^{
CALayer *layer = [CALayer layer];
CABasicAnimation *sampleAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
__block BOOL fired = NO;
[sampleAnimation setRbl_completionBlock:^(BOOL complete) {
sampleAnimation.rbl_completionBlock = ^(BOOL complete) {
fired = YES;
}];
};
sampleAnimation.duration = 0.0;
[layer addAnimation:sampleAnimation forKey:@"opacity"];
layer.opacity = 1.f;
NSDate *runUntil = [NSDate dateWithTimeIntervalSinceNow:0.1];
while (!fired && [runUntil timeIntervalSinceNow] > 0) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:runUntil];
}
expect(fired).to.beTruthy();
expect(fired).will.beTruthy();
});
SpecEnd