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

Integration tests for graphics #80

Merged
merged 15 commits into from
Sep 3, 2019
Merged

Integration tests for graphics #80

merged 15 commits into from
Sep 3, 2019

Conversation

hecrj
Copy link
Owner

@hecrj hecrj commented Aug 12, 2019

Fixes #16 and closes #89.

This PR implements an interactive integration test runner for the graphics module.

The test runner basically renders a suite of tests off-screen and compares the output with previously generated model images. If differences are detected, the test fails.

Once a new test is added, the runner asks to create a model image:

Create model image

If differences are detected, the runner allows us to toggle an overlay to check the differences before failing:

Check differences

If no differences are detected, the runner closes automatically and the test succeeds.

The test is ignored by default and does not run on CI yet. In order to run the test we need to provide the --ignored flag to cargo test:

cargo test --features vulkan -- --ignored

As of now, there is only a simple Mesh test implemented, which does not show any differences between Vulkan and OpenGL. Adding tests is really easy though! We should probably do that in another PR.

Changelog

Added

  • Canvas::read_pixels, which returns a DynamicImage with the current contents of the Canvas.
  • ui::Panel, a widget that represents a box with some content.

Changed

  • UserInterface::react now takes a mutable Window reference, like Game::interact. This allows users to render off-screen or toggle fullscreen mode from a UI interaction.
  • Task::run now takes a Gpu instead of a Window. This makes tasks easier to use everywhere. Features like hot asset reloading should be easy with this change.
  • Task::run does not support progress tracking for now. The old method with progress tracking support is now private and is used exceptionally by the LoadingScreen trait. This stops users from relying on an unstable interface that will most likely change very soon.

@hecrj hecrj added feature New feature or request improvement An internal improvement labels Aug 12, 2019
@hecrj hecrj added this to the 0.4.0 milestone Aug 12, 2019
@hecrj hecrj self-assigned this Aug 12, 2019
@hecrj hecrj changed the title Graphics integration tests Integration tests for graphics Aug 13, 2019
@hecrj hecrj mentioned this pull request Sep 3, 2019
@hecrj hecrj merged commit ac3a4e7 into master Sep 3, 2019
@hecrj hecrj deleted the test/graphics branch September 3, 2019 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request improvement An internal improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exporting as Image Integration tests for graphics
1 participant