Browse Source

Trade: convenience default constructor for AnimationTrackData.

Otherwise one would need to use a NoInit Array constructor and that
would cause dangling deleter function pointer call after the plugin gets
unloaded.
pull/191/head
Vladimír Vondruš 8 years ago
parent
commit
0109e0d7fe
  1. 9
      src/Magnum/Trade/AnimationData.h
  2. 9
      src/Magnum/Trade/Test/AnimationDataTest.cpp

9
src/Magnum/Trade/AnimationData.h

@ -163,6 +163,15 @@ API.
*/
class AnimationTrackData {
public:
/**
* @brief Default constructor
*
* Leaves contents at unspecified values. Provided as a convenience for
* initialization of @ref AnimationData structure, expected to be
* replaced with concrete values later.
*/
/*implicit*/ AnimationTrackData() noexcept: _type{}, _resultType{}, _target{}, _targetId{}, _view{} {}
/**
* @brief Constructor
* @param type Value type

9
src/Magnum/Trade/Test/AnimationDataTest.cpp

@ -38,6 +38,8 @@ struct AnimationDataTest: TestSuite::Tester {
void constructCopy();
void constructMove();
void constructTrackDataDefault();
void trackCustomResultType();
void trackWrongIndex();
@ -53,6 +55,8 @@ AnimationDataTest::AnimationDataTest() {
&AnimationDataTest::constructCopy,
&AnimationDataTest::constructMove,
&AnimationDataTest::constructTrackDataDefault,
&AnimationDataTest::trackCustomResultType,
&AnimationDataTest::trackWrongIndex,
@ -225,6 +229,11 @@ void AnimationDataTest::constructMove() {
}
}
void AnimationDataTest::constructTrackDataDefault() {
AnimationTrackData data;
CORRADE_VERIFY(true); /* no public accessors here, so nothing to check */
}
void AnimationDataTest::trackCustomResultType() {
using namespace Math::Literals;

Loading…
Cancel
Save