// Copyright Epic Games, Inc. All Rights Reserved. #include "TestGraphElement.h" #include "TestHarness.h" #include "Graph/Graph.h" #include "Graph/GraphIsland.h" #include "Graph/GraphVertex.h" TEST_CASE("Graph::Element::Element Type", "[graph][element]") { SECTION("Vertex") { UGraphVertex* Vertex = NewObject(); CHECK(Vertex->GetElementType() == EGraphElementType::Node); } SECTION("Island") { UGraphIsland* Island = NewObject(); CHECK(Island->GetElementType() == EGraphElementType::Island); } } TEST_CASE("Graph::Element::Unique Index", "[graph][properties]") { UTestGraphElement* Element = NewObject(); SECTION("Non-Temp") { FGraphUniqueIndex Test{ FGuid::NewGuid(), false }; Element->PublicSetUniqueIndex(Test); CHECK(Element->PublicGetUniqueIndex() == Test); } SECTION("Non-Temp") { FGraphUniqueIndex Test{ FGuid::NewGuid(), true }; Element->PublicSetUniqueIndex(Test); CHECK(Element->PublicGetUniqueIndex() == Test); } } TEST_CASE("Graph::Element::Graph Pointer", "[graph][properties]") { UTestGraphElement* Element = NewObject(); SECTION("Set graph") { TObjectPtr TestGraph = NewObject(); Element->PublicSetParentGraph(TestGraph); CHECK(Element->PublicGetGraph() == TestGraph); } SECTION("Set nullptr") { Element->PublicSetParentGraph(nullptr); CHECK(Element->PublicGetGraph() == nullptr); } }