Skip to content

Commit

Permalink
--minor - stub out sensor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jturner65 committed Dec 9, 2024
1 parent 8882600 commit 0ff331c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/esp/metadata/managers/SensorAttributesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
7 changes: 7 additions & 0 deletions src/esp/metadata/managers/SensorAttributesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@

namespace esp {
namespace metadata {
namespace attributes {
class AudioSensorAttributes;
class CameraSensorAttributes;
class CustomSensorAttributes;
class EquirectangularSensorAttributes;
class FisheyeSensorAttributes;
} // namespace attributes

namespace managers {

Expand Down
28 changes: 28 additions & 0 deletions src/tests/AttributesConfigsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -167,6 +177,14 @@ struct AttributesConfigsTest : Cr::TestSuite::Tester {
void testSemanticAttrVals(
std::shared_ptr<Attrs::SemanticAttributes> 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<Attrs::AudioSensorAttributes> audioAttr,
const std::string& assetPath);
/**
* @brief This test will verify that the Stage attributes' managers' JSON
* loading process is working as expected.
Expand Down Expand Up @@ -200,6 +218,7 @@ struct AttributesConfigsTest : Cr::TestSuite::Tester {
void testLightJSONLoad();
void testSceneInstanceJSONLoad();
void testSemanticJSONLoad();
void testSensorAttrJSONLoad();
void testStageJSONLoad();
void testObjectJSONLoad();
void testArticulatedObjectJSONLoad();
Expand All @@ -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
Expand All @@ -235,6 +256,7 @@ AttributesConfigsTest::AttributesConfigsTest() {
pbrShaderAttributesManager_ = MM->getPbrShaderAttributesManager();
sceneInstanceAttributesManager_ = MM->getSceneInstanceAttributesManager();
semanticAttributesManager_ = MM->getSemanticAttributesManager();
sensorAttributesManager_ = MM->getSensorAttributesManager();
stageAttributesManager_ = MM->getStageAttributesManager();

addTests({
Expand All @@ -243,6 +265,7 @@ AttributesConfigsTest::AttributesConfigsTest() {
&AttributesConfigsTest::testLightJSONLoad,
&AttributesConfigsTest::testSceneInstanceJSONLoad,
&AttributesConfigsTest::testSemanticJSONLoad,
&AttributesConfigsTest::testSensorAttrJSONLoad,
&AttributesConfigsTest::testStageJSONLoad,
&AttributesConfigsTest::testObjectJSONLoad,
&AttributesConfigsTest::testArticulatedObjectJSONLoad,
Expand Down Expand Up @@ -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<Attrs::StageAttributes> stageAttr,
const std::string& assetPath) {
Expand Down

0 comments on commit 0ff331c

Please sign in to comment.