diff --git a/docs/sample/test.html b/docs/sample/test.html
index 339d0dbf..8a7ecf6c 100755
--- a/docs/sample/test.html
+++ b/docs/sample/test.html
@@ -15,6 +15,10 @@
const urlParams = new URLSearchParams(window.location.search);
const video = Number(urlParams.get("video") || 0);
const time = Number(urlParams.get("time") || 0);
+ const canvasWidth = Number(urlParams.get("width") || 1920);
+ const canvasHeight = Number(urlParams.get("height") || 1080);
+ canvasElement.width = canvasWidth;
+ canvasElement.height = canvasHeight;
const req = await fetch(`./commentdata/${video}.json`);
const res = await req.json();
const nico = new NiconiComments(canvasElement, res, {
diff --git a/src/__tests__/test.spec.ts b/src/__tests__/test.spec.ts
index 1b2a1c0b..4bf1c5fc 100755
--- a/src/__tests__/test.spec.ts
+++ b/src/__tests__/test.spec.ts
@@ -35,8 +35,19 @@ test("22(ヨワイボクラハウタウ)", async ({ page }) => {
});
const compare = async (page: Page, video: number, time: number) => {
+ await _compare(page, video, time);
+ await _compare(page, video, time, 1280, 720);
+};
+
+const _compare = async (
+ page: Page,
+ video: number,
+ time: number,
+ width = 1920,
+ height = 1080,
+) => {
await page.goto(
- `http://localhost:8080/docs/sample/test.html?time=${time}&video=${video}`,
+ `http://localhost:8080/docs/sample/test.html?time=${time}&video=${video}&width=${width}&height=${height}`,
);
await Promise.all([
page.waitForSelector("div#loaded", { state: "attached" }),
@@ -45,6 +56,6 @@ const compare = async (page: Page, video: number, time: number) => {
await expect(page).toHaveScreenshot(`${video}-${time}.png`);
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot(
`${video}-${time}.png`,
- { threshold: 0.075 },
+ { threshold: 0.1 },
);
};