Skip to content

Commit

Permalink
fix: use a fixed width and height
Browse files Browse the repository at this point in the history
  • Loading branch information
flekschas committed Jun 26, 2024
1 parent 2da4876 commit bf26afd
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3149,34 +3149,38 @@ test('other methods', async (t2) => {
await t2.test(
'drawAnnotations()',
catchError(async (t) => {
const scatterplot = createScatterplot({ canvas: createCanvas(100, 100) });
const scatterplot = createScatterplot({
canvas: createCanvas(100, 100),
width: 100,
height: 100,
});

await scatterplot.drawAnnotations([
{ x: 0.95, lineColor: [1, 1, 1, 1], lineWidth: 1 },
{ y: 0.95, lineColor: [1, 1, 1, 1], lineWidth: 1 },
{ x: 0.9, lineColor: [1, 1, 1, 0.1], lineWidth: 1 },
{ y: 0.9, lineColor: [1, 1, 1, 0.1], lineWidth: 1 },
{
x1: -0.88,
y1: -0.88,
x2: -0.82,
y2: -0.82,
lineColor: [1, 1, 1, 1],
x1: -0.8,
y1: -0.8,
x2: -0.6,
y2: -0.6,
lineColor: [1, 1, 1, 0.25],
lineWidth: 1,
},
{
x: -0.88,
y: 0.82,
width: 0.06,
height: 0.06,
lineColor: [1, 1, 1, 1],
x: -0.8,
y: 0.6,
width: 0.2,
height: 0.2,
lineColor: [1, 1, 1, 0.25],
lineWidth: 1,
},
{
vertices: [
[0.82, 0.88],
[0.88, 0.88],
[0.88, 0.82],
[0.82, 0.82],
[0.82, 0.88],
[0.6, 0.8],
[0.8, 0.8],
[0.8, 0.6],
[0.6, 0.6],
[0.6, 0.8],
],
lineColor: '#D55E00',
lineWidth: 2,
Expand All @@ -3186,8 +3190,8 @@ test('other methods', async (t2) => {
const img = scatterplot.export();
const w = img.width;
const h = img.height;
const wp = w * 0.05;
const hp = w * 0.05;
const wp = w * 0.1;
const hp = w * 0.1;

t.ok(
getPixelSum(img, 0, w, 0, hp) > 0,
Expand Down

0 comments on commit bf26afd

Please sign in to comment.