Monogame: Add Unit Tests for Effect Classes

Created on 2 Apr 2016  Â·  12Comments  Â·  Source: MonoGame/MonoGame

Looking at the code coverage I see 0% coverage for the following Effect classes:

  • AlphaTestEffect
  • SpriteEffect
  • SkinnedEffect
  • DualTextureEffect
  • EnvironmentMapEffect

We should also write a complete BasicEffect test which exercises all the different states... it currently sits at 39.4% code coverage because it is used as part of other tests.

For console work I did a test like this for BasicEffect:

https://gist.github.com/tomspilman/c820c192bc62901e9a288ef905eccfde

That resulted in the following screen:

tom s dev kit-20160401-0040

We need tests similar to this for all the built in effect types.

Help Wanted Testing

All 12 comments

Am looking to re-familiarize myself with MonoGame and contribute where I can. Will work something similar to your example, if that's cool.

@cbrantley91 - It is beyond cool... it would be fantastic to finally get some good tests for this.

I suggest keep the first pass simple... maybe convert over my example to fit our unit test framework. If that works well and we get that PR merged then you can look at applying the same technique to the other effect types.

Let us know if you run into any trouble.

@tomspilman
Update on this. Your test references a BoxHelpers class that doesn't seem to exist within the MonoGame project; assumed not there for a reason (proprietary or whatnot), so started a quick re-implementation of that. Easy, but slow; however, the call to

GetNormalColorTextureUnitCube(GraphicsDevice device)

tripped me up a bit. VertexPositionNormalTexture exists, and VertexPositionColorTexture exists, but VertexPositionNormalColorTexture doesn't seem to exist. Remove anything related to that VBO, or is BoxHelpers doing some magic?

Also figure I'd make sure BoxHelpers isn't already in existence for a reason.

I'm out of the office, but I can totally give you that BoxHelpers file. Give me a few hours.

@cbrantley91 - Sorry for the slow update on this... been super busy.

Here is the implementation of BoxHelpers, VertexPositionNormalColor, and VertexPositionNormalColorTexture:

https://gist.github.com/tomspilman/e87edf3435fbabadc62fd15f854a4e32

When I wrote it I was surprised that BasicEffect had modes for which a custom vertex format needed to be written that was not built into XNA/MonoGame.

@KonajuGames @dellis1972 - Should we add these vertex types into MonoGame then as official types? This is the same situation as https://github.com/mono/MonoGame/issues/4494 really.

Probably no harm in adding them.

I agree

On 19 April 2016 at 15:48, KonajuGames [email protected] wrote:

Probably no harm in adding them.

—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/mono/MonoGame/issues/4698#issuecomment-211959265

If you'd like I'll include it as part of the PR, though likely should fall under a different issue.

Currently my troubles have been running the tests under Linux: getting content pipeline issues causing segfaults, and include/exclude not implemented for the test runner.

Commenting out the one content pipeline issue moved me on to a load of audio errors.

Plan is to try tonight in a Windows box to run these tests.

@cbrantley91 I'm guessing you dropped this? Mind if I take over?

Feel free. I implemented it at some point, but found I couldn't run all of
the tests on my Linux setup. Work sent me abroad for a month or so and
things started falling through cracks. Thanks.

On Mon, Aug 29, 2016 at 12:59 PM, Jesse [email protected] wrote:

@cbrantley91 https://github.com/cbrantley91 I'm guessing you dropped
this? Mind if I take over?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/MonoGame/MonoGame/issues/4698#issuecomment-243237080,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABQjVw-fZInYvNjWxEofTG9Eb1QESkEUks5qkzoGgaJpZM4H-F4C
.

I got 'em running :) @tomspilman Do you have that nice grid texture or something similar lying around? Mine does not look quite as professional

drawtest

Looking good!

This is the texture I used on the PS4 tests this is based on:

512_white_lines

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NET-D3v3l0p3r picture NET-D3v3l0p3r  Â·  3Comments

Grabiobot picture Grabiobot  Â·  5Comments

griseus picture griseus  Â·  5Comments

willmotil picture willmotil  Â·  5Comments

tomspilman picture tomspilman  Â·  4Comments