Files
cappuccino/Tests/AppKit/CPAnimationTest.j
T
Alexandre Wilhelm 6fe9dae3d6 Fixed: AppKit unit-tests are not standalone
Previously, every AppKit tests used the same sharedApplication. Due to this implementation, a could not pass because a previous test made failed the current test. For instance, a test could fail because the window of the previous test resigned (just imagine a new window is the key window in the current test), and this resign could raise an error. The error was displayed for the current test thought this test was perfect !

We now instead of using sharedApplication create a new CPApplication per unit-test file in the class method setUp.
2015-07-07 14:12:19 -07:00

52 lines
1.2 KiB
Plaintext

@import <AppKit/CPApplication.j>
@import <AppKit/CPAnimation.j>
@implementation CPAnimation (TestMethods)
{
}
- (CPTimer)timer
{
return _timer;
}
@end
@implementation CPAnimationTest : OJTestCase
{
}
+ (void)setUp
{
// This will init the global var CPApp which are used internally in the AppKit
[[CPApplication alloc] init];
}
- (void)testScheduleTimerWithIntervalBasedOnDefaultFrameRate
{
var animation = [[CPAnimation alloc] initWithDuration:0.1 animationCurve:CPAnimationLinear];
[animation startAnimation];
[self assert:1.0/60.0 equals:[[animation timer] timeInterval]];
}
- (void)testScheduleTimerWithIntervalBasedOnCustomFrameRate
{
var animation = [[CPAnimation alloc] initWithDuration:0.1 animationCurve:CPAnimationLinear];
[animation setFrameRate:30];
[animation startAnimation];
[self assert:1.0/30.0 equals:[[animation timer] timeInterval]];
}
- (void)testScheduleTimerWithIntervalBasedOnAsFastAsPossibleFrameRate
{
var animation = [[CPAnimation alloc] initWithDuration:0.1 animationCurve:CPAnimationLinear];
[animation setFrameRate:0];
[animation startAnimation];
[self assert:0.0001 equals:[[animation timer] timeInterval]];
}
@end