Skip to content

Commit

Permalink
fix: set antialiasing as flag in node bindings (dmtrKovalenko#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
eWert-Online authored Jun 28, 2021
1 parent c438b31 commit f73034c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/node-bindings/odiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function optionsToArgs(options) {
break;

case "antialiasing":
setArgWithValue("antialiasing", value);
setFlag("antialiasing", value);
break;

case "ignoreRegions": {
Expand Down
18 changes: 17 additions & 1 deletion test/node-binding.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test("Outputs correct parsed result when images different", async (t) => {
t.is(diffPercentage, 2.85952484323);
});

test("Correctly parses cli arguments", async (t) => {
test("Correctly parses threshold", async (t) => {
const { reason, diffCount, diffPercentage } = await compare(
path.join(IMAGES_PATH, "donkey.png"),
path.join(IMAGES_PATH, "donkey-2.png"),
Expand All @@ -47,6 +47,22 @@ test("Correctly parses cli arguments", async (t) => {
t.is(diffPercentage, 1.31007003768);
});

test("Correctly parses antialiasing", async (t) => {
const { reason, diffCount, diffPercentage } = await compare(
path.join(IMAGES_PATH, "donkey.png"),
path.join(IMAGES_PATH, "donkey-2.png"),
path.join(IMAGES_PATH, "diff.png"),
{
antialiasing: true,
__binaryPath: BINARY_PATH,
}
)

t.is(reason, 'pixel-diff')
t.is(diffCount, 108208);
t.is(diffPercentage, 2.8164996153);
});

test("Correctly parses ignore regions", async (t) => {
const { match } = await compare(
path.join(IMAGES_PATH, "donkey.png"),
Expand Down

0 comments on commit f73034c

Please sign in to comment.