stl_loader_test.cpp
Go to the documentation of this file.
00001 #include <gtest/gtest.h>
00002 #include <boost/filesystem.hpp>
00003 #include <ros/package.h>
00004 #include <rviz/ogre_helpers/stl_loader.h>
00005 
00006 TEST( STLLoader, load )
00007 {
00008   // Get the path to the directory where the meshes are located.
00009   boost::filesystem::path meshDir = ros::package::getPath("rviz");
00010   meshDir /= "src/test/meshes";
00011 
00012   // Load an ascii STL file. Note that only binary STL files are supported.
00013   ogre_tools::STLLoader loader;
00014   boost::filesystem::path meshFilePath = meshDir / "ascii.stl";
00015   EXPECT_FALSE(loader.load(meshFilePath.string()));
00016 
00017   // Load an invalid STL binary file (size < 84 bytes).
00018   meshFilePath = meshDir / "invalid_short.stl";
00019   EXPECT_FALSE(loader.load(meshFilePath.string()));
00020 
00021   // Load an invalid STL binary file (size does not match the expected size).
00022   meshFilePath = meshDir / "invalid.stl";
00023   EXPECT_FALSE(loader.load(meshFilePath.string()));
00024 
00025   // Load a valid STL binary file.
00026   meshFilePath = meshDir / "valid.stl";
00027   EXPECT_TRUE(loader.load(meshFilePath.string()));
00028 }
00029 
00030 int main( int argc, char **argv ) {
00031   testing::InitGoogleTest( &argc, argv );
00032   return RUN_ALL_TESTS();
00033 }


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Thu Aug 27 2015 15:02:28