forked from facebookarchive/pop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve color conversion; add basic animation unit tests; facebookarc…
- Loading branch information
Kimon Tsinteris
committed
May 2, 2014
1 parent
9d2b04c
commit 701b47d
Showing
5 changed files
with
74 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// POPBasicAnimationTests.m | ||
// pop | ||
// | ||
// Created by Kimon Tsinteris on 5/2/14. | ||
// Copyright (c) 2014 Facebook. All rights reserved. | ||
// | ||
|
||
#import <SenTestingKit/SenTestingKit.h> | ||
|
||
#import <OCMock/OCMock.h> | ||
#import <POP/POPBasicAnimation.h> | ||
|
||
#import "POPAnimatable.h" | ||
#import "POPAnimationTestsExtras.h" | ||
#import "POPBaseAnimationTests.h" | ||
|
||
@interface POPBasicAnimationTests : POPBaseAnimationTests | ||
|
||
@end | ||
|
||
@implementation POPBasicAnimationTests | ||
|
||
- (void)testColorInterpolation | ||
{ | ||
POPBasicAnimation *anim = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerBackgroundColor]; | ||
anim.fromValue = [UIColor whiteColor]; | ||
anim.toValue = [UIColor redColor]; | ||
|
||
POPAnimationTracer *tracer = anim.tracer; | ||
[tracer start]; | ||
|
||
CALayer *layer = [CALayer layer]; | ||
[layer pop_addAnimation:anim forKey:nil]; | ||
|
||
// run animation | ||
POPAnimatorRenderDuration(self.animator, self.beginTime, 3, 1.0/60.0); | ||
|
||
// verify write events | ||
NSArray *writeEvents = [tracer eventsWithType:kPOPAnimationEventPropertyWrite]; | ||
STAssertTrue(writeEvents.count > 5, @"expected more write events %@", tracer.allEvents); | ||
|
||
// assert final value | ||
POPAssertColorEqual((__bridge CGColorRef)anim.toValue, layer.backgroundColor); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters