Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:03

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/unit_test.hpp>
0010 
0011 #include "Acts/Visualization/ObjVisualization3D.hpp"
0012 #include "Acts/Visualization/PlyVisualization3D.hpp"
0013 
0014 #include <iostream>
0015 #include <string>
0016 #include <vector>
0017 
0018 #include "SurfaceView3DBase.hpp"
0019 #include "Visualization3DTester.hpp"
0020 
0021 namespace Acts::Test {
0022 
0023 BOOST_AUTO_TEST_SUITE(Visualization)
0024 
0025 /// This tests if the corresponding obj output is well formatted
0026 BOOST_AUTO_TEST_CASE(SurfaceView3DObj) {
0027   ObjVisualization3D obj;
0028   // Standard test
0029   bool triangulate = false;
0030   auto objTest = SurfaceView3DTest::run(obj, triangulate, "");
0031   auto objErrors = testObjString(objTest, triangulate);
0032   std::cout << "Surfaces Obj Test    : " << objTest.size()
0033             << " characters written with " << objErrors.size() << " errors."
0034             << std::endl;
0035   BOOST_CHECK(objErrors.empty());
0036   for (const auto& objerr : objErrors) {
0037     std::cout << objerr << std::endl;
0038   }
0039   // Triangular mesh test
0040   triangulate = true;
0041   auto objTest3M = SurfaceView3DTest::run(obj, triangulate, "_3M");
0042   auto objErrors3M = testObjString(objTest3M, triangulate);
0043   std::cout << "Surfaces Obj Test 3M : " << objTest3M.size()
0044             << " characters written with " << objErrors3M.size() << " errors."
0045             << std::endl;
0046   BOOST_CHECK(objErrors3M.empty());
0047   for (const auto& objerr : objErrors3M) {
0048     std::cout << objerr << std::endl;
0049   }
0050 }
0051 
0052 /// This tests if the corresponding ply output is well formatted
0053 BOOST_AUTO_TEST_CASE(SurfaceView3DPly) {
0054   PlyVisualization3D ply;
0055   // Standard test
0056   bool triangulate = false;
0057   auto plyTest = SurfaceView3DTest::run(ply, triangulate, "");
0058   auto plyErrors = testPlyString(plyTest, triangulate);
0059   std::cout << "Surfaces Ply Test    : " << plyTest.size()
0060             << " characters written with " << plyErrors.size() << " errors."
0061             << std::endl;
0062   BOOST_CHECK(plyErrors.empty());
0063   for (const auto& plyerr : plyErrors) {
0064     std::cout << plyerr << std::endl;
0065   }
0066   // Triangular mesh test
0067   triangulate = true;
0068   auto plyTest3M = SurfaceView3DTest::run(ply, triangulate, "_3M");
0069   auto plyErrors3M = testPlyString(plyTest3M, triangulate);
0070   std::cout << "Surfaces Ply Test 3M : " << plyTest3M.size()
0071             << " characters written with " << plyErrors3M.size() << " errors."
0072             << std::endl;
0073   BOOST_CHECK(plyErrors3M.empty());
0074   for (const auto& plyerr : plyErrors3M) {
0075     std::cout << plyerr << std::endl;
0076   }
0077 }
0078 
0079 BOOST_AUTO_TEST_SUITE_END()
0080 
0081 }  // namespace Acts::Test