Skip to content

Commit 5ecaef1

Browse files
committed
Broaden definition of narrow screenshots
1 parent 96c616a commit 5ecaef1

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

test/unit/visual/cases/typography.js

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,10 @@ visualSuite("Typography", function () {
5656
});
5757

5858
visualTest('with a directly set font string', async function (p5, screenshot) {
59-
const link = document.createElement('link');
60-
link.id = 'font';
61-
link.href = 'https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..800;1,400..800&display=swap';
62-
link.rel = 'stylesheet';
63-
document.head.appendChild(link);
64-
try {
65-
await document.fonts.ready;
66-
await new Promise((res) => setTimeout(res, 500))
67-
68-
p5.createCanvas(100, 100);
69-
p5.textFont(`italic bold 32px "EB Garamond"`);
70-
p5.text('p5*js', 0, 10, p5.width);
71-
screenshot();
72-
} finally {
73-
document.head.removeChild(link);
74-
}
59+
p5.createCanvas(100, 100);
60+
p5.textFont(`italic bold 32px serif`);
61+
p5.text('p5*js', 0, 10, p5.width);
62+
screenshot();
7563
});
7664

7765
visualTest('with a font file in WebGL', async function (p5, screenshot) {
27 Bytes
Loading

test/unit/visual/visualTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export async function checkMatch(actual, expected, p5) {
8686
// Long screenshots end up super tiny when fit to a small square, so we
8787
// can double the max side length for these
8888
const ratio = expected.width / expected.height;
89-
const narrow = ratio < 0.5 || ratio > 2;
89+
const narrow = ratio !== 1;
9090
if (narrow) {
9191
scale *= 2;
9292
}

0 commit comments

Comments
 (0)