Screenshot tests break on retina displays
- Dominant language
- TypeScript
- Stars
- 20.4k
- Forks
- 1.3k
- Avg merge
- 14h 37m
- Merged PRs (30d)
- 7
Description
**Describe the bug:**
Retina displays give a screenshot size that is some multiple of the requested size, breaking the testing code.
**To Reproduce:**
Steps to reproduce the behavior:
1. Use a Mac with a Retina display
2. Run any `screenshotter.js` tests using Safari
3. Notice that `setSize()` first attempts to set the window size to 1024x768, which succeeds.
4. But in Retina displays, one pixel corresponds to multiple physical pixels. The screenshot file then uses one pixel per physical pixel. Hence one get an actual picture of size around 2048x1536.
5. `setSize()` then attempts to compensate by setting the width and height to 0 or less than 0, triggering an error.
**Expected behavior:**
We can either
- Explicitly say that Retina displays are not supported in the readme file, or
- Add separate tests for Retina displays, or
- Take the image, and then downscale it to perform diffs.
**Screenshots:**
N/A
**Environment (please complete the following information):**
- KaTeX Version: 0.16.11
- Device: MacBook Air, Built-in Retina Display 13.3-inch (2560x1600)
- OS: macOS Sonoma (14.3)
- Browser: Safari
- Version: 17.3
Contributor guide
Research direction
Start by reading screenshotter.js and running the Safari screenshot tests described in the reproduction steps on a Retina display. Trace setSize() through the initial 1024x768 resize and the later compensation attempt. Done should mean the tests no longer fail on Retina dimensions, with the supported behavior or handling documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100