Rally X
ELEN3009 Project by Justin Wernick and David Schneider
Functions
tests/presentationTests.cpp File Reference

Unit tests for the presentation layer of a Rally-X game. More...

#include <utility>
#include <list>
#include <gtest/gtest.h>
#include "../source/presentation/BitmapStore.h"
#include "../source/presentation/ColourStore.h"
#include "../source/presentation/GamePanel.h"
#include "../source/presentation/Screen.h"
#include "../source/logic/PlayerCar.h"
#include "../source/logic/EnemyCar.h"
#include "../source/logic/Checkpoint.h"
#include "../source/logic/Rock.h"
#include "../source/logic/Smokescreen.h"
#include "../source/logic/Maze.h"
#include "../source/logic/DestroyedObjectPopup.h"

Go to the source code of this file.

Functions

 TEST (BitmapStore, returnsBitmapForAllImages)
 Tests that all images can be requested without failure occuring.
 TEST (ColourStore, returnsColourForAllImages)
 Tests that all colours can be requested without failure occuring.
 TEST (Screen, exceptionOnBadResolution)
 TEST (Screen, noExceptionOnWindowed)
 TEST (Screen, noExceptionOnGoodResolution)
 TEST (ScreenPanel, drawingToCurrentBackBuffer)
 Tests that when a ScreenPanel draws to the back buffer provided.
 TEST (ScreenPanel, drawingToCurrentBackBufferAfterFlip)
 Tests that when a ScreenPanel draws to the front buffer provided after a flip has been called.

Detailed Description

Unit tests for the presentation layer of a Rally-X game.

The BitmapStore class is tested in its ability to return a bitmap for each image. The appearance of the bitmaps need to be tested manually by running the game and inspecting the various objects.

The ColourStore class is tested in its ability to return a colour for each image. The appearance of the colours need to be tested manually by running the game and inspecting the various objects.

The GamePanel and InfoPanel classes depend on their visual appearance in the game. Therefore, they should be tested manually. The technical part of their functionality, creating the back and front buffers and changing between them, is handled by their superclass, ScreenPanel.

The KeyboardHandler depends on user inputs. It should be tested manually by testing that the player's direction can be controlled, and that smokescreens can be created.

The Screen class's creation with various resolutions and fullscreen settings is tested. An exception should be thrown if the fullscreen resolution is not supported by the current hardware, but not otherwise. The visual appearance and creation of ScreenPanels should be tested manually by running the game.

The ScreenPanel class is tested by creating a false back and front display buffer. The buffer that is being drawn to is tested by sampling a pixel in the middle of the buffer.

Author:
Justin Wernick
David Schneider

Definition in file presentationTests.cpp.


Function Documentation

TEST ( BitmapStore  ,
returnsBitmapForAllImages   
)

Tests that all images can be requested without failure occuring.

Definition at line 55 of file presentationTests.cpp.

TEST ( ColourStore  ,
returnsColourForAllImages   
)

Tests that all colours can be requested without failure occuring.

Definition at line 75 of file presentationTests.cpp.

TEST ( Screen  ,
exceptionOnBadResolution   
)

Tests that an exception is thrown if fullscreen mode is requested on an unsupported monitor resolution.

Definition at line 95 of file presentationTests.cpp.

TEST ( Screen  ,
noExceptionOnWindowed   
)

Tests that an exception is not thrown if windowed mode is requested on an unsupported monitor resolution.

Definition at line 106 of file presentationTests.cpp.

TEST ( Screen  ,
noExceptionOnGoodResolution   
)

Tests that an exception is not thrown if fullscreen mode is requested on a supported monitor resolution.

Definition at line 117 of file presentationTests.cpp.

TEST ( ScreenPanel  ,
drawingToCurrentBackBuffer   
)

Tests that when a ScreenPanel draws to the back buffer provided.

Definition at line 129 of file presentationTests.cpp.

TEST ( ScreenPanel  ,
drawingToCurrentBackBufferAfterFlip   
)

Tests that when a ScreenPanel draws to the front buffer provided after a flip has been called.

Definition at line 189 of file presentationTests.cpp.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator