add integration tests for PNG export & scaled export

This commit is contained in:
juliandescottes
2017-01-29 13:56:06 +01:00
parent 8b1b21368c
commit 1918227c81
9 changed files with 554 additions and 61 deletions

View File

@@ -145,7 +145,11 @@
ns.PngExportController.prototype.onDownloadClick_ = function (evt) {
// Create PNG export.
var canvas = this.createPngSpritesheet_();
this.downloadCanvas_(canvas);
};
// Used and overridden in casper integration tests.
ns.PngExportController.prototype.downloadCanvas_ = function (canvas) {
// Generate file name
var name = this.piskelController.getPiskel().getDescriptor().name;
var fileName = name + '.png';

View File

@@ -269,6 +269,19 @@
}
return chunkFrames;
},
toFrameGrid : function (normalGrid) {
var frameGrid = [];
var w = normalGrid[0].length;
var h = normalGrid.length;
for (var x = 0 ; x < w ; x++) {
frameGrid[x] = [];
for (var y = 0 ; y < h ; y++) {
frameGrid[x][y] = normalGrid[y][x];
}
}
return frameGrid;
}
};
})();