iminurnamez / pyroller

pygame casino
65 stars 29 forks source link

Unit testing poc #111

Closed paulpaterson closed 9 years ago

paulpaterson commented 9 years ago

This is the proof-of-concept of unit testing. These are the tests for the Control class, which is the base class for States.

To run the tests go to the "test" folder and,

python testcontrol.py

The tests cover the as-is behaviour. No other files are touched by this change.

Some of the Control methods really should be updated to make them more testable because I had to jump through some hoops to test some things (eg faking out the pygame events system, breaking out of the Control.main loop).

One of the tests currently fails: testResizeToSameSize. I think the test is right here and that the Control.on_resize method does the wrong thing if you pass it the existing resolution.