opensurgsim
Namespaces | Functions
OsgUniformTests.cpp File Reference

Tests for the OsgUniform class. More...

#include "SurgSim/Graphics/OsgUniform.h"
#include "SurgSim/Math/Vector.h"
#include "SurgSim/Math/MathConvert.h"
#include <gtest/gtest.h>
#include <random>

Namespaces

 SurgSim
 Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui needs glew but we need to call glewInit() from a osg callback, using this call we avoid getting warnings about redefinitions.
 

Functions

template<class Type , class OsgType >
std::pair< Type, OsgType > SurgSim::Graphics::testUniformConstruction (const Type &value)
 Constructs an OsgUniform, sets it to the given value, and returns the result of Uniform::get() and the wrapped osg::Uniform::get(). More...
 
template<class Type >
std::pair< Type, boost::any > SurgSim::Graphics::testAccessible (const Type &value)
 
template<class Type >
Type SurgSim::Graphics::testYamlSetter (const Type &value)
 
template<class Type >
Type SurgSim::Graphics::testEncodeDecode (const Type &value)
 
template<class Type , class OsgType >
std::pair< std::vector< Type >, std::vector< OsgType > > SurgSim::Graphics::testUniformElementsConstruction (const std::vector< Type > &value, size_t numElements)
 Constructs an OsgUniform that stores a vector of values, sets it to the given vector values, and returns the result of Uniform::get() and the wrapped osg::Uniform::get(). More...
 
template<class FloatType >
void SurgSim::Graphics::testUniformFloat (FloatType min, FloatType max)
 Tests OsgUniform with a random floating point type value. More...
 
template<class FloatType >
void SurgSim::Graphics::testUniformElementsFloat (FloatType min, FloatType max, size_t numElements)
 Tests OsgUniform with a vector of random floating point type values. More...
 
template<class IntType >
void SurgSim::Graphics::testUniformInt (IntType min, IntType max)
 Tests OsgUniform with a random integer type value. More...
 
template<class IntType >
void SurgSim::Graphics::testUniformElementsInt (IntType min, IntType max, size_t numElements)
 Tests OsgUniform with a vector of random integer type values. More...
 
template<class Type , class OsgType >
void SurgSim::Graphics::testUniformEigen ()
 Tests OsgUniform with a random Eigen type values. More...
 
template<class Type , class OsgType >
void SurgSim::Graphics::testUniformElementsEigen (size_t numElements)
 Tests OsgUniform with a vector of random Eigen type values. More...
 
 SurgSim::Graphics::TEST (OsgUniformTests, FloatTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, DoubleTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, IntTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, UnsignedIntTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, BoolTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector2fTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector3fTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector4fTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector2dTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector3dTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector4dTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix22fTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix33fTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix44fTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix22dTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix33dTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix44dTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, FloatElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, DoubleElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, IntElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, UnsignedIntElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, BoolElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector2fElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector3fElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector4fElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector2dElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector3dElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Vector4dElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix22fElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix33fElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix44fElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix22dElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix33dElementsTest)
 
 SurgSim::Graphics::TEST (OsgUniformTests, Matrix44dElementsTest)
 

Detailed Description

Tests for the OsgUniform class.

Function Documentation

§ testUniformConstruction()

template<class Type , class OsgType >
std::pair<Type, OsgType> SurgSim::Graphics::testUniformConstruction ( const Type &  value)

Constructs an OsgUniform, sets it to the given value, and returns the result of Uniform::get() and the wrapped osg::Uniform::get().

Template Parameters
TypeUniform's value type
OsgTypeType stored in the osg::Uniform

§ testUniformEigen()

template<class Type , class OsgType >
void SurgSim::Graphics::testUniformEigen ( )

Tests OsgUniform with a random Eigen type values.

Template Parameters
TypeEigen type (Vector2f, Matrix44d, ...)
OsgTypeOSG type which corresponds with the Eigen type (must have a fromOsg() defined for this type)

§ testUniformElementsConstruction()

template<class Type , class OsgType >
std::pair<std::vector<Type>, std::vector<OsgType> > SurgSim::Graphics::testUniformElementsConstruction ( const std::vector< Type > &  value,
size_t  numElements 
)

Constructs an OsgUniform that stores a vector of values, sets it to the given vector values, and returns the result of Uniform::get() and the wrapped osg::Uniform::get().

Template Parameters
TypeUniform's value type
OsgTypeType stored in the osg::Uniform

§ testUniformElementsEigen()

template<class Type , class OsgType >
void SurgSim::Graphics::testUniformElementsEigen ( size_t  numElements)

Tests OsgUniform with a vector of random Eigen type values.

Template Parameters
TypeEigen type (Vector2f, Matrix44d, ...)
OsgTypeOSG type which corresponds with the Eigen type (must have a fromOsg() defined for this type)

§ testUniformElementsFloat()

template<class FloatType >
void SurgSim::Graphics::testUniformElementsFloat ( FloatType  min,
FloatType  max,
size_t  numElements 
)

Tests OsgUniform with a vector of random floating point type values.

Template Parameters
FloatTypeFloating point type (float, double, ...)
Parameters
minMinimum random value
maxMaximum random value
numElementsNumber of elements

§ testUniformElementsInt()

template<class IntType >
void SurgSim::Graphics::testUniformElementsInt ( IntType  min,
IntType  max,
size_t  numElements 
)

Tests OsgUniform with a vector of random integer type values.

Template Parameters
IntTypeInteger type (int, unsigned int, ...)
Parameters
minMinimum random value
maxMaximum random value
numElementsNumber of elements

§ testUniformFloat()

template<class FloatType >
void SurgSim::Graphics::testUniformFloat ( FloatType  min,
FloatType  max 
)

Tests OsgUniform with a random floating point type value.

Template Parameters
FloatTypeFloating point type (float, double, ...)
Parameters
minMinimum random value
maxMaximum random value

§ testUniformInt()

template<class IntType >
void SurgSim::Graphics::testUniformInt ( IntType  min,
IntType  max 
)

Tests OsgUniform with a random integer type value.

Template Parameters
IntTypeInteger type (int, unsigned int, ...)
Parameters
minMinimum random value
maxMaximum random value