Fixed test cases

This commit is contained in:
Aparajita Fishman
2013-01-24 09:01:54 +08:00
parent 2fdf51d12c
commit 1f98dbdf65
11 changed files with 27 additions and 21 deletions
+4
View File
@@ -2,6 +2,10 @@
@import "CGTestCase.j"
// These are left undefined in CGContext.j if CPFeatureIsCompatible(CPHTMLCanvasFeature)
@global CGGStateCreate
@global CGGStateCreateCopy
@implementation CGContextTest : CGTestCase
- (void)testEnsureTestingCanvas
+8 -6
View File
@@ -14,7 +14,8 @@
var control = [[CPCheckBox alloc] initWithFrame:CGRectMakeZero()];
[control setAllowsMixedState:YES];
var content = [
var content =
[
CPOffState,
CPOnState
],
@@ -78,11 +79,12 @@
{
var control = [[CPCheckBox alloc] initWithFrame:CGRectMakeZero()];
content = [
[CPDictionary dictionaryWithObject:YES forKey:@"state"],
[CPDictionary dictionaryWithObject:NO forKey:@"state"]
];
arrayController = [[CPArrayController alloc] initWithContent:content];
var content =
[
[CPDictionary dictionaryWithObject:YES forKey:@"state"],
[CPDictionary dictionaryWithObject:NO forKey:@"state"]
],
arrayController = [[CPArrayController alloc] initWithContent:content];
// First test defaults.
[control bind:CPValueBinding toObject:arrayController withKeyPath:@"selection.state" options:[CPDictionary dictionaryWithObject:@"CPNegateBoolean" forKey:CPValueTransformerNameBindingOption]];
+2 -2
View File
@@ -160,7 +160,7 @@
[tableView addTableColumn:tableColumn];
content = [
var content = [
[AccessCounter counterWithValueA:"1" valueB:"2"],
[AccessCounter counterWithValueA:"3" valueB:"4"],
[AccessCounter counterWithValueA:"5" valueB:"6"],
@@ -229,7 +229,7 @@
[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"];
content = [
var content = [
[BindingTester testerWithCheese:@"yellow"],
[BindingTester testerWithCheese:@"green"],
];
+2
View File
@@ -41,6 +41,7 @@
selector = tests[i + 2];
responder.doCommandCalls = [];
var keyEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:0
timestamp:0 windowNumber:0 context:nil
characters:character charactersIgnoringModifiers:character isARepeat:NO keyCode:keyCode];
@@ -52,6 +53,7 @@
- (void)testInterpretKeyEventsWithModifierFlags
{
responder.doCommandCalls = [];
var keyEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:CPShiftKeyMask
timestamp:0 windowNumber:0 context:nil
characters:CPLeftArrowFunctionKey charactersIgnoringModifiers:CPLeftArrowFunctionKey isARepeat:NO keyCode:CPKeyCodes.LEFT];
+1
View File
@@ -23,6 +23,7 @@
var slider = [[CPSlider alloc] initWithFrame:CGRectMakeZero()];
[slider setContinuous:NO];
var decoded = [CPKeyedUnarchiver unarchiveObjectWithData:[CPKeyedArchiver archivedDataWithRootObject:slider]];
[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/CPSortDescriptor.j>
@global module
var ELEMENTS = 100,
REPEATS = 10;
+2 -5
View File
@@ -143,11 +143,8 @@
- (void)testNormalize
{
var dcm1,
dcm2;
dcm1 = CPDecimalMakeWithString( @"200" );
dcm2 = CPDecimalMakeWithString( @"2" );
var dcm1 = CPDecimalMakeWithString( @"200" ),
dcm2 = CPDecimalMakeWithString( @"2" );
[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:0 equals:dcm1._exponent message:"CPDecimalNormalise() Tn1: exponent"];
+1 -1
View File
@@ -7,7 +7,7 @@
- (void)setUp
{
exception = [CPException exceptionWithName:@"CPGenericException"
var exception = [CPException exceptionWithName:@"CPGenericException"
reason:@"Margins must be positive"
userInfo:nil];
}
+1 -1
View File
@@ -19,8 +19,8 @@
{
var so = [[SomeObject alloc] init],
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 start];
+2 -5
View File
@@ -449,11 +449,8 @@
- (void)testMutableCopy
{
var normalArray = [CPArray array];
[self assertThrows:function () { [array addObject:[CPNull null]] }];
var mutableArray = [normalArray mutableCopy];
var normalArray = [],
mutableArray = [normalArray mutableCopy];
[mutableArray addObject:[CPNull null]];
+2 -1
View File
@@ -1,3 +1,4 @@
@global module
var FILE = require("file"),
FileList = require("jake").FileList;
@@ -19,7 +20,7 @@ var FILE = require("file"),
var path = FILE.join(FILE.dirname(module.path), "PropertyLists/XMLDate.plist"),
object = CFPropertyList.readPropertyListFromFile(path),
date = [object objectForKey:@"date"];
[self assert:[CPDate class] equals:[date class]];
[self assert:[[CPDate alloc] initWithString:"2012-01-01 10:00:00 +0100"] equals:date];
}