Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:11:38

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2020 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/tools/output_test_stream.hpp>
0010 #include <boost/test/unit_test.hpp>
0011 
0012 #include "Acts/Visualization/ObjVisualization3D.hpp"
0013 #include "Acts/Visualization/PlyVisualization3D.hpp"
0014 
0015 #include <iostream>
0016 #include <string>
0017 #include <vector>
0018 
0019 #include "SurfaceView3DBase.hpp"
0020 #include "Visualization3DTester.hpp"
0021 
0022 namespace Acts {
0023 namespace Test {
0024 
0025 BOOST_AUTO_TEST_SUITE(Visualization)
0026 
0027 /// This tests if the corresponding obj output is well formatted
0028 BOOST_AUTO_TEST_CASE(SurfaceView3DObj) {
0029   ObjVisualization3D obj;
0030   // Standard test
0031   bool triangulate = false;
0032   auto objTest = SurfaceView3DTest::run(obj, triangulate, "");
0033   auto objErrors = testObjString(objTest, triangulate);
0034   std::cout << "Surfaces Obj Test    : " << objTest.size()
0035             << " characters written with " << objErrors.size() << " errors."
0036             << std::endl;
0037   BOOST_CHECK(objErrors.empty());
0038   for (const auto& objerr : objErrors) {
0039     std::cout << objerr << std::endl;
0040   }
0041   // Triangular mesh test
0042   triangulate = true;
0043   auto objTest3M = SurfaceView3DTest::run(obj, triangulate, "_3M");
0044   auto objErrors3M = testObjString(objTest3M, triangulate);
0045   std::cout << "Surfaces Obj Test 3M : " << objTest3M.size()
0046             << " characters written with " << objErrors3M.size() << " errors."
0047             << std::endl;
0048   BOOST_CHECK(objErrors3M.empty());
0049   for (const auto& objerr : objErrors3M) {
0050     std::cout << objerr << std::endl;
0051   }
0052 }
0053 
0054 /// This tests if the corresponding ply output is well formatted
0055 BOOST_AUTO_TEST_CASE(SurfaceView3DPly) {
0056   PlyVisualization3D ply;
0057   // Standard test
0058   bool triangulate = false;
0059   auto plyTest = SurfaceView3DTest::run(ply, triangulate, "");
0060   auto plyErrors = testPlyString(plyTest, triangulate);
0061   std::cout << "Surfaces Ply Test    : " << plyTest.size()
0062             << " characters written with " << plyErrors.size() << " errors."
0063             << std::endl;
0064   BOOST_CHECK(plyErrors.empty());
0065   for (const auto& plyerr : plyErrors) {
0066     std::cout << plyerr << std::endl;
0067   }
0068   // Triangular mesh test
0069   triangulate = true;
0070   auto plyTest3M = SurfaceView3DTest::run(ply, triangulate, "_3M");
0071   auto plyErrors3M = testPlyString(plyTest3M, triangulate);
0072   std::cout << "Surfaces Ply Test 3M : " << plyTest3M.size()
0073             << " characters written with " << plyErrors3M.size() << " errors."
0074             << std::endl;
0075   BOOST_CHECK(plyErrors3M.empty());
0076   for (const auto& plyerr : plyErrors3M) {
0077     std::cout << plyerr << std::endl;
0078   }
0079 }
0080 
0081 BOOST_AUTO_TEST_SUITE_END()
0082 
0083 }  // namespace Test
0084 }  // namespace Acts