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 "Visualization3DTester.hpp"
0020 #include "VolumeView3DBase.hpp"
0021 
0022 namespace Acts {
0023 namespace Test {
0024 
0025 BOOST_AUTO_TEST_SUITE(Visualization)
0026 
0027 // Tests if the written obj output is well formatted
0028 BOOST_AUTO_TEST_CASE(VolumeView3DObj) {
0029   ObjVisualization3D obj;
0030 
0031   // Standard test
0032   bool triangulate = false;
0033   auto objTest = VolumeView3DTest::run(obj, triangulate, "");
0034   auto objErrors = testObjString(objTest, triangulate);
0035   std::cout << "Volumes Obj Test    : " << objTest.size()
0036             << " characters written with " << objErrors.size() << " errors."
0037             << std::endl;
0038   BOOST_CHECK(objErrors.empty());
0039   for (const auto& objerr : objErrors) {
0040     std::cout << objerr << std::endl;
0041   }
0042 
0043   // Triangular mesh test
0044   triangulate = true;
0045   auto objTest3M = VolumeView3DTest::run(obj, triangulate, "_3M");
0046   auto objErrors3M = testObjString(objTest3M, triangulate);
0047   std::cout << "Volumes Obj Test 3M : " << objTest3M.size()
0048             << " characters written with " << objErrors3M.size() << " errors."
0049             << std::endl;
0050   BOOST_CHECK(objErrors3M.empty());
0051   for (const auto& objerr : objErrors3M) {
0052     std::cout << objerr << std::endl;
0053   }
0054 }
0055 
0056 // Tests if the written ply output is well formatted
0057 BOOST_AUTO_TEST_CASE(VolumeView3DPly) {
0058   PlyVisualization3D ply;
0059 
0060   // Standard test
0061   bool triangulate = false;
0062   auto plyTest = VolumeView3DTest::run(ply, triangulate, "");
0063   auto plyErrors = testPlyString(plyTest, triangulate);
0064   std::cout << "Volumes Ply Test    : " << plyTest.size()
0065             << " characters written with " << plyErrors.size() << " errors."
0066             << std::endl;
0067   BOOST_CHECK(plyErrors.empty());
0068   for (const auto& plyerr : plyErrors) {
0069     std::cout << plyerr << std::endl;
0070   }
0071 
0072   // Triangular mesh test
0073   triangulate = true;
0074   auto plyTest3M = VolumeView3DTest::run(ply, triangulate, "_3M");
0075   auto plyErrors3M = testPlyString(plyTest3M, triangulate);
0076   std::cout << "Volumes Ply Test 3M : " << plyTest3M.size()
0077             << " characters written with " << plyErrors3M.size() << " errors."
0078             << std::endl;
0079   BOOST_CHECK(plyErrors3M.empty());
0080   for (const auto& plyerr : plyErrors3M) {
0081     std::cout << plyerr << std::endl;
0082   }
0083 }
0084 
0085 BOOST_AUTO_TEST_SUITE_END()
0086 
0087 }  // namespace Test
0088 }  // namespace Acts