@@ -139,8 +139,9 @@ TEST_CASE("Node", "[node]")
139139TEST_CASE (" Flatten" , " [nodegraph]" )
140140{
141141 // Read an example containing graph-based custom nodes.
142+ mx::FileSearchPath searchPath = mx::getDefaultDataSearchPath ();
142143 mx::DocumentPtr doc = mx::createDocument ();
143- mx::readFromXmlFile (doc, " resources/Materials/TestSuite/stdlib/shader/surface.mtlx" );
144+ mx::readFromXmlFile (doc, " resources/Materials/TestSuite/stdlib/shader/surface.mtlx" , searchPath );
144145 REQUIRE (doc->validate ());
145146
146147 // Count root-level, nested, and custom nodes.
@@ -174,8 +175,8 @@ TEST_CASE("Flatten", "[nodegraph]")
174175
175176TEST_CASE (" Inheritance" , " [nodedef]" )
176177{
178+ mx::FileSearchPath searchPath = mx::getDefaultDataSearchPath ();
177179 mx::DocumentPtr doc = mx::createDocument ();
178- mx::FileSearchPath searchPath (mx::FilePath::getCurrentPath ());
179180 mx::loadLibraries ({ " libraries" }, searchPath, doc);
180181 REQUIRE (doc->validate ());
181182 auto nodedef = doc->getNodeDef (" ND_standard_surface_surfaceshader" );
@@ -559,13 +560,12 @@ TEST_CASE("Organization", "[nodegraph]")
559560
560561TEST_CASE (" Tokens" , " [nodegraph]" )
561562{
562- mx::DocumentPtr doc = mx::createDocument ();
563- mx::loadLibrary (mx::FilePath::getCurrentPath () / mx::FilePath (" libraries/stdlib/stdlib_defs.mtlx" ), doc);
564- mx::loadLibrary (mx::FilePath::getCurrentPath () / mx::FilePath (" libraries/stdlib/stdlib_ng.mtlx" ), doc);
565- mx::FileSearchPath searchPath (" resources/Materials/TestSuite/stdlib/texture/" );
563+ mx::FileSearchPath searchPath = mx::getDefaultDataSearchPath ();
564+ mx::DocumentPtr stdlib = mx::createDocument ();
565+ mx::loadLibraries ({ " libraries" }, searchPath, stdlib);
566566
567- mx::readFromXmlFile ( doc, " tokenGraph.mtlx " , searchPath );
568- doc-> validate ( );
567+ mx::DocumentPtr doc = mx::createDocument ( );
568+ mx::readFromXmlFile (doc, " resources/Materials/TestSuite/stdlib/texture/tokenGraph.mtlx " , searchPath );
569569
570570 mx::StringVec graphNames = { " Tokenized_Image_2k_png" , " Tokenized_Image_4k_jpg" };
571571 mx::StringVec resolutionStrings = { " 2k" , " 4k" };
@@ -597,13 +597,13 @@ TEST_CASE("Tokens", "[nodegraph]")
597597
598598TEST_CASE (" Node Definition Creation" , " [nodedef]" )
599599{
600- mx::DocumentPtr doc = mx::createDocument ();
601- mx::loadLibrary (mx::FilePath::getCurrentPath () / mx::FilePath (" libraries/stdlib/stdlib_defs.mtlx" ), doc);
602- mx::loadLibrary (mx::FilePath::getCurrentPath () / mx::FilePath (" libraries/stdlib/stdlib_ng.mtlx" ), doc);
603- mx::FileSearchPath searchPath (" resources/Materials/TestSuite/stdlib/definition/" );
600+ mx::FileSearchPath searchPath = mx::getDefaultDataSearchPath ();
601+ mx::DocumentPtr stdlib = mx::createDocument ();
602+ mx::loadLibraries ({ " libraries" }, searchPath, stdlib);
604603
605- mx::readFromXmlFile (doc, " definition_from_nodegraph.mtlx" , searchPath);
606- REQUIRE (doc->validate ());
604+ mx::DocumentPtr doc = mx::createDocument ();
605+ mx::readFromXmlFile (doc, " resources/Materials/TestSuite/stdlib/definition/definition_from_nodegraph.mtlx" , searchPath);
606+ doc->importLibrary (stdlib);
607607
608608 mx::NodeGraphPtr graph = doc->getNodeGraph (" test_colorcorrect" );
609609 REQUIRE (graph);
@@ -721,7 +721,5 @@ TEST_CASE("Node Definition Creation", "[nodedef]")
721721 }
722722 REQUIRE (findDefault);
723723 }
724-
725724 REQUIRE (doc->validate ());
726- mx::writeToXmlFile (doc, " definition_from_nodegraph_out.mtlx" );
727725}
0 commit comments