diff options
author | dmaclach <dmaclach@gmail.com> | 2018-11-12 07:57:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-12 07:57:33 -0800 |
commit | c38a238b32e0e9a96d9a36d65f289ce3316008dc (patch) | |
tree | 7258c7c56741b5a4935e0805e01a7b6ab331e72a | |
parent | 979557ed225d7a5f2644d157f11e234b8aedfefd (diff) |
Move animation over to XCTestExpectation (#187)
-rw-r--r-- | AppKit/GTMKeyValueAnimationTest.m | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/AppKit/GTMKeyValueAnimationTest.m b/AppKit/GTMKeyValueAnimationTest.m index aef262b..dd592e4 100644 --- a/AppKit/GTMKeyValueAnimationTest.m +++ b/AppKit/GTMKeyValueAnimationTest.m @@ -18,38 +18,37 @@ #import "GTMSenTestCase.h" #import "GTMKeyValueAnimation.h" -#import "GTMFoundationUnitTestingUtilities.h" @interface GTMKeyValueAnimationTest : GTMTestCase <NSAnimationDelegate> { @private - GTMUnitTestingBooleanRunLoopContext *context_; - BOOL shouldStartHit_; + XCTestExpectation *oggleExpectation_; + XCTestExpectation *shouldStartExpectation_; } @end @implementation GTMKeyValueAnimationTest - (void)testAnimation { - shouldStartHit_ = NO; GTMKeyValueAnimation *anim = [[[GTMKeyValueAnimation alloc] initWithTarget:self keyPath:@"oggle"] autorelease]; + oggleExpectation_ = [self expectationWithDescription:@"oggle"]; + // We are going to get called multiple times. + oggleExpectation_.assertForOverFulfill = NO; + shouldStartExpectation_ = [self expectationWithDescription:@"shouldStart"]; [anim setDelegate:self]; [anim startAnimation]; - context_ = [GTMUnitTestingBooleanRunLoopContext context]; - [[NSRunLoop currentRunLoop] gtm_runUpToSixtySecondsWithContext:context_]; + [self waitForExpectationsWithTimeout:60 handler:NULL]; [anim stopAnimation]; - XCTAssertTrue([context_ shouldStop], @"Animation value never got set"); - XCTAssertTrue(shouldStartHit_, @"animationShouldStart not called"); } - (BOOL)animationShouldStart:(NSAnimation*)animation { - shouldStartHit_ = YES; + [shouldStartExpectation_ fulfill]; return YES; } - (void)setOggle:(CGFloat)oggle { - [context_ setShouldStop:YES]; + [oggleExpectation_ fulfill]; } @end |