mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Add integration tests for resize content and resize from other origin
This commit is contained in:
@@ -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"]');
|
||||
|
||||
Reference in New Issue
Block a user