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

Cursor tests #13

Open
ivan-mogilko opened this issue Sep 18, 2024 · 1 comment
Open

Cursor tests #13

ivan-mogilko opened this issue Sep 18, 2024 · 1 comment

Comments

@ivan-mogilko
Copy link
Contributor

Need cursor tests, using screenshot method to compare the graphic and graphical position.

Something like:

  1. Having a default graphic, test that the position matches mouse.x, mouse.y. Move cursor around with Mouse.SetPosition and assert that cursor position changes.
  2. Mode switch resulting in graphic change.
  3. Changing graphic by script command.
  4. Assigning a view (Mouse.ChangeModeView) and asserting that it changes animation frames over time (short animation to reduce test time).
  5. Specific test: ensure that cursor is drawn after a room change. Perhaps this suits for "Engine Render" tests more than for the "cursor" tests. Idea is that the engine might drop parts of the object caches on a room change, and so this test will assert that cursor got correctly recreated afterwards.
@ivan-mogilko
Copy link
Contributor Author

ivan-mogilko commented Nov 11, 2024

Special cursor case is inventory cursor that has extra hotspot gfx drawn upon it. Currently this is implemented by creating a temporary bitmap and combining 2 images on it. Because of such approach, this cursor image does not have a matching sprite number. When player cycles cursors with active inventory on, the cursor texture has to be updated between sprites that have an identifying number and one that does not. This is a special case that has to be tested too.

Recently there was a bug, which caused engine to paint this temporary cursor bitmap over other cached cursor textures, if their size matched, because it did not realize that previous texture has a identifier (so it's associated with a persistent sprite) while new sprite does not (so it's a temporary generated image).

Of course, it's also possible to change this implementation in the engine, maybe allocating this inventory cursor as a dynamic sprite with a number. But it's still proper to have a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant