Author: mordante
Date: Thu Apr 30 22:56:49 2009
New Revision: 35362
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35362&view=rev
Log:
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.)
Modified:
trunk/src/video.cpp
trunk/src/video.hpp
Modified: trunk/src/video.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/video.cpp?rev=35362&r1=35361&r2=35362&view=diff
==============================================================================
--- trunk/src/video.cpp (original)
+++ trunk/src/video.cpp Thu Apr 30 22:56:49 2009
@@ -293,11 +293,11 @@
image::set_pixel_format(frameBuffer->format);
}
-void CVideo::make_test_fake()
-{
- // 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);
+void CVideo::make_test_fake(const unsigned width,
+ const unsigned height, const unsigned bpp)
+{
+ frameBuffer = SDL_CreateRGBSurface(SDL_SWSURFACE,
+ width, height, bpp, 0xFF0000, 0xFF00, 0xFF, 0);
image::set_pixel_format(frameBuffer->format);
fake_interactive = true;
Modified: trunk/src/video.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/video.hpp?rev=35362&r1=35361&r2=35362&view=diff
==============================================================================
--- trunk/src/video.hpp (original)
+++ trunk/src/video.hpp Thu Apr 30 22:56:49 2009
@@ -85,7 +85,15 @@
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
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits