mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 22:51:28 +00:00
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.
37 lines
1020 B
Plaintext
37 lines
1020 B
Plaintext
@import <AppKit/CPColorWell.j>
|
|
@import <AppKit/CPApplication.j>
|
|
|
|
@implementation CPColorWellTest : OJTestCase
|
|
{
|
|
CPColorWell colorWell;
|
|
}
|
|
|
|
+ (void)setUp
|
|
{
|
|
// This will init the global var CPApp which are used internally in the AppKit
|
|
[[CPApplication alloc] init];
|
|
}
|
|
|
|
- (void)setUp
|
|
{
|
|
colorWell = [[CPColorWell alloc] initWithFrame:CGRectMakeZero()];
|
|
}
|
|
|
|
- (void)testCoding
|
|
{
|
|
[self assertTrue:[colorWell isBordered] message:"color well bordered"];
|
|
[self assert:[CPColor whiteColor] equals:[colorWell color] message:"color well default color"];
|
|
|
|
[colorWell setColor:[CPColor greenColor]];
|
|
[colorWell setBordered:NO];
|
|
|
|
// Test archiving.
|
|
var archived = [CPKeyedArchiver archivedDataWithRootObject:colorWell],
|
|
unarchived = [CPKeyedUnarchiver unarchiveObjectWithData:archived];
|
|
|
|
[self assertFalse:[colorWell isBordered] message:"color well archived bordered state"];
|
|
[self assert:[CPColor greenColor] equals:[colorWell color] message:"color well archived color"];
|
|
}
|
|
|
|
@end
|