2012-05-12 03:03:32 +08:00
|
|
|
// this is to test the test bindings :)
|
|
|
|
|
|
|
|
var simple1 = new SimpleNativeClass();
|
|
|
|
|
|
|
|
// testing the getters and the constructor (that set some fields)
|
2012-06-29 15:47:47 +08:00
|
|
|
cc.log("someField: " + simple1.someField);
|
|
|
|
cc.log("someOtherField: " + simple1.someOtherField);
|
|
|
|
cc.log("anotherMoreComplexField: " + simple1.anotherMoreComplexField);
|
2012-05-12 03:03:32 +08:00
|
|
|
|
|
|
|
// testing the setters
|
|
|
|
simple1.someField = 1313;
|
|
|
|
simple1.someOtherField = 999;
|
|
|
|
simple1.anotherMoreComplexField = "this is a js string";
|
|
|
|
|
2012-06-29 15:47:47 +08:00
|
|
|
cc.log("someField: " + simple1.someField);
|
|
|
|
cc.log("someOtherField: " + simple1.someOtherField);
|
|
|
|
cc.log("anotherMoreComplexField: " + simple1.anotherMoreComplexField);
|
2012-05-12 03:03:32 +08:00
|
|
|
|
|
|
|
// testing std::string conversion
|
|
|
|
|
2012-06-29 15:47:47 +08:00
|
|
|
cc.log("someProcessing: " + simple1.doSomeProcessing("this is some js string", "this is another javascript string"));
|
2012-05-12 03:03:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
var another = new AnotherClass();
|
|
|
|
// testing the getters and the constructor (that set some fields)
|
2012-06-29 15:47:47 +08:00
|
|
|
cc.log("justOneField: " + another.justOneField);
|
|
|
|
cc.log("aPublicField: " + another.aPublicField);
|
2012-05-12 03:03:32 +08:00
|
|
|
|
|
|
|
// testing setters, the setter for justOneField should not work (since it's not defined correctly in the native class)
|
|
|
|
another.justOneField = 8888;
|
|
|
|
another.aPublicField = 6667;
|
2012-06-29 15:47:47 +08:00
|
|
|
cc.log("justOneField: " + another.justOneField);
|
|
|
|
cc.log("aPublicField: " + another.aPublicField);
|
2012-05-12 03:03:32 +08:00
|
|
|
|
|
|
|
// should print something in stderr
|
|
|
|
another.doSomethingSimple();
|
2012-05-19 06:21:24 +08:00
|
|
|
|
|
|
|
//should print the enum
|
2012-06-29 15:47:47 +08:00
|
|
|
cc.log("enum: " + someThingEnumerated.kValue1);
|
|
|
|
cc.log("enum: " + someThingEnumerated.kValue2);
|
|
|
|
cc.log("enum: " + someThingEnumerated.kValue3);
|
|
|
|
cc.log("enum: " + someThingEnumerated.kValue4);
|