/*////////////////////////////////////////////////////////////////////////////// // 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 > //////////////////////////////////////////////////////////////////////////////*/ #include "Vtk/uLibVtkInterface.h" #include "Core/Property.h" #include #include #include "testing-prototype.h" using namespace uLib; using namespace Vtk; int main() { BEGIN_TESTING(Puppet Property Registration Test); std::cout << "Creating Puppet object..." << std::endl; Puppet p; // At this point, the Puppet constructor has called ULIB_ACTIVATE_PROPERTIES. // This should have discovered the members used in Puppet::serialize() // and registered them as uLib properties. const auto& props = p.GetProperties(); std::cout << "Total registered properties: " << props.size() << std::endl; // Verify specific properties exist Property* opacityProp = nullptr; Property* colorRProp = nullptr; for (auto* prop : props) { std::cout << " - [" << prop->GetTypeName() << "] " << prop->GetName() << " = " << prop->GetValueAsString() << std::endl; if (prop->GetName() == "Opacity") { opacityProp = dynamic_cast*>(prop); } if (prop->GetName() == "ColorR") { colorRProp = dynamic_cast*>(prop); } } assert(opacityProp != nullptr && "Opacity property not registered!"); assert(colorRProp != nullptr && "ColorR property not registered!"); // Test modification via uLib Property interface std::cout << "Modifying Opacity via property proxy (0.25)..." << std::endl; *opacityProp = 0.25; // Verify the proxy correctly updated the underlying data assert(opacityProp->Get() == 0.25); assert(opacityProp->GetValueAsString().find("0.25") != std::string::npos); std::cout << "Modifying ColorR via property proxy (0.9)..." << std::endl; *colorRProp = 0.9; assert(colorRProp->Get() == 0.9); std::cout << "All Puppet Property Registration Tests PASSED!" << std::endl; END_TESTING; }