Skip to content

Commit

Permalink
Add tests, however non-functional due to lack of File in Node
Browse files Browse the repository at this point in the history
Also add jimp to package.json
  • Loading branch information
mattnotmitt committed Dec 21, 2018
1 parent 5a9583c commit 18693d2
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 35 deletions.
43 changes: 12 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"exif-parser": "^0.1.12",
"file-saver": "^2.0.0-rc.4",
"highlight.js": "^9.13.1",
"jimp": "^0.6.0",
"jquery": "^3.3.1",
"js-crc": "^0.2.0",
"js-sha3": "^0.8.0",
Expand Down
2 changes: 1 addition & 1 deletion src/core/Utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ class Utils {
let dataURI = "data:";
dataURI += type + ";";
dataURI += "base64," + toBase64(buff);
return "<img src='" + dataURI + "'>";
return "<img style='max-width: 100%;' src='" + dataURI + "'>";
} else {
return `<pre>${Utils.escapeHtml(Utils.arrayBufferToStr(buff.buffer))}</pre>`;
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/operations/SplitColourChannels.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class SplitColourChannels extends Operation {
]).getBufferAsync(jimp.MIME_PNG);
resolve(new File([new Uint8Array((await split).values())], "red.png", {type: "image/png"}));
} catch (err) {
reject(new OperationError("Could not split red channel."));
reject(new OperationError(`Could not split red channel: ${err}`));
}
});
const green = new Promise(async (resolve, reject) => {
Expand All @@ -76,7 +76,7 @@ class SplitColourChannels extends Operation {
]).getBufferAsync(jimp.MIME_PNG);
resolve(new File([new Uint8Array((await split).values())], "green.png", {type: "image/png"}));
} catch (err) {
reject(new OperationError("Could not split green channel."));
reject(new OperationError(`Could not split green channel: ${err}`));
}
});
const blue = new Promise(async (resolve, reject) => {
Expand All @@ -88,7 +88,7 @@ class SplitColourChannels extends Operation {
]).getBufferAsync(jimp.MIME_PNG);
resolve(new File([new Uint8Array((await split).values())], "blue.png", {type: "image/png"}));
} catch (err) {
reject(new OperationError("Could not split blue channel."));
reject(new OperationError(`Could not split blue channel: ${err}`));
}
});
return await Promise.all([red, green, blue]);
Expand Down
1 change: 1 addition & 0 deletions test/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import "./tests/operations/SeqUtils";
import "./tests/operations/SetDifference";
import "./tests/operations/SetIntersection";
import "./tests/operations/SetUnion";
import "./tests/operations/SplitColourChannels";
import "./tests/operations/StrUtils";
import "./tests/operations/SymmetricDifference";
import "./tests/operations/TextEncodingBruteForce";
Expand Down
Loading

0 comments on commit 18693d2

Please sign in to comment.