Automattic / Automattic/node-canvas

`measureText()` produces some incorrect values in Linux prebuilds

Open
#2,150 0 comments 0 reactions 0 assignees View on GitHub
Text & Fonts
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

These two tests are failing for the Linux prebuilds. These pass in CI.

---

```
1) Canvas
Context2d#measureText()
works:

AssertionError [ERR_ASSERTION]: Expected 14 to be 0.5 +/- 0.5

at assertApprox (test/canvas.test.js:24:3)
at Context. (test/canvas.test.js:959:7)
```
https://github.com/Automattic/node-canvas/blob/672104c1a4bd202e56d8837ef83ebf7aee2dfce2/test/canvas.test.js#L955-L959

That assertion is also wrong. It should be 0 +/- something small.

---

```
2) Canvas
Context2d#measureText()
actualBoundingBox is correct for left, center and right alignment (#1909):

AssertionError [ERR_ASSERTION]: Expected 39 to be 21 +/- 6

at assertApprox (test/canvas.test.js:24:3)
at Context. (test/canvas.test.js:987:7)
```
https://github.com/Automattic/node-canvas/blob/672104c1a4bd202e56d8837ef83ebf7aee2dfce2/test/canvas.test.js#L978-L987

The errors go back to at least v2.10.0. I didn't notice it because the prebuild script continues if the tests fail. 🙃

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.