-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve visual testing and add visual tests (#259)
* Find property index by name * Add test for PathDisplay * Create a publisher in Visual Testing Framework * Add wait() method to Executor * Fix QLocale problem * Add documentation to public classes used by clients of the visual testing framework * Refactoring of BasePageObjects to allow simpler PageObect writing * Move test_helpers.hpp to public interface * Add TF display visual test * Harmonise logging * Add visual test for robot model * Add page object, publisher and test for LaserScanDisplay * Unify setTopic method Always wait 1.5 seconds for the first message * Increase timeout * Fix Windows error due to duplicate constant * Change cmake and environment variables to True instead of TRUE * Write visual tests to rviz_default_plugins Move page objects + visual tests to rviz_default_plugins Add more tests for: - Camera display - Image display - Pose display - Pose array display - Marker display - PointCloud(2) display - Grid display * Implement better image comparison method * Remove openCV dependency * Use size_t instead of int in wait() * Fix MSBuild warning
- Loading branch information
1 parent
d49b17d
commit d69b6f1
Showing
103 changed files
with
3,755 additions
and
613 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.2 KB
rviz_default_plugins/test/reference_images/laser_scan_display_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.4 KB
...ault_plugins/test/reference_images/pointcloud2_containing_one_big_point_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+62.5 KB
...fault_plugins/test/reference_images/pointcloud_containing_one_big_point_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+28 KB
rviz_default_plugins/test/reference_images/pose_array_display_with_arrow3d_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+30.9 KB
rviz_default_plugins/test/reference_images/pose_array_display_with_axes_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.2 KB
rviz_default_plugins/test/reference_images/pose_display_with_arrow_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+30.9 KB
rviz_default_plugins/test/reference_images/pose_display_with_axes_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.4 KB
...efault_plugins/test/reference_images/robot_model_display_with_collision_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.8 KB
..._default_plugins/test/reference_images/robot_model_display_with_visuals_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.03 KB
...rence_images/test_camera_display_with_published_image_secondary_window0_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.4 KB
...t_plugins/test/reference_images/test_image_display_with_published_image_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.63 KB
...erence_images/test_image_display_with_published_image_secondary_window0_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+26 KB
...fault_plugins/test/reference_images/test_marker_with_three_marker_types_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+28.6 KB
rviz_default_plugins/test/reference_images/tf_display_frame_disabled_ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions
69
..._default_plugins/test/rviz_default_plugins/displays/camera/camera_display_visual_test.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (c) 2018, Bosch Software Innovations GmbH. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted (subject to the limitations in the disclaimer | ||
* below) provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* * Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS | ||
* LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "rviz_visual_testing_framework/visual_test_fixture.hpp" | ||
#include "rviz_visual_testing_framework/visual_test_publisher.hpp" | ||
|
||
#include "../../page_objects/camera_display_page_object.hpp" | ||
#include "../../publishers/camera_info_publisher.hpp" | ||
#include "../../publishers/image_publisher.hpp" | ||
#include "../../page_objects/point_cloud_display_page_object.hpp" | ||
#include "../../publishers/point_cloud_publisher.hpp" | ||
|
||
TEST_F(VisualTestFixture, test_camera_display_with_published_image) { | ||
auto points = {nodes::createPoint(0, 0, 10)}; | ||
std::vector<PublisherWithFrame> publishers = { | ||
PublisherWithFrame(std::make_shared<nodes::CameraInfoPublisher>(), "image"), | ||
PublisherWithFrame(std::make_shared<nodes::ImagePublisher>(), "image"), | ||
PublisherWithFrame(std::make_shared<nodes::PointCloudPublisher>(points), "pointcloud_frame") | ||
}; | ||
auto cam_publisher = std::make_unique<VisualTestPublisher>(publishers); | ||
|
||
setCamPose(Ogre::Vector3(0, 0, 16)); | ||
setCamLookAt(Ogre::Vector3(0, 0, 0)); | ||
|
||
auto camera_display = addDisplay<CameraDisplayPageObject>(); | ||
camera_display->setTopic("/image"); | ||
camera_display->collapse(); | ||
|
||
auto pointcloud_display = addDisplay<PointCloudDisplayPageObject>(); | ||
pointcloud_display->setStyle("Spheres"); | ||
pointcloud_display->setSizeMeters(11); | ||
pointcloud_display->setColor(0, 0, 255); | ||
|
||
captureRenderWindow(camera_display); | ||
|
||
assertScreenShotsIdentity(); | ||
} |
52 changes: 52 additions & 0 deletions
52
rviz_default_plugins/test/rviz_default_plugins/displays/grid/grid_display_visual_test.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (c) 2018, Bosch Software Innovations GmbH. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* * Neither the name of the copyright holders nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "rviz_visual_testing_framework/visual_test_fixture.hpp" | ||
|
||
#include "../../page_objects/grid_display_page_object.hpp" | ||
|
||
TEST_F(VisualTestFixture, grid_visual_test) { | ||
setCamPose(Ogre::Vector3(10, 0, 0)); | ||
setCamLookAt(Ogre::Vector3(0, 0, 0)); | ||
|
||
auto grid_display = addDisplay<GridDisplayPageObject>(); | ||
grid_display->setLineStyle("Billboards"); | ||
grid_display->setLineWidth(4.0f); | ||
grid_display->setColor(255, 255, 0); | ||
grid_display->setAlpha(1.0f); | ||
captureMainWindow(); | ||
|
||
grid_display->setAlpha(0.0f); | ||
captureMainWindow("empty_scene"); | ||
|
||
assertScreenShotsIdentity(); | ||
} |
Oops, something went wrong.