Browse Source

Test model writing uses cloned model.

Vicente Penades 6 năm trước cách đây
mục cha
commit
c0070cc50b

+ 1 - 0
tests/SharpGLTF.Tests/Schema2/LoadAndSave/LoadModelTests.cs

@@ -90,6 +90,7 @@ namespace SharpGLTF.Schema2.LoadAndSave
 
                 // evaluate and save all the triangles to a Wavefront Object
                 model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(f), ".obj"));
+                model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(f), ".glb"));
 
                 // attempt clone
                 var xclone = model.DeepClone();

+ 3 - 0
tests/SharpGLTF.Tests/TestUtils.cs

@@ -46,6 +46,9 @@ namespace SharpGLTF
             
             if (fileName.ToLower().EndsWith(".glb"))
             {
+                // clone the model so merging the buffers will not affect the source model.
+                model = model.DeepClone();
+
                 // ensure the model has just one buffer
                 model.MergeImages();
                 model.MergeBuffers();