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

CodeEdit unit tests don't account for the theme properly #56955

Open
YuriSizov opened this issue Jan 19, 2022 · 0 comments
Open

CodeEdit unit tests don't account for the theme properly #56955

YuriSizov opened this issue Jan 19, 2022 · 0 comments

Comments

@YuriSizov
Copy link
Contributor

YuriSizov commented Jan 19, 2022

Godot version

master

System information

GitHub Actions

Issue description

While remaking the new project theme (#51159) I've noticed that unit tests for CodeEdit have some weird spatial assumptions about where to click or emulate other mouse interactions.

Two tests were failing because of that:

  • [CodeEdit] autocomplete completion

The size of 100 by 100 pixels is ridiculously small for a text editor control. It causes the completion panel to pop up (and not down), beyond the control area. The tests is hardcoded for this behavior, but it would be better to give it more size and assume that the panel appears within the box of the control, as it normally should.

The test also doesn't account for the completion panel having any kind of padding inside of it. As such, it can trigger the event in an area outside of the completion panel hitbox, and fail. Styling information should be used.

  • [SceneTree][CodeEdit] symbol lookup

Same here about the size of the control. Additionally, some arbitrary number 55 is hardcoded for an offset of the mouse click position. It is assumed that this offset would place the cursor to the exact location to match the tests data. This value will fail from a change to almost any property, both styleboxes and fonts would cause the control to render slightly differently.


Now, maybe that's the point and we have to update these tests to be rigid with the new theme (though, I'm not sure there is a good reason for that, it tests nothing this way). But to do that the tests needs to explain way better what they are attempting to do and what the assumed behavior should be. At least as comments in the code. I had to try and recreate the tests scene in a project to figure out what is happening there, and why it may be failing.

Steps to reproduce

Run tests with a slightly different default theme. See the GitHub action runs for the aforementioned PR.

Minimal reproduction project

N/a

@akien-mga akien-mga added this to the 4.0 milestone Jan 19, 2022
@YuriSizov YuriSizov modified the milestones: 4.0, 4.x Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

3 participants