Add parameter for the fake screen.

In order to make unit testing with different screen sizes possible it's
required to allow the setting of these values. Decided against doing it
in the constructor since I want to test on different screen sizes so
will rerun the function to get a different size. (Unit test code will be
committed later.)
This commit is contained in:
Mark de Wever 2009-04-30 20:56:49 +00:00
parent a926991e5f
commit bbcb2b40cd
2 changed files with 13 additions and 5 deletions

View file

@ -293,11 +293,11 @@ void CVideo::make_fake()
image::set_pixel_format(frameBuffer->format);
}
void CVideo::make_test_fake()
void CVideo::make_test_fake(const unsigned width,
const unsigned height, const unsigned bpp)
{
// Create fake screen that is 1024x768 24bpp
// We can then use this in tests to draw
frameBuffer = SDL_CreateRGBSurface(SDL_SWSURFACE,1024,768,32,0xFF0000,0xFF00,0xFF,0);
frameBuffer = SDL_CreateRGBSurface(SDL_SWSURFACE,
width, height, bpp, 0xFF0000, 0xFF00, 0xFF, 0);
image::set_pixel_format(frameBuffer->format);
fake_interactive = true;

View file

@ -85,7 +85,15 @@ class CVideo : private boost::noncopyable {
int getBpp();
void make_fake();
void make_test_fake();
/**
* Creates a fake frame buffer for the unit tests.
*
* @param width The width of the buffer.
* @param height The heigth of the buffer.
* @param bpp The bpp of the buffer.
*/
void make_test_fake(const unsigned width = 1024,
const unsigned height = 768, const unsigned bpp = 32);
bool faked() const { return fake_screen_; }
//functions to set and clear 'help strings'. A 'help string' is like a tooltip, but it appears