Files
uLib/src/Vtk/HEP/Detectors/testing/vtkDetectorChamberTest.cpp

64 lines
2.2 KiB
C++

/*//////////////////////////////////////////////////////////////////////////////
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
All rights reserved
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
------------------------------------------------------------------
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library.
//////////////////////////////////////////////////////////////////////////////*/
#include "Vtk/HEP/Detectors/vtkDetectorChamber.h"
#include "Vtk/HEP/Detectors/vtkDetectorChamber.h"
#include "Math/Units.h"
#include "Vtk/uLibVtkViewer.h"
#define BOOST_TEST_MODULE vtkDetectorChamberTest
#include <boost/test/unit_test.hpp>
using namespace uLib;
BOOST_AUTO_TEST_CASE(vtkDetectorChamberTest) {
DetectorChamber d1, d2;
d1.Scale(Vector3f(1_m, 2_m, 20_cm));
d1.Translate(Vector3f(0, 0, 0));
d2.Rotate(180_deg, Vector3f(0, 1, 0));
d2.Scale(Vector3f(1_m, 2_m, 20_cm));
d2.Translate(Vector3f(1_m, 0, 10_m));
Vtk::DetectorChamber v_d1(&d1);
Vtk::DetectorChamber v_d2(&d2);
v_d1.SetRepresentation(Vtk::Prop3D::Surface);
v_d2.SetRepresentation(Vtk::Prop3D::Surface);
if (!v_d1.GetProp()) {
BOOST_FAIL("DetectorChamber::GetProp() returned NULL");
}
if (std::getenv("CTEST_PROJECT_NAME") == nullptr) {
Vtk::Viewer viewer;
viewer.SetGridAxis(Vtk::Viewport::Y);
viewer.AddProp3D(v_d1);
viewer.AddProp3D(v_d2);
viewer.Start();
}
BOOST_CHECK(true); // reached here without crash
}