Add integration tests for resize content and resize from other origin

This commit is contained in:
juliandescottes
2017-01-08 20:38:12 +01:00
parent a328e4d20e
commit 70085bc056
9 changed files with 213 additions and 25 deletions

View File

@@ -1,3 +1,5 @@
/* globals casper */
/**
* Collection of shared methods for casperjs integration tests.
*/
@@ -22,6 +24,32 @@ function isChecked(selector) {
}');
}
function setPiskelFromGrid(grid) {
casper.evaluate(
'function () {\
var B = "#000000", T = Constants.TRANSPARENT_COLOR;\
var frame = pskl.model.Frame.fromPixelGrid(' + grid + ');\
var layer = pskl.model.Layer.fromFrames("l1", [frame]);\
var piskel = pskl.model.Piskel.fromLayers([layer], 12, {name : "test", description : ""});\
pskl.app.piskelController.setPiskel(piskel);\
}');
}
function piskelFrameEqualsGrid(grid, layer, frame) {
return casper.evaluate(
'function () {\
var B = "#000000", T = Constants.TRANSPARENT_COLOR;\
var piskel = pskl.app.piskelController.getPiskel();\
var frame = piskel.getLayerAt(' + layer +').getFrameAt(' + frame + ');\
var grid = ' + grid +';\
var isValid = true;\
frame.forEachPixel(function (color, col, row) {\
isValid = isValid && pskl.utils.colorToInt(color) === pskl.utils.colorToInt(grid[row][col]);\
});\
return isValid;\
}');
}
function isDrawerExpanded() {
return casper.evaluate(function () {
var settingsElement = document.querySelector('[data-pskl-controller="settings"]');