linebender / piet

An abstraction for 2D graphics.
Apache License 2.0
1.24k stars 93 forks source link

Move samples out of `piet` and into local crate #502

Open avitex opened 2 years ago

avitex commented 2 years ago
avitex commented 2 years ago

I might end up moving samples to another folder while working on a more comprehensive test suite, but I'll leave it like this for now

avitex commented 2 years ago

Note the fonts are uploaded in the crate: https://docs.rs/crate/piet/latest/source/

cmyr commented 2 years ago

Okay i think this makes sense, and is actually closer to a design we had previously, where we had a piet-test crate. Maybe let's use that name, instead of 'samples', which sounds like something that might be interesting to users?

I'd also like a README in that folder, just explaining that these are a set of tests files that are run against backends for testing, and that the 'snapshots' submodule contains the expected outputs for different backends.

Otherwise thanks for taking the time to sort this out!

Note the fonts are uploaded in the crate: https://docs.rs/crate/piet/latest/source/

oh interesting that's definitely a mistake, I think they were ignored at some point but maybe they were moved.

avitex commented 2 years ago

Awesome, this is the line of thinking I'm going down too. I'll move it into piet-test now and build out some more test stuff in there in following PRs

avitex commented 2 years ago

The reason I named it samples for the time being is it is close enough to examples, which I would look at for a sample of what I can output with the library. Moving all the stuff into piet-test hides it away a little more

cmyr commented 2 years ago

That's fair, but I think it's going to cause more confusion, since it isn't clear how to run these samples, and people have opened issues about that before. I'd prefer to avoid that confusion.

(I'd also like to move the test-picturer.s file out of examples and into bin for each backend that runs the snapshots; I'd also rename it to "generate_snapshots.rs" or something)

avitex commented 2 years ago

(I'd also like to move the test-picture.rs file out of examples and into bin for each backend that runs the snapshots; I'd also rename it to "generate_snapshots.rs" or something)

This was almost exactly the next change I was going to propose ha!

avitex commented 2 years ago

Quick note perhaps for further discussion. If the sample_x/generate_snapshots was to be moved from examples to bin this then means piet-test would have to be a published crate to be an optional dependency referenced within required-features for the bin in Cargo.toml. I instead choose to put them each in piet-test for the time being to remove that dependency.

cmyr commented 2 years ago

piet-test is already a published crate... does this change your calculus at all?