From 0ff331c91a8d14715620856842fe8d9552a671c3 Mon Sep 17 00:00:00 2001 From: John Turner <7strbass@gmail.com> Date: Sun, 8 Dec 2024 10:53:57 -0500 Subject: [PATCH] --minor - stub out sensor tests --- .../managers/SensorAttributesManager.cpp | 3 ++ .../managers/SensorAttributesManager.h | 7 +++++ src/tests/AttributesConfigsTest.cpp | 28 +++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/src/esp/metadata/managers/SensorAttributesManager.cpp b/src/esp/metadata/managers/SensorAttributesManager.cpp index 248ba76242..bd704baa4c 100644 --- a/src/esp/metadata/managers/SensorAttributesManager.cpp +++ b/src/esp/metadata/managers/SensorAttributesManager.cpp @@ -204,6 +204,9 @@ AbstractSensorAttributes::ptr SensorAttributesManager::initNewObjectInternal( const std::string& sensorAttrClassName, bool builtFromConfig) { // sensorAttrClassName is the class of the sensor attributes to build + // Instead of building the attributes using whatever name is passed into the + // create workflow, we use the sensorAttrClassName to determine which + // constructor to invoke. auto sensorTypeCtorIter = sensorTypeConstructorMap_.find(sensorAttrClassName); if (sensorTypeCtorIter == sensorTypeConstructorMap_.end()) { diff --git a/src/esp/metadata/managers/SensorAttributesManager.h b/src/esp/metadata/managers/SensorAttributesManager.h index 0d6cdb2a13..3d6345d254 100644 --- a/src/esp/metadata/managers/SensorAttributesManager.h +++ b/src/esp/metadata/managers/SensorAttributesManager.h @@ -15,6 +15,13 @@ namespace esp { namespace metadata { +namespace attributes { +class AudioSensorAttributes; +class CameraSensorAttributes; +class CustomSensorAttributes; +class EquirectangularSensorAttributes; +class FisheyeSensorAttributes; +} // namespace attributes namespace managers { diff --git a/src/tests/AttributesConfigsTest.cpp b/src/tests/AttributesConfigsTest.cpp index 97d8bb04f4..7d3e1e9905 100644 --- a/src/tests/AttributesConfigsTest.cpp +++ b/src/tests/AttributesConfigsTest.cpp @@ -12,6 +12,7 @@ #include "esp/metadata/managers/ObjectAttributesManager.h" #include "esp/metadata/managers/PbrShaderAttributesManager.h" #include "esp/metadata/managers/PhysicsAttributesManager.h" +#include "esp/metadata/managers/SensorAttributesManager.h" #include "esp/metadata/managers/StageAttributesManager.h" #include "esp/physics/RigidBase.h" @@ -32,6 +33,11 @@ using esp::physics::MotionType; using AttrMgrs::AbstractAttributesManager; using Attrs::ArticulatedObjectAttributes; +using Attrs::AudioSensorAttributes; +using Attrs::CameraSensorAttributes; +using Attrs::CustomSensorAttributes; +using Attrs::EquirectangularSensorAttributes; +using Attrs::FisheyeSensorAttributes; using Attrs::MarkerSets; using Attrs::ObjectAttributes; using Attrs::PbrShaderAttributes; @@ -127,6 +133,10 @@ struct AttributesConfigsTest : Cr::TestSuite::Tester { const AllMarkerSetsTestMap& // markers in link subset markerSetsInfoHierarchy); + ////////////////////////////// + // Test attributes values + // These tests validate passed attributes' values to what is expected. + /** * @brief This test will verify that the physics attributes' managers' JSON * loading process is working as expected. @@ -167,6 +177,14 @@ struct AttributesConfigsTest : Cr::TestSuite::Tester { void testSemanticAttrVals( std::shared_ptr semanticAttr, const std::string& assetPath); + + /** + * @brief This test will verify that the AudioSensorAttributes' managers' load + * from sensorSpec process is working as expected. + */ + void testAudioSensorAttrValsSpec( + std::shared_ptr audioAttr, + const std::string& assetPath); /** * @brief This test will verify that the Stage attributes' managers' JSON * loading process is working as expected. @@ -200,6 +218,7 @@ struct AttributesConfigsTest : Cr::TestSuite::Tester { void testLightJSONLoad(); void testSceneInstanceJSONLoad(); void testSemanticJSONLoad(); + void testSensorAttrJSONLoad(); void testStageJSONLoad(); void testObjectJSONLoad(); void testArticulatedObjectJSONLoad(); @@ -219,6 +238,8 @@ struct AttributesConfigsTest : Cr::TestSuite::Tester { sceneInstanceAttributesManager_ = nullptr; AttrMgrs::SemanticAttributesManager::ptr semanticAttributesManager_ = nullptr; + AttrMgrs::SensorAttributesManager::ptr sensorAttributesManager_ = nullptr; + AttrMgrs::StageAttributesManager::ptr stageAttributesManager_ = nullptr; }; // struct AttributesConfigsTest @@ -235,6 +256,7 @@ AttributesConfigsTest::AttributesConfigsTest() { pbrShaderAttributesManager_ = MM->getPbrShaderAttributesManager(); sceneInstanceAttributesManager_ = MM->getSceneInstanceAttributesManager(); semanticAttributesManager_ = MM->getSemanticAttributesManager(); + sensorAttributesManager_ = MM->getSensorAttributesManager(); stageAttributesManager_ = MM->getStageAttributesManager(); addTests({ @@ -243,6 +265,7 @@ AttributesConfigsTest::AttributesConfigsTest() { &AttributesConfigsTest::testLightJSONLoad, &AttributesConfigsTest::testSceneInstanceJSONLoad, &AttributesConfigsTest::testSemanticJSONLoad, + &AttributesConfigsTest::testSensorAttrJSONLoad, &AttributesConfigsTest::testStageJSONLoad, &AttributesConfigsTest::testObjectJSONLoad, &AttributesConfigsTest::testArticulatedObjectJSONLoad, @@ -1299,6 +1322,11 @@ void AttributesConfigsTest::testSemanticJSONLoad() { } // AttributesConfigsTest::testSemanticJSONLoad +void AttributesConfigsTest::testSensorAttrJSONLoad() { + // add dummy test so that test will run + CORRADE_VERIFY(true); +} // AttributesConfigsTest::testSensorAttrJSONLoad + void AttributesConfigsTest::testStageAttrVals( std::shared_ptr stageAttr, const std::string& assetPath) {