38 lines
1.4 KiB
C++
38 lines
1.4 KiB
C++
|
//
|
||
|
// Created by martin on 04.02.22.
|
||
|
//
|
||
|
|
||
|
#include "AnimGraph/AnimGraphData.h"
|
||
|
#include "AnimGraph/AnimGraphNodes.h"
|
||
|
#include "catch.hpp"
|
||
|
|
||
|
TEST_CASE("Descriptor Access", "[NodeDescriptorTests]") {
|
||
|
Blend2Node blend2Node;
|
||
|
NodeDescriptor<Blend2Node> blend2Descriptor (&blend2Node);
|
||
|
CHECK(blend2Descriptor.m_inputs.size() == 3);
|
||
|
CHECK(*blend2Descriptor.m_inputs[0].m_reference.ptr_ptr == blend2Node.i_input0);
|
||
|
CHECK(*blend2Descriptor.m_inputs[1].m_reference.ptr_ptr == blend2Node.i_input1);
|
||
|
CHECK(*blend2Descriptor.m_inputs[2].m_reference.ptr_ptr == blend2Node.i_blend_weight);
|
||
|
|
||
|
CHECK(blend2Descriptor.m_inputs[0].m_type_size == sizeof(AnimData));
|
||
|
CHECK(blend2Descriptor.m_inputs[2].m_type_size == 4);
|
||
|
|
||
|
CHECK(blend2Descriptor.m_outputs.size() == 1);
|
||
|
CHECK(*blend2Descriptor.m_outputs[0].m_reference.ptr_ptr == blend2Node.o_output);
|
||
|
|
||
|
CHECK(blend2Descriptor.m_properties.size() == 1);
|
||
|
CHECK(blend2Descriptor.m_properties[0].m_reference.ptr == &blend2Node.m_sync_blend);
|
||
|
|
||
|
CHECK(blend2Node.i_input0 == nullptr);
|
||
|
AnimData some_anim_data;
|
||
|
blend2Descriptor.SetInput("Input0", &some_anim_data);
|
||
|
CHECK(blend2Node.i_input0 == &some_anim_data);
|
||
|
|
||
|
CHECK(blend2Node.m_sync_blend == false);
|
||
|
CHECK(blend2Descriptor.GetProperty<bool>("Sync") == false);
|
||
|
blend2Descriptor.SetProperty<bool>("Sync", true);
|
||
|
CHECK(blend2Node.m_sync_blend == true);
|
||
|
CHECK(blend2Descriptor.GetProperty<bool>("Sync") == true);
|
||
|
}
|
||
|
|