mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-28 02:48:49 +00:00
Fixed test cases
This commit is contained in:
1 parent
2fdf51d12c
commit
1f98dbdf65
11 files changed
+26
-20
No files matched your search
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
@import "CGTestCase.j"
|
@import "CGTestCase.j"
|
||||||
|
|
||||||
|
// These are left undefined in CGContext.j if CPFeatureIsCompatible(CPHTMLCanvasFeature)
|
||||||
|
@global CGGStateCreate
|
||||||
|
@global CGGStateCreateCopy
|
||||||
|
|
||||||
@implementation CGContextTest : CGTestCase
|
@implementation CGContextTest : CGTestCase
|
||||||
|
|
||||||
- (void)testEnsureTestingCanvas
|
- (void)testEnsureTestingCanvas
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
var control = [[CPCheckBox alloc] initWithFrame:CGRectMakeZero()];
|
var control = [[CPCheckBox alloc] initWithFrame:CGRectMakeZero()];
|
||||||
[control setAllowsMixedState:YES];
|
[control setAllowsMixedState:YES];
|
||||||
|
|
||||||
var content = [
|
var content =
|
||||||
|
[
|
||||||
CPOffState,
|
CPOffState,
|
||||||
CPOnState
|
CPOnState
|
||||||
],
|
],
|
||||||
@@ -78,11 +79,12 @@
|
|||||||
{
|
{
|
||||||
var control = [[CPCheckBox alloc] initWithFrame:CGRectMakeZero()];
|
var control = [[CPCheckBox alloc] initWithFrame:CGRectMakeZero()];
|
||||||
|
|
||||||
content = [
|
var content =
|
||||||
[CPDictionary dictionaryWithObject:YES forKey:@"state"],
|
[
|
||||||
[CPDictionary dictionaryWithObject:NO forKey:@"state"]
|
[CPDictionary dictionaryWithObject:YES forKey:@"state"],
|
||||||
];
|
[CPDictionary dictionaryWithObject:NO forKey:@"state"]
|
||||||
arrayController = [[CPArrayController alloc] initWithContent:content];
|
],
|
||||||
|
arrayController = [[CPArrayController alloc] initWithContent:content];
|
||||||
|
|
||||||
// First test defaults.
|
// First test defaults.
|
||||||
[control bind:CPValueBinding toObject:arrayController withKeyPath:@"selection.state" options:[CPDictionary dictionaryWithObject:@"CPNegateBoolean" forKey:CPValueTransformerNameBindingOption]];
|
[control bind:CPValueBinding toObject:arrayController withKeyPath:@"selection.state" options:[CPDictionary dictionaryWithObject:@"CPNegateBoolean" forKey:CPValueTransformerNameBindingOption]];
|
||||||
|
|||||||
@@ -160,7 +160,7 @@
|
|||||||
|
|
||||||
[tableView addTableColumn:tableColumn];
|
[tableView addTableColumn:tableColumn];
|
||||||
|
|
||||||
content = [
|
var content = [
|
||||||
[AccessCounter counterWithValueA:"1" valueB:"2"],
|
[AccessCounter counterWithValueA:"1" valueB:"2"],
|
||||||
[AccessCounter counterWithValueA:"3" valueB:"4"],
|
[AccessCounter counterWithValueA:"3" valueB:"4"],
|
||||||
[AccessCounter counterWithValueA:"5" valueB:"6"],
|
[AccessCounter counterWithValueA:"5" valueB:"6"],
|
||||||
@@ -229,7 +229,7 @@
|
|||||||
[textField bind:@"hidden" toObject:self withKeyPath:@"FOO" options:nil];
|
[textField bind:@"hidden" toObject:self withKeyPath:@"FOO" options:nil];
|
||||||
[self assert:@"cheese" equals:[textField placeholderString] message:"placeholder should not be cleared when a binding is established"];
|
[self assert:@"cheese" equals:[textField placeholderString] message:"placeholder should not be cleared when a binding is established"];
|
||||||
|
|
||||||
content = [
|
var content = [
|
||||||
[BindingTester testerWithCheese:@"yellow"],
|
[BindingTester testerWithCheese:@"yellow"],
|
||||||
[BindingTester testerWithCheese:@"green"],
|
[BindingTester testerWithCheese:@"green"],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
selector = tests[i + 2];
|
selector = tests[i + 2];
|
||||||
|
|
||||||
responder.doCommandCalls = [];
|
responder.doCommandCalls = [];
|
||||||
|
|
||||||
var keyEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:0
|
var keyEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:0
|
||||||
timestamp:0 windowNumber:0 context:nil
|
timestamp:0 windowNumber:0 context:nil
|
||||||
characters:character charactersIgnoringModifiers:character isARepeat:NO keyCode:keyCode];
|
characters:character charactersIgnoringModifiers:character isARepeat:NO keyCode:keyCode];
|
||||||
@@ -52,6 +53,7 @@
|
|||||||
- (void)testInterpretKeyEventsWithModifierFlags
|
- (void)testInterpretKeyEventsWithModifierFlags
|
||||||
{
|
{
|
||||||
responder.doCommandCalls = [];
|
responder.doCommandCalls = [];
|
||||||
|
|
||||||
var keyEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:CPShiftKeyMask
|
var keyEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:CPShiftKeyMask
|
||||||
timestamp:0 windowNumber:0 context:nil
|
timestamp:0 windowNumber:0 context:nil
|
||||||
characters:CPLeftArrowFunctionKey charactersIgnoringModifiers:CPLeftArrowFunctionKey isARepeat:NO keyCode:CPKeyCodes.LEFT];
|
characters:CPLeftArrowFunctionKey charactersIgnoringModifiers:CPLeftArrowFunctionKey isARepeat:NO keyCode:CPKeyCodes.LEFT];
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
var slider = [[CPSlider alloc] initWithFrame:CGRectMakeZero()];
|
var slider = [[CPSlider alloc] initWithFrame:CGRectMakeZero()];
|
||||||
|
|
||||||
[slider setContinuous:NO];
|
[slider setContinuous:NO];
|
||||||
|
|
||||||
var decoded = [CPKeyedUnarchiver unarchiveObjectWithData:[CPKeyedArchiver archivedDataWithRootObject:slider]];
|
var decoded = [CPKeyedUnarchiver unarchiveObjectWithData:[CPKeyedArchiver archivedDataWithRootObject:slider]];
|
||||||
[self assert:[slider isContinuous] equals:[decoded isContinuous] message:@"a decoded slider should preserve isContinuous (NO case)"];
|
[self assert:[slider isContinuous] equals:[decoded isContinuous] message:@"a decoded slider should preserve isContinuous (NO case)"];
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ var FILE = require("file");
|
|||||||
@import <Foundation/CPNumber.j>
|
@import <Foundation/CPNumber.j>
|
||||||
@import <Foundation/CPSortDescriptor.j>
|
@import <Foundation/CPSortDescriptor.j>
|
||||||
|
|
||||||
|
@global module
|
||||||
|
|
||||||
var ELEMENTS = 100,
|
var ELEMENTS = 100,
|
||||||
REPEATS = 10;
|
REPEATS = 10;
|
||||||
|
|
||||||
|
|||||||
@@ -143,11 +143,8 @@
|
|||||||
|
|
||||||
- (void)testNormalize
|
- (void)testNormalize
|
||||||
{
|
{
|
||||||
var dcm1,
|
var dcm1 = CPDecimalMakeWithString( @"200" ),
|
||||||
dcm2;
|
dcm2 = CPDecimalMakeWithString( @"2" );
|
||||||
|
|
||||||
dcm1 = CPDecimalMakeWithString( @"200" );
|
|
||||||
dcm2 = CPDecimalMakeWithString( @"2" );
|
|
||||||
[self assert:0 equals:CPDecimalNormalize(dcm1,dcm2,CPRoundDown) message:"CPDecimalNormalise() Tn1:call" ];
|
[self assert:0 equals:CPDecimalNormalize(dcm1,dcm2,CPRoundDown) message:"CPDecimalNormalise() Tn1:call" ];
|
||||||
[self assert:[2,0,0] equals:dcm1._mantissa message:"CPDecimalNormalise() Tn1: mantissa"];
|
[self assert:[2,0,0] equals:dcm1._mantissa message:"CPDecimalNormalise() Tn1: mantissa"];
|
||||||
[self assert:0 equals:dcm1._exponent message:"CPDecimalNormalise() Tn1: exponent"];
|
[self assert:0 equals:dcm1._exponent message:"CPDecimalNormalise() Tn1: exponent"];
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
- (void)setUp
|
- (void)setUp
|
||||||
{
|
{
|
||||||
exception = [CPException exceptionWithName:@"CPGenericException"
|
var exception = [CPException exceptionWithName:@"CPGenericException"
|
||||||
reason:@"Margins must be positive"
|
reason:@"Margins must be positive"
|
||||||
userInfo:nil];
|
userInfo:nil];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
{
|
{
|
||||||
var so = [[SomeObject alloc] init],
|
var so = [[SomeObject alloc] init],
|
||||||
someVar = nil,
|
someVar = nil,
|
||||||
|
funcOp = [CPFunctionOperation functionOperationWithFunction:function() {[so setAString:@"Hello World"]}];
|
||||||
|
|
||||||
funcOp = [CPFunctionOperation functionOperationWithFunction:function() { [so setAString:@"Hello World"] }];
|
|
||||||
[funcOp addExecutionFunction:function() {someVar = 'Soylent Green';}];
|
[funcOp addExecutionFunction:function() {someVar = 'Soylent Green';}];
|
||||||
[funcOp start];
|
[funcOp start];
|
||||||
|
|
||||||
|
|||||||
@@ -449,11 +449,8 @@
|
|||||||
|
|
||||||
- (void)testMutableCopy
|
- (void)testMutableCopy
|
||||||
{
|
{
|
||||||
var normalArray = [CPArray array];
|
var normalArray = [],
|
||||||
|
mutableArray = [normalArray mutableCopy];
|
||||||
[self assertThrows:function () { [array addObject:[CPNull null]] }];
|
|
||||||
|
|
||||||
var mutableArray = [normalArray mutableCopy];
|
|
||||||
|
|
||||||
[mutableArray addObject:[CPNull null]];
|
[mutableArray addObject:[CPNull null]];
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@global module
|
||||||
|
|
||||||
var FILE = require("file"),
|
var FILE = require("file"),
|
||||||
FileList = require("jake").FileList;
|
FileList = require("jake").FileList;
|
||||||
|
|||||||
Reference in new issue
Block a user