Back to home page

EIC code displayed by LXR

 
 

    


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

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