2023-03-29 22:25:09 +02:00
|
|
|
//
|
|
|
|
// 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);
|
|
|
|
|
2023-03-30 16:53:09 +02:00
|
|
|
// Check we can properly update inputs
|
2023-03-29 22:25:09 +02:00
|
|
|
CHECK(blend2Node.i_input0 == nullptr);
|
|
|
|
AnimData some_anim_data;
|
|
|
|
blend2Descriptor.SetInput("Input0", &some_anim_data);
|
|
|
|
CHECK(blend2Node.i_input0 == &some_anim_data);
|
|
|
|
|
2023-03-30 16:53:09 +02:00
|
|
|
// Check we properly can set properties
|
2023-03-29 22:25:09 +02:00
|
|
|
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);
|
2023-03-30 16:53:09 +02:00
|
|
|
|
|
|
|
// Check that flags are properly set.
|
|
|
|
CHECK(blend2Node.m_sync_blend == true);
|
|
|
|
blend2Descriptor.UpdateFlags();
|
|
|
|
Socket* weight_input_socket = blend2Descriptor.GetInputSocket("Weight");
|
|
|
|
CHECK(weight_input_socket != nullptr);
|
|
|
|
CHECK(weight_input_socket->m_flags & SocketFlagAffectsTime == SocketFlagAffectsTime);
|
2023-03-29 22:25:09 +02:00
|
|
|
}
|
|
|
|
|