EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VolumeView3DTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file VolumeView3DTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/tools/output_test_stream.hpp>
10 #include <boost/test/unit_test.hpp>
11 
15 
16 #include <fstream>
17 #include <iostream>
18 
20 #include "VolumeView3DBase.hpp"
21 
22 namespace Acts {
23 namespace Test {
24 
25 BOOST_AUTO_TEST_SUITE(Visualization)
26 
27 // Tests if the written obj output is well formatted
28 BOOST_AUTO_TEST_CASE(VolumeView3DObj) {
30 
31  // Standard test
32  bool triangulate = false;
33  auto objTest = VolumeView3DTest::run(obj, triangulate, "");
34  auto objErrors = testObjString(objTest, triangulate);
35  std::cout << "Volumes Obj Test : " << objTest.size()
36  << " characters written with " << objErrors.size() << " errors."
37  << std::endl;
38  BOOST_CHECK(objErrors.size() == 0);
39  for (auto objerr : objErrors) {
40  std::cout << objerr << std::endl;
41  }
42 
43  // Triangular mesh test
44  triangulate = true;
45  auto objTest3M = VolumeView3DTest::run(obj, triangulate, "_3M");
46  auto objErrors3M = testObjString(objTest3M, triangulate);
47  std::cout << "Volumes Obj Test 3M : " << objTest3M.size()
48  << " characters written with " << objErrors3M.size() << " errors."
49  << std::endl;
50  BOOST_CHECK(objErrors3M.size() == 0);
51  for (auto objerr : objErrors3M) {
52  std::cout << objerr << std::endl;
53  }
54 }
55 
56 // Tests if the written ply output is well formatted
57 BOOST_AUTO_TEST_CASE(VolumeView3DPly) {
59 
60  // Standard test
61  bool triangulate = false;
62  auto plyTest = VolumeView3DTest::run(ply, triangulate, "");
63  auto plyErrors = testPlyString(plyTest, triangulate);
64  std::cout << "Volumes Ply Test : " << plyTest.size()
65  << " characters written with " << plyErrors.size() << " errors."
66  << std::endl;
67  BOOST_CHECK(plyErrors.size() == 0);
68  for (auto plyerr : plyErrors) {
69  std::cout << plyerr << std::endl;
70  }
71 
72  // Triangular mesh test
73  triangulate = true;
74  auto plyTest3M = VolumeView3DTest::run(ply, triangulate, "_3M");
75  auto plyErrors3M = testPlyString(plyTest3M, triangulate);
76  std::cout << "Volumes Ply Test 3M : " << plyTest3M.size()
77  << " characters written with " << plyErrors3M.size() << " errors."
78  << std::endl;
79  BOOST_CHECK(plyErrors3M.size() == 0);
80  for (auto plyerr : plyErrors3M) {
81  std::cout << plyerr << std::endl;
82  }
83 }
84 
85 BOOST_AUTO_TEST_SUITE_END()
86 
87 } // namespace Test
88 } // namespace Acts