Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests don't pass on Windows #119

Open
mimshwright opened this issue Jul 25, 2021 · 0 comments
Open

Tests don't pass on Windows #119

mimshwright opened this issue Jul 25, 2021 · 0 comments
Assignees
Labels
Chore help wanted Extra attention is needed

Comments

@mimshwright
Copy link
Owner

I've done all the development on this library on a Mac. I was also wrongly under the assumption that the size and position of the text would be the same across platforms (since it's being rendered into a canvas). But it turns out that (of course) the text is interpreted by the browser before being draw into the canvas and there are minor differences in how the text is rendered.

Test results that depend on exact pixel numbers for height and positioning of letters are passing on Mac but not on other environments.

Supporting every environment would be pretty difficult but at a minimum, they should pass on both Mac and Windows. I have started running the tests through an "Electron" , which is AFAIK node + Chromium, which would normalize the environment. (This is at least happening in the pixi-6 branch, don't remember if it's been merged with main)

I fired up Parallels and tested under windows 10. I got the following failed tests...

FAIL test/layout.test.ts
layout module
calculateFinalTokens()
Stroked text
× Shouldn't affect non-strked text. (16 ms)
× Should take the stroke into account when determining the size and the fontProperties (for baseline).
× Should not affect any other stroked text. Sometimes this happens when fontProperties are shared.

FAIL test/pixiUtils.test.ts
pixiUtils
getFontPropertiesOfText()
× should throw an error if the Text has not had updateText() called at least once.
× should before setting any styles (but after calling updateTexT()) the metrics will be an expected default. (16 ms)
× should provide the correct numbers after changing the style for the text.
What if the text you want is exactly what the initial value is?
× should not throw an error if you happen to set your text to the same value as the initial values. (31 ms)
× ...however, it will throw if the fontSize is a string (rather than trying to convert it to pxs) unless you use force.

Originally posted by @mimshwright in #52 (comment)

@mimshwright mimshwright self-assigned this Jul 25, 2021
@mimshwright mimshwright added bug Something isn't working Chore labels Jul 25, 2021
mimshwright added a commit that referenced this issue Feb 21, 2022
Added support for Pixi 6. There are some changes made in the pixi library that cause weird
behaviours in this library but only in tests. Currently, version 6.1.3 and earlier works well but
later versions don't work for tests. An electron-based runner for jest has been added. Also some
tests have been rewritten to work better with multiple environments (re #119).

BREAKING CHANGE: Going forward, this project will target v6 of pixi.js

fix #52
@mimshwright mimshwright added help wanted Extra attention is needed and removed bug Something isn't working labels Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chore help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant