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

Rendering tests #784

Merged
merged 5 commits into from
Apr 17, 2020
Merged

Rendering tests #784

merged 5 commits into from
Apr 17, 2020

Conversation

fishrockz
Copy link
Collaborator

@fishrockz fishrockz commented Mar 30, 2020

The last few commits need cleaning up but I am generally keen to get some good feed back before I clean them up.

This PR adds:

  • Ability to get a array of raw pixels and so they can be checked
  • Ability to save a png of the widget under test
  • Image tests
  • Svg tests that test that the scaling matrix and transform matrix work together

This PR should complete #527

druid-shell/Cargo.toml Outdated Show resolved Hide resolved
@fishrockz fishrockz added the S-needs-review waits for review label Mar 31, 2020
@fishrockz fishrockz force-pushed the willsalmon/imagetests branch 2 times, most recently from 16438e7 to 2140c1b Compare March 31, 2020 20:55
@fishrockz fishrockz changed the title WIP: Rendering tests Rendering tests Mar 31, 2020
Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I think all things considered this is a reasonable way to get the functionality we want, and we're allowed to be more hacky with testing code.

That said, I think it is important that future explorers of this code have some more hints about what is going on; if you can try and add some docs etc I will clean them up.

druid/src/tests/harness.rs Outdated Show resolved Hide resolved
druid/src/tests/mod.rs Outdated Show resolved Hide resolved
druid/src/tests/harness.rs Outdated Show resolved Hide resolved
druid/src/tests/mod.rs Show resolved Hide resolved
@cmyr cmyr added S-waiting-on-author waits for changes from the submitter and removed S-needs-review waits for review labels Apr 3, 2020
@fishrockz fishrockz force-pushed the willsalmon/imagetests branch 2 times, most recently from 2fdb202 to 4a3642e Compare April 6, 2020 19:16
druid/src/tests/harness.rs Outdated Show resolved Hide resolved
@fishrockz fishrockz force-pushed the willsalmon/imagetests branch 2 times, most recently from a3805bc to 49835b0 Compare April 7, 2020 21:09
druid/Cargo.toml Outdated Show resolved Hide resolved
vec![41, 41, 41, 255].repeat(100),
]
.concat();
assert_eq!(raw_pixels[399 * 600 * 4..400 * 600 * 4], expecting[..]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raphlinus I think you did a lot of the piet logic, can you think of a nicer way to do this. I have made these tests so that they should be very stable but if people want to use this for more complex widgets then crafting a expected slice could get quite trouble some especially if they are not to be pretty fragile.

I was thinking of maybe using piet to create a similar image and then comparing the hole things but I'm not sure that would be very helpful.

Maybe for another MR but do you have any ideas?

@fishrockz fishrockz force-pushed the willsalmon/imagetests branch 3 times, most recently from 961b3b9 to 94ee520 Compare April 7, 2020 22:10
@fishrockz fishrockz force-pushed the willsalmon/imagetests branch 2 times, most recently from bb3d301 to 8454c76 Compare April 8, 2020 18:12
@fishrockz fishrockz added S-needs-review waits for review and removed S-waiting-on-author waits for changes from the submitter labels Apr 10, 2020
Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly grammar related stuff. However I'm also wondering about the temp dir/files lifetime.

druid/src/tests/harness.rs Outdated Show resolved Hide resolved
druid/src/tests/harness.rs Outdated Show resolved Hide resolved
druid/src/tests/harness.rs Outdated Show resolved Hide resolved
druid/src/tests/harness.rs Outdated Show resolved Hide resolved
druid/src/tests/harness.rs Outdated Show resolved Hide resolved
druid/src/widget/svg.rs Outdated Show resolved Hide resolved
druid/src/widget/svg.rs Outdated Show resolved Hide resolved
druid/src/widget/svg.rs Outdated Show resolved Hide resolved
druid/src/widget/svg.rs Outdated Show resolved Hide resolved
druid/src/widget/svg.rs Outdated Show resolved Hide resolved
@xStrom xStrom added S-waiting-on-author waits for changes from the submitter and removed S-needs-review waits for review labels Apr 10, 2020
@fishrockz fishrockz force-pushed the willsalmon/imagetests branch 2 times, most recently from 8454296 to 04c229e Compare April 10, 2020 21:53
@fishrockz fishrockz added S-needs-review waits for review and removed S-waiting-on-author waits for changes from the submitter labels Apr 10, 2020
Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more.

druid/src/tests/mod.rs Outdated Show resolved Hide resolved
@fishrockz fishrockz force-pushed the willsalmon/imagetests branch 2 times, most recently from dd32ed0 to 4bdc3fe Compare April 14, 2020 18:09
Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I think this is at a decent enough place now to merge. Thanks!

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cmyr cmyr merged commit 22cd067 into linebender:master Apr 17, 2020
@xStrom xStrom removed the S-needs-review waits for review label May 15, 2020
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

Successfully merging this pull request may close these issues.

4 participants