hecrj / coffee

An opinionated 2D game engine for Rust
https://docs.rs/coffee
MIT License
1.08k stars 55 forks source link

Integration tests for `graphics` #16

Closed hecrj closed 5 years ago

hecrj commented 5 years ago

This is just an idea. I do not know how practical it is, but I think it is worth a shot.

I am quite a fan of integration tests.

We could implement a suite of image-based integration tests for the graphics module. We would render to an image and compare it with an expected image pixel by pixel. If a test fails, we could keep the wrong image and mark the differences somehow (maybe another transparent image pointing the pixels that differ). We could have simple tests and very complicated ones, with off-screen rendering, text, batched draws and texture arrays, etc.

This will give us a lot of confidence when making changes/optimizations to the different graphics backends, or when implementing a new one. Also, I think it would be really cool.

I would like to do this myself, but any help or insights will be greatly appreciated. Share your thoughts here first!

hecrj commented 5 years ago

Related issue in the gamedev working group: https://github.com/rust-gamedev/wg/issues/31