5 #include <gtest/gtest.h> 7 TEST(TestSuite, testWriteYamlFile)
10 vtkSmartPointer<vtkPolyData> poly_data = vtkSmartPointer<vtkPolyData>::New();
11 vtkSmartPointer<vtkPolyData> poly_data_2 = vtkSmartPointer<vtkPolyData>::New();
13 vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
14 vtkSmartPointer<vtkCellArray> polygon_array = vtkSmartPointer<vtkCellArray>::New();
17 vtkSmartPointer<vtkPolygon> polygon = vtkSmartPointer<vtkPolygon>::New();
18 polygon->GetPointIds()->InsertNextId(points->GetNumberOfPoints());
19 points->InsertNextPoint(0, 0, 0);
20 polygon->GetPointIds()->InsertNextId(points->GetNumberOfPoints());
21 points->InsertNextPoint(0, 2, 0);
22 polygon->GetPointIds()->InsertNextId(points->GetNumberOfPoints());
23 points->InsertNextPoint(2, 2, 0);
24 polygon->GetPointIds()->InsertNextId(points->GetNumberOfPoints());
25 points->InsertNextPoint(2, 0, 0);
27 polygon_array->InsertNextCell(polygon);
29 polygon = vtkSmartPointer<vtkPolygon>::New();
30 polygon->GetPointIds()->InsertNextId(points->GetNumberOfPoints());
31 points->InsertNextPoint(10, 10, 0);
32 polygon->GetPointIds()->InsertNextId(points->GetNumberOfPoints());
33 points->InsertNextPoint(11, 11, 0);
34 polygon->GetPointIds()->InsertNextId(points->GetNumberOfPoints());
35 points->InsertNextPoint(12, 10, 0);
37 polygon_array->InsertNextCell(polygon);
39 poly_data->SetPoints(points);
40 poly_data->SetPolys(polygon_array);
47 TEST(TestSuite, testReadEmptyPolydata)
50 vtkSmartPointer<vtkPolyData> poly_data = vtkSmartPointer<vtkPolyData>::New();
55 TEST(TestSuite, testReadYamlFile)
58 vtkSmartPointer<vtkPolyData> poly_data = vtkSmartPointer<vtkPolyData>::New();
62 bool is_empty = (poly_data->GetNumberOfCells() == 0) ?
true :
false;
63 EXPECT_TRUE(result && !is_empty);
66 TEST(TestSuite, testReadEmptyYamlFile)
69 vtkSmartPointer<vtkPolyData> poly_data = vtkSmartPointer<vtkPolyData>::New();
71 const std::string yaml_file(
74 bool is_empty = (poly_data->GetNumberOfCells() == 0) ?
true :
false;
75 EXPECT_FALSE(result && !is_empty);
81 ros::init(argc, argv,
"trajectory_files_manager_test");
82 testing::InitGoogleTest(&argc, argv);
83 return RUN_ALL_TESTS();
bool yamlFileToPolydata(const std::string yaml_file, Polygon poly_data)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
int main(int argc, char **argv)
bool polydataToYamlFile(const std::string yaml_file, const Polygon poly_data)
ROSLIB_DECL std::string getPath(const std::string &package_name)
TEST(TestSuite, testWriteYamlFile)