Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linting all test files #152

Merged
merged 13 commits into from
Dec 22, 2016
Prev Previous commit
Next Next commit
fix(linebreaks): fixing linebreaks
fabianmoronzirfas committed Dec 21, 2016
commit 6f32155d12f7d01dbe8c7f18578d99d844655549
110 changes: 109 additions & 1 deletion test/transform-tests.jsx
Original file line number Diff line number Diff line change
@@ -1 +1,109 @@
/* globals assert */if (typeof b === "undefined") { // @include "../basil.js";}if (typeof b.test === "undefined") { // @include "../lib/basil.test.js";}b.test("TransformTests", { setUpTest: function(b) { }, tearDownTest: function(b) { }, setUp: function(b) { }, tearDown: function(b) { b.close(SaveOptions.no); }, testMoveX: function(b) { b.rectMode(b.CORNER); var doc = b.doc(); // create box at 0,0 var rect = b.rect(0, 0, 100, 100); assert(b.itemX(rect) === 0); // move to 50,0 b.itemX(rect, 50); // check new x coordinate assert(b.itemX(rect) === 50); rect.remove();// ~ b.rectMode(b.CENTER);// ~ // create box at 0,0// ~ var rect = b.rect(0,0,100,100);// ~// ~ assert( b.itemX(rect) === 0);// ~ // move to 50,0// ~ b.itemX(rect, 50);// ~ // check new x coordinate// ~ assert( b.itemX(rect) === 50);// ~ rect.remove(); }, testMoveY: function(b) { var doc = b.doc(); // create box at 0,0 var rect = b.rect(0, 0, 100, 100); assert(b.itemY(rect) === 0); // move to 50,0 b.itemY(rect, 50); // check new x coordinate assert(b.itemY(rect) === 50); }, testPosition: function(b) { var doc = b.doc(); // create box at 0,0 var rect = b.rect(0, 0, 100, 100); assert(b.itemPosition(rect).x === 0 && b.itemPosition(rect).y === 0); // move to 50,0 b.itemPosition(rect, 50, 50); // check new x coordinate assert(b.itemPosition(rect).x === 50 && b.itemPosition(rect).y === 50); }, testWidth: function(b) { var doc = b.doc(); // create box at 0,0 var rect = b.rect(0, 0, 100, 100); assert(b.itemWidth(rect) === 100); // move to 50,0 b.itemWidth(rect, 50); // check new x coordinate assert(b.itemWidth(rect) === 50); }, testHeight: function(b) { var doc = b.doc(); // create box at 0,0 var rect = b.rect(0, 0, 100, 100); assert(b.itemHeight(rect) === 100); // move to 50,0 b.itemHeight(rect, 50); // check new x coordinate assert(b.itemHeight(rect) === 50); }, testSize: function(b) { var doc = b.doc(); // create box at 0,0 var rect = b.rect(0, 0, 100, 100); assert(b.itemSize(rect).width === 100 && b.itemSize(rect).height === 100); // move to 50,0 b.itemSize(rect, 50, 50); // check new x coordinate assert(b.itemSize(rect).width === 50 && b.itemSize(rect).height === 50); } // todo: add matrix transformation tests here ...});// print collected test resultsb.test.result();
/* globals assert */
if (typeof b === "undefined") {
// @include "../basil.js";
}
if (typeof b.test === "undefined") {
// @include "../lib/basil.test.js";
}

b.test("TransformTests", {

setUpTest: function(b) {
},

tearDownTest: function(b) {
},

setUp: function(b) {
},

tearDown: function(b) {
b.close(SaveOptions.no);
},

testMoveX: function(b) {
b.rectMode(b.CORNER);
var doc = b.doc();
// create box at 0,0
var rect = b.rect(0, 0, 100, 100);
assert(b.itemX(rect) === 0);
// move to 50,0
b.itemX(rect, 50);
// check new x coordinate
assert(b.itemX(rect) === 50);
rect.remove();

// ~ b.rectMode(b.CENTER);
// ~ // create box at 0,0
// ~ var rect = b.rect(0,0,100,100);
// ~
// ~ assert( b.itemX(rect) === 0);
// ~ // move to 50,0
// ~ b.itemX(rect, 50);
// ~ // check new x coordinate
// ~ assert( b.itemX(rect) === 50);
// ~ rect.remove();
},

testMoveY: function(b) {
var doc = b.doc();
// create box at 0,0
var rect = b.rect(0, 0, 100, 100);
assert(b.itemY(rect) === 0);
// move to 50,0
b.itemY(rect, 50);
// check new x coordinate
assert(b.itemY(rect) === 50);
},

testPosition: function(b) {
var doc = b.doc();
// create box at 0,0
var rect = b.rect(0, 0, 100, 100);
assert(b.itemPosition(rect).x === 0 && b.itemPosition(rect).y === 0);
// move to 50,0
b.itemPosition(rect, 50, 50);
// check new x coordinate
assert(b.itemPosition(rect).x === 50 && b.itemPosition(rect).y === 50);
},

testWidth: function(b) {
var doc = b.doc();
// create box at 0,0
var rect = b.rect(0, 0, 100, 100);
assert(b.itemWidth(rect) === 100);
// move to 50,0
b.itemWidth(rect, 50);
// check new x coordinate
assert(b.itemWidth(rect) === 50);
},

testHeight: function(b) {
var doc = b.doc();
// create box at 0,0
var rect = b.rect(0, 0, 100, 100);
assert(b.itemHeight(rect) === 100);
// move to 50,0
b.itemHeight(rect, 50);
// check new x coordinate
assert(b.itemHeight(rect) === 50);
},

testSize: function(b) {
var doc = b.doc();
// create box at 0,0
var rect = b.rect(0, 0, 100, 100);
assert(b.itemSize(rect).width === 100 && b.itemSize(rect).height === 100);
// move to 50,0
b.itemSize(rect, 50, 50);
// check new x coordinate
assert(b.itemSize(rect).width === 50 && b.itemSize(rect).height === 50);
}

// todo: add matrix transformation tests here ...

});

// print collected test results
b.test.result();