Class VisualTestFixture
Defined in File visual_test_fixture.hpp
Inheritance Relationships
Base Type
public testing::Test
Class Documentation
-
class VisualTestFixture : public testing::Test
Public Functions
-
inline VisualTestFixture()
-
void TearDown() override
-
void setCamPose(Ogre::Vector3 camera_pose)
Change the pose of the camera, i.e. the position in the scene. Note that the camera of the scene is not the default camera of RViz, hence move tools will not work
- Parameters:
camera_pose – The new position of the camera
-
void setCamLookAt(Ogre::Vector3 camera_look_at_vector)
Change where the camera should look, makes the point the center of the rendering window Note that the camera of the scene is not the default camera of RViz, hence move tools will not work
- Parameters:
camera_look_at_vector – The new position in the center of the screen
-
void updateCamWithDelay(Ogre::Vector3 new_pose, Ogre::Vector3 new_look_at)
Combine functions for setCamPose and setCamLookAt
-
void setTesterThreshold(double threshold)
Set the image comparison threshold, if the default is not good enough. The default threshold used otherwise is 0.01. The default value is chosen for stability. Comparison happens using a mean squared distance between the image colors at every pixel. The lower the threshold, the less reference and test images may differ before the test is marked as a failure.
- Parameters:
threshold – new threshold for this test
Add a display from the “Add Display” dialog and return a shared_ptr to the corresponding page object. In order to work with a display, you need to construct a page object deriving from the base_page_object class.
- Template Parameters:
T – Name of the PageObject of the display
- Returns:
A shared pointer to an instance of the PageObject for the display for further interaction.
Removes the display associated with the given PageObject from RViz
- Parameters:
display – PageObject derived from the BasePageObject class.
-
void captureMainWindow(Ogre::String image_name = "")
Manually take a screenshot of the main render window to compare it later on. N.B: When only the main render window should be captured, use assertMainWindowIdentity() instead, which will automatically call this function for you.
- Parameters:
image_name – Name of the reference or test screenshot. If empty, the test name will be used.
Take a screenshot of an additional render window. The corresponding display must derive from the class “PageObjectWithWindow”, which ensures that the render window can be found.
- Parameters:
display – Instance of a derived class from PageObjectWithWindow, an object containing a render window to take screenshots from.
name – Name of the reference or test screenshot. If empty, the test name will be used.
-
void assertScreenShotsIdentity()
Assert the identity of all screenshots taken during the test. N.B: When only the main render window should be captured, use assertMainWindowIdentity() instead, which will automatically call this function for you.
-
void assertMainWindowIdentity(Ogre::String image_name = "")
Take a screenshot of the main render window and compare it to the reference window. If you need to take screenshots of additional render windows, use the functions captureRenderWindow(…) and assertScreenShotsIdentity() instead.
- Parameters:
image_name – Name of the reference or test screenshot. If empty, the test name will be used.
-
void wait(size_t milliseconds_to_wait)
Wait for a specified amount in milliseconds. This may be relevant if messages get published and don’t appear on screen fast enough.
- Parameters:
milliseconds_to_wait – number of milliseconds to wait
Public Members
-
Ogre::String test_name_
-
std::unique_ptr<VisualTest> visual_test_
-
std::unique_ptr<DisplayHandler> display_handler_
-
std::shared_ptr<std::vector<int>> all_display_ids_vector_
-
std::vector<Ogre::String> screen_shots_
-
inline VisualTestFixture()