test : add unit test for ColorUtils

This commit is contained in:
juliandescottes
2015-04-13 13:02:12 +02:00
parent 0e817a88a7
commit ba491736c1
3 changed files with 42 additions and 14 deletions

View File

@@ -117,10 +117,10 @@
ns.GifExportController.prototype.renderAsImageDataAnimatedGIF = function(zoom, fps, cb) {
var currentColors = pskl.app.currentColorsService.computeCurrentColors();
var preserveColors = currentColors.length < MAX_GIF_COLORS;
var transparentColor = this.getTransparentColor(currentColors);
var gif = new window.GIF({
workers: 5,
quality: 1,
@@ -155,17 +155,16 @@
ns.GifExportController.prototype.getTransparentColor = function(currentColors) {
var transparentColor = pskl.utils.ColorUtils.getUnusedColor(currentColors);
if (!transparentColor) {
console.error('Unable to find unused color to use as transparent color in the current sprite');
transparentColor = MAGIC_PINK;
} else {
transparentColor = window.tinycolor(transparentColor).toHexString();
}
return transparentColor;
};
// FIXME : HORRIBLE COPY/PASTA
// FIXME : JD : HORRIBLE COPY/PASTA (JD later : where???)
ns.GifExportController.prototype.updateStatus_ = function (imageUrl, error) {
if (imageUrl) {
var linkTpl = "<a class='image-link' href='{{link}}' target='_blank'>{{shortLink}}</a>";