Spaces:
Sleeping
Sleeping
File size: 1,275 Bytes
3530df7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | import { describe, expect, test } from "vitest";
import { createJimp } from "@jimp/core";
import { makeTestImage } from "@jimp/test-utils";
import { methods } from "./index.js";
const jimp = createJimp({ plugins: [methods] });
describe("Flipping plugin", () => {
test("can flip horizontally", () => {
const src = jimp.fromBitmap(
makeTestImage(
"AAAABBBB",
"AAABAAAB",
"ABABABAB",
"CCCCCCCC",
"CCCCCCCC",
"CCCCCCCC",
"AACCCCAA",
),
);
expect(src.flip({ horizontal: true })).toMatchSnapshot();
});
test("can flip vertically", () => {
const src = jimp.fromBitmap(
makeTestImage(
"AAAABBBB",
"AAABAAAB",
"ABABABAB",
"CCCCCCCC",
"CCCCCCCC",
"CCCCCCCC",
"AACCCCAA",
),
);
expect(src.flip({ vertical: true })).toMatchSnapshot();
});
test("can flip both horizontally and vertically at once", async () => {
const src = jimp.fromBitmap(
makeTestImage(
"AAAABBBB",
"AAABAAAB",
"ABABABAB",
"CCCCCCCC",
"CCCCCCCC",
"CCCCCCCC",
"AACCCCAA",
),
);
expect(src.flip({ horizontal: true, vertical: true })).toMatchSnapshot();
});
});
|