-
Notifications
You must be signed in to change notification settings - Fork 290
Expand file tree
/
Copy pathawt.test.ts
More file actions
22 lines (19 loc) · 782 Bytes
/
awt.test.ts
File metadata and controls
22 lines (19 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import path from "node:path";
import { beforeAll, describe, expect, test } from "vitest";
import { Java } from "../java";
import { getJava } from "../testHelpers";
describe("AWT", () => {
let java!: Java;
beforeAll(async () => {
java = await getJava();
});
test("calling AWT method (see issue 1)", () => {
const headlessVal = java.callStaticMethodSync("java.lang.System", "getProperty", "java.awt.headless");
console.log("java.awt.headless =", headlessVal);
expect(headlessVal).toBe("true");
const filename = path.join(path.dirname(__filename), "nodejs.png");
const file = java.newInstanceSync("java.io.File", filename);
const image = java.callStaticMethodSync("javax.imageio.ImageIO", "read", file);
expect(image).toBeTruthy();
});
});