Vicente Penades 6 years ago
parent
commit
aa274c601f

+ 2 - 2
src/Shared/Guard.cs

@@ -65,8 +65,8 @@ namespace SharpGLTF
         public static void MustBeNull(object target, string parameterName, string message = "")
         public static void MustBeNull(object target, string parameterName, string message = "")
         {
         {
             if (target == null) return;
             if (target == null) return;
-            if (string.IsNullOrWhiteSpace(message)) throw new ArgumentNullException(parameterName);
-            throw new ArgumentNullException(parameterName, message);
+            if (string.IsNullOrWhiteSpace(message)) throw new ArgumentException("Argument must be null.", parameterName);
+            throw new ArgumentException(parameterName, message);
         }
         }
 
 
         #endregion
         #endregion

+ 2 - 2
src/SharpGLTF.Core/Schema2/gltf.Textures.cs

@@ -58,10 +58,10 @@ namespace SharpGLTF.Schema2
         private Image _GetPrimaryImage()
         private Image _GetPrimaryImage()
         {
         {
             var ddstex = this.GetExtension<TextureDDS>();
             var ddstex = this.GetExtension<TextureDDS>();
-            if (ddstex != null) return ddstex.Image;
+            if (ddstex != null && ddstex.Image != null) return ddstex.Image;
 
 
             var wbptex = this.GetExtension<TextureWEBP>();
             var wbptex = this.GetExtension<TextureWEBP>();
-            if (wbptex != null) return wbptex.Image;
+            if (wbptex != null && wbptex.Image != null) return wbptex.Image;
 
 
             return _source.HasValue ? LogicalParent.LogicalImages[_source.Value] : null;
             return _source.HasValue ? LogicalParent.LogicalImages[_source.Value] : null;
         }
         }

+ 1 - 0
tests/SharpGLTF.Tests/AssemblyAPITests.cs

@@ -9,6 +9,7 @@ using NUnit.Framework;
 namespace SharpGLTF
 namespace SharpGLTF
 {
 {
     [TestFixture]
     [TestFixture]
+    [Category("API Validation")]
     public class AssemblyAPITests
     public class AssemblyAPITests
     {
     {
         public class TestClass
         public class TestClass

+ 6 - 3
tests/SharpGLTF.Tests/Collections/ChildrenCollectionTests.cs

@@ -7,10 +7,9 @@ using NUnit.Framework;
 namespace SharpGLTF.Collections
 namespace SharpGLTF.Collections
 {
 {
     [TestFixture]
     [TestFixture]
+    [Category("Core")]
     public class ChildrenCollectionTests
     public class ChildrenCollectionTests
     {
     {
-        public TestContext TestContext { get; set; }
-
         class TestChild : IChildOf<ChildrenCollectionTests>
         class TestChild : IChildOf<ChildrenCollectionTests>
         {
         {
             public ChildrenCollectionTests LogicalParent { get; private set; }
             public ChildrenCollectionTests LogicalParent { get; private set; }
@@ -22,16 +21,20 @@ namespace SharpGLTF.Collections
         }
         }
 
 
         [Test]
         [Test]
-        public void ListTest1()
+        public void TestChildCollectionList1()
         {
         {
             var list = new ChildrenCollection<TestChild, ChildrenCollectionTests>(this);
             var list = new ChildrenCollection<TestChild, ChildrenCollectionTests>(this);
 
 
+            Assert.Throws<ArgumentNullException>(() => list.Add(null));
+
             var item1 = new TestChild();
             var item1 = new TestChild();
             Assert.IsNull(item1.LogicalParent);
             Assert.IsNull(item1.LogicalParent);
 
 
             list.Add(item1);
             list.Add(item1);
             Assert.AreSame(item1.LogicalParent, this);
             Assert.AreSame(item1.LogicalParent, this);
 
 
+            Assert.Throws<ArgumentException>(() => list.Add(item1));
+
             list.Remove(item1);
             list.Remove(item1);
             Assert.IsNull(item1.LogicalParent);
             Assert.IsNull(item1.LogicalParent);
         }
         }

+ 2 - 1
tests/SharpGLTF.Tests/ExtensionsTests.cs

@@ -10,6 +10,7 @@ namespace SharpGLTF
     using Schema2;
     using Schema2;
 
 
     [TestFixture]
     [TestFixture]
+    [Category("Core")]
     public class ExtensionsTests
     public class ExtensionsTests
     {
     {
         internal static int _WordPadded(int length)
         internal static int _WordPadded(int length)
@@ -20,7 +21,7 @@ namespace SharpGLTF
         }
         }
 
 
         [Test]
         [Test]
-        public void Padding()
+        public void TestPadding()
         {
         {
             Assert.AreEqual(4, _WordPadded(1));
             Assert.AreEqual(4, _WordPadded(1));
             Assert.AreEqual(4, _WordPadded(2));
             Assert.AreEqual(4, _WordPadded(2));

+ 0 - 46
tests/SharpGLTF.Tests/Geometry/LoadMeshTests.cs

@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using NUnit.Framework;
-
-namespace SharpGLTF.Geometry
-{
-    [TestFixture]
-    public class LoadMeshTests
-    {
-        #region setup
-
-        [OneTimeSetUp]
-        public void Setup()
-        {
-            TestFiles.DownloadReferenceModels();
-        }
-
-        #endregion
-
-        [Test]
-        public void LoadModels()
-        {
-            foreach (var f in TestFiles.GetSampleModelsPaths())
-            {
-                var root = Schema2.ModelRoot.Load(f);
-                Assert.NotNull(root);
-            }
-        }
-
-        [Test]
-        public void LoadBrokenFile()
-        {
-            var f = TestFiles.GetSampleModelsPaths().First(item => item.EndsWith(".gltf"));
-
-            var json = System.IO.File.ReadAllText(f);
-
-            // break the file
-            json = json.Substring(0, json.Length - 40);
-
-            Assert.Throws<Validation.SchemaException>(() => Schema2.ModelRoot.ParseGLTF(json, new Schema2.ReadSettings()));
-        }
-    }
-}

+ 1 - 0
tests/SharpGLTF.Tests/Geometry/VertexTypes/JointWeightPairTests.cs

@@ -7,6 +7,7 @@ using NUnit.Framework;
 namespace SharpGLTF.Geometry.VertexTypes
 namespace SharpGLTF.Geometry.VertexTypes
 {
 {
     [TestFixture]
     [TestFixture]
+    [Category("Toolkit")]
     public class JointWeightPairTests
     public class JointWeightPairTests
     {
     {
         [Test]
         [Test]

+ 1 - 0
tests/SharpGLTF.Tests/Geometry/VertexTypes/VertexSkinningTests.cs

@@ -7,6 +7,7 @@ using NUnit.Framework;
 namespace SharpGLTF.Geometry.VertexTypes
 namespace SharpGLTF.Geometry.VertexTypes
 {
 {
     [TestFixture]
     [TestFixture]
+    [Category("Toolkit")]
     public class VertexSkinningTests
     public class VertexSkinningTests
     {
     {
         [Test]
         [Test]

+ 2 - 1
tests/SharpGLTF.Tests/Memory/MemoryAccessorTests.cs

@@ -7,10 +7,11 @@ using NUnit.Framework;
 namespace SharpGLTF.Memory
 namespace SharpGLTF.Memory
 {
 {
     [TestFixture]
     [TestFixture]
+    [Category("Core Memory")]
     public class MemoryAccessorTests
     public class MemoryAccessorTests
     {
     {
         [Test]
         [Test]
-        public void TestCreateInterleaved1()
+        public void CreateInterleaved1()
         {
         {
             var pos = MemoryAccessInfo.CreateDefaultElement("POSITION");
             var pos = MemoryAccessInfo.CreateDefaultElement("POSITION");
             var nrm = MemoryAccessInfo.CreateDefaultElement("NORMAL");
             var nrm = MemoryAccessInfo.CreateDefaultElement("NORMAL");

+ 17 - 18
tests/SharpGLTF.Tests/Memory/MemoryArrayTests.cs

@@ -1,18 +1,17 @@
 using System;
 using System;
-using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Numerics;
 using System.Numerics;
-using System.Text;
 
 
 using NUnit.Framework;
 using NUnit.Framework;
 
 
 namespace SharpGLTF.Memory
 namespace SharpGLTF.Memory
 {
 {
     [TestFixture]
     [TestFixture]
+    [Category("Core Memory")]
     public class MemoryArrayTests
     public class MemoryArrayTests
     {
     {
         [Test]
         [Test]
-        public void TestFloatingArray()
+        public void TestFloatingArrayDecoding()
         {
         {
             Assert.AreEqual(17, _CreateFloatingAccessor(new Byte[] { 17 }, Schema2.EncodingType.UNSIGNED_BYTE, false)[0]);
             Assert.AreEqual(17, _CreateFloatingAccessor(new Byte[] { 17 }, Schema2.EncodingType.UNSIGNED_BYTE, false)[0]);
             Assert.AreEqual(17, _CreateFloatingAccessor(new Byte[] { 17, 0 }, Schema2.EncodingType.UNSIGNED_SHORT, false)[0]);            
             Assert.AreEqual(17, _CreateFloatingAccessor(new Byte[] { 17, 0 }, Schema2.EncodingType.UNSIGNED_SHORT, false)[0]);            
@@ -35,22 +34,10 @@ namespace SharpGLTF.Memory
         private static FloatingAccessor _CreateFloatingAccessor(byte[] data, Schema2.EncodingType encoding, bool normalized)
         private static FloatingAccessor _CreateFloatingAccessor(byte[] data, Schema2.EncodingType encoding, bool normalized)
         {
         {
             return new FloatingAccessor(new ArraySegment<byte>(data), 0, int.MaxValue, 0, 1, encoding, normalized);
             return new FloatingAccessor(new ArraySegment<byte>(data), 0, int.MaxValue, 0, 1, encoding, normalized);
-        }
-
-        [Test]
-        public void TestLinq()
-        {
-            var buffer = new Byte[] { 1, 52, 43, 6, 23, 234 };
-
-            var accessor = new Vector2Array(buffer, 0, Schema2.EncodingType.BYTE, true);
-
-            var result = accessor.ToArray();
-
-            Assert.AreEqual(3, result.Length);
-        }
+        }        
 
 
         [Test]
         [Test]
-        public void FillEncoded1()
+        public void TestFloatingArrayEncoding1()
         {
         {
             var v1 = new Vector4(0.1f, 0.2f, 0.6f, 0.8f);
             var v1 = new Vector4(0.1f, 0.2f, 0.6f, 0.8f);
             var v2 = new Vector4(1, 2, 3, 4);
             var v2 = new Vector4(1, 2, 3, 4);
@@ -67,7 +54,7 @@ namespace SharpGLTF.Memory
         }
         }
 
 
         [Test]
         [Test]
-        public void FillEncoded2()
+        public void TestFloatingArrayEncoding2()
         {
         {
             var v1 = new Vector4(0.1f, 0.2f, 0.6f, 0.8f);
             var v1 = new Vector4(0.1f, 0.2f, 0.6f, 0.8f);
             var v2 = new Vector4(1, 2, 3, 4);
             var v2 = new Vector4(1, 2, 3, 4);
@@ -84,5 +71,17 @@ namespace SharpGLTF.Memory
             v4u[1] = v2;
             v4u[1] = v2;
             VectorUtils.AreEqual(v4u[1], v2);
             VectorUtils.AreEqual(v4u[1], v2);
         }
         }
+
+        [Test]
+        public void TestLinqAccess()
+        {
+            var buffer = new Byte[] { 1, 52, 43, 6, 23, 234 };
+
+            var accessor = new Vector2Array(buffer, 0, Schema2.EncodingType.BYTE, true);
+
+            var result = accessor.ToArray();
+
+            Assert.AreEqual(3, result.Length);
+        }
     }
     }
 }
 }

+ 0 - 40
tests/SharpGLTF.Tests/Schema2/AccessorSparseTests.cs

@@ -1,40 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using NUnit.Framework;
-
-namespace SharpGLTF.Schema2
-{
-    [TestFixture]
-    public class AccessorSparseTests
-    {
-        #region setup
-
-        [OneTimeSetUp]
-        public void Setup()
-        {
-            TestFiles.DownloadReferenceModels();
-        }
-
-        #endregion
-
-        [Test]
-        public void TestLoadSparseModel()
-        {
-            var path = TestFiles.GetSampleModelsPaths().FirstOrDefault(item => item.Contains("SimpleSparseAccessor.gltf"));
-            
-            var model = ModelRoot.Load(path);
-            Assert.NotNull(model);
-
-            var primitive = model.LogicalMeshes[0].Primitives[0];
-
-            var accessor = primitive.GetVertexAccessor("POSITION");
-
-            var basePositions = accessor._GetMemoryAccessor().AsVector3Array();
-
-            var positions = accessor.AsVector3Array();            
-        }
-    }
-}

+ 7 - 14
tests/SharpGLTF.Tests/Schema2/Authoring/BasicSceneCreationTests.cs

@@ -1,19 +1,14 @@
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-using System.Text;
-using System.Linq;
+using System.Numerics;
 
 
 using NUnit.Framework;
 using NUnit.Framework;
 
 
 namespace SharpGLTF.Schema2.Authoring
 namespace SharpGLTF.Schema2.Authoring
 {
 {
-    using VPOS = Geometry.VertexTypes.VertexPosition;
-    using VTEX = Geometry.VertexTypes.VertexTexture1;
     using VPOSNRM = Geometry.VertexTypes.VertexPositionNormal;
     using VPOSNRM = Geometry.VertexTypes.VertexPositionNormal;
-    
+
 
 
     [TestFixture]
     [TestFixture]
+    [Category("Model Authoring")]
     public class BasicSceneCreationTests
     public class BasicSceneCreationTests
     {
     {
         [Test(Description = "Creates an empty model")]
         [Test(Description = "Creates an empty model")]
@@ -73,7 +68,7 @@ namespace SharpGLTF.Schema2.Authoring
         }
         }
 
 
         [Test(Description = "Creates a model with a triangle mesh")]
         [Test(Description = "Creates a model with a triangle mesh")]
-        public void CreateSolidTriangleScene()
+        public void CreateSceneWithSolidTriangle()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
@@ -117,7 +112,7 @@ namespace SharpGLTF.Schema2.Authoring
         }
         }
 
 
         [Test(Description = "Creates a model with a textured triangle mesh")]
         [Test(Description = "Creates a model with a textured triangle mesh")]
-        public void CreateTextureTriangleScene()
+        public void CreateSceneWithTexturedTriangle()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
@@ -164,7 +159,7 @@ namespace SharpGLTF.Schema2.Authoring
         }
         }
 
 
         [Test(Description = "Creates an interleaved scene using a toolkit utilities")]
         [Test(Description = "Creates an interleaved scene using a toolkit utilities")]
-        public void CreateInterleavedQuadScene()
+        public void CreateSceneWithInterleavedQuadMesh()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
@@ -191,8 +186,6 @@ namespace SharpGLTF.Schema2.Authoring
 
 
             model.AttachToCurrentTest("result.glb");
             model.AttachToCurrentTest("result.glb");
             model.AttachToCurrentTest("result.gltf");
             model.AttachToCurrentTest("result.gltf");
-        }
-
-        
+        }        
     }
     }
 }
 }

+ 5 - 8
tests/SharpGLTF.Tests/Schema2/Authoring/ExtensionsCreationTests.cs

@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-using System.Text;
+using System.Numerics;
 
 
 using NUnit.Framework;
 using NUnit.Framework;
 
 
@@ -9,13 +6,13 @@ namespace SharpGLTF.Schema2.Authoring
 {
 {
     using VPOS = Geometry.VertexTypes.VertexPosition;
     using VPOS = Geometry.VertexTypes.VertexPosition;
     using VTEX = Geometry.VertexTypes.VertexTexture1;
     using VTEX = Geometry.VertexTypes.VertexTexture1;
-    using VPOSNRM = Geometry.VertexTypes.VertexPositionNormal;
 
 
     [TestFixture]
     [TestFixture]
+    [Category("Model Authoring")]
     public class ExtensionsCreationTests
     public class ExtensionsCreationTests
     {
     {
         [Test(Description = "Creates a scene with lights")]
         [Test(Description = "Creates a scene with lights")]
-        public void CreateSceneWithLights()
+        public void CreateSceneWithWithLightsExtension()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
@@ -37,7 +34,7 @@ namespace SharpGLTF.Schema2.Authoring
         }
         }
 
 
         [Test(Description = "Creates a quad mesh with a complex material")]
         [Test(Description = "Creates a quad mesh with a complex material")]
-        public void CreateFallbackMaterialScene()
+        public void CreateSceneWithSpecularGlossinessExtension()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
@@ -81,7 +78,7 @@ namespace SharpGLTF.Schema2.Authoring
 
 
         [TestCase("shannon-dxt5.dds")]
         [TestCase("shannon-dxt5.dds")]
         [TestCase("shannon.webp")]
         [TestCase("shannon.webp")]
-        public void CreateExtensionTextureScene(string textureFileName)
+        public void CreateSceneWithTextureExtension(string textureFileName)
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();

+ 7 - 10
tests/SharpGLTF.Tests/Schema2/Authoring/MeshBuilderCreationTests.cs

@@ -1,7 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Numerics;
 using System.Numerics;
-using System.Text;
 using System.Linq;
 using System.Linq;
 
 
 using NUnit.Framework;
 using NUnit.Framework;
@@ -14,16 +13,14 @@ namespace SharpGLTF.Schema2.Authoring
     using VEMPTY = Geometry.VertexTypes.VertexEmpty;
     using VEMPTY = Geometry.VertexTypes.VertexEmpty;
     using VPOSNRM = Geometry.VertexTypes.VertexPositionNormal;
     using VPOSNRM = Geometry.VertexTypes.VertexPositionNormal;
     using VPOS = Geometry.VertexTypes.VertexPosition;
     using VPOS = Geometry.VertexTypes.VertexPosition;
-    using VCLR1 = Geometry.VertexTypes.VertexColor1;
-    using VTEX1 = Geometry.VertexTypes.VertexTexture1;
     using VSKIN4 = Geometry.VertexTypes.VertexJoints8x4;
     using VSKIN4 = Geometry.VertexTypes.VertexJoints8x4;
-    
 
 
     [TestFixture]
     [TestFixture]
+    [Category("Model Authoring")]
     public class MeshBuilderCreationTests
     public class MeshBuilderCreationTests
     {
     {
         [Test(Description = "Creates an interleaved scene using a mesh builder helper class")]
         [Test(Description = "Creates an interleaved scene using a mesh builder helper class")]
-        public void CreateInterleavedMeshBuilderScene()
+        public void CreateSceneWithInterleavedMeshBuilder()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
@@ -55,7 +52,7 @@ namespace SharpGLTF.Schema2.Authoring
         }
         }
 
 
         [Test(Description = "Creates a scene with 4 meshes, where the meshes have been initialized so they can share the same vertex and index buffers")]
         [Test(Description = "Creates a scene with 4 meshes, where the meshes have been initialized so they can share the same vertex and index buffers")]
-        public void CreateSharedBuffersScene()
+        public void CreateSceneWithSharedBuffers()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
@@ -107,7 +104,7 @@ namespace SharpGLTF.Schema2.Authoring
         }
         }
 
 
         [Test(Description = "Creates a node animated scene.")]
         [Test(Description = "Creates a node animated scene.")]
-        public void CreateAnimatedMeshBuilderScene()
+        public void CreateSceneWithAnimatedMeshBuilder()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
@@ -142,7 +139,7 @@ namespace SharpGLTF.Schema2.Authoring
         }        
         }        
 
 
         [Test(Description = "Creates a skinned animated scene.")]
         [Test(Description = "Creates a skinned animated scene.")]
-        public void CreateSkinnedAnimatedMeshBuilderScene()
+        public void CreateSceneWithSkinnedAnimatedMeshBuilder()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
@@ -213,7 +210,7 @@ namespace SharpGLTF.Schema2.Authoring
         }
         }
 
 
         [Test(Description = "Creates a textured terrain mesh.")]
         [Test(Description = "Creates a textured terrain mesh.")]
-        public void CreateTerrainScene()
+        public void CreateSceneWithTerrain()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
@@ -259,7 +256,7 @@ namespace SharpGLTF.Schema2.Authoring
         }
         }
 
 
         [Test]
         [Test]
-        public void CreateRandomCubesScene()
+        public void CreateSceneWithRandomCubes()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();

+ 3 - 2
tests/SharpGLTF.Tests/Schema2/LoadAndSave/LoadGeneratedTests.cs

@@ -11,6 +11,7 @@ namespace SharpGLTF.Schema2.LoadAndSave
     /// Test cases for models found in <see href="https://github.com/bghgary/glTF-Asset-Generator"/>
     /// Test cases for models found in <see href="https://github.com/bghgary/glTF-Asset-Generator"/>
     /// </summary>
     /// </summary>
     [TestFixture]
     [TestFixture]
+    [Category("Model Load and Save")]
     public class LoadGeneratedTests
     public class LoadGeneratedTests
     {
     {
         #region setup
         #region setup
@@ -24,7 +25,7 @@ namespace SharpGLTF.Schema2.LoadAndSave
         #endregion        
         #endregion        
 
 
         [Test]
         [Test]
-        public void TestLoadPositiveModels()
+        public void LoadPositiveModels()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
 
 
@@ -74,7 +75,7 @@ namespace SharpGLTF.Schema2.LoadAndSave
         }
         }
 
 
         [Test]
         [Test]
-        public void TestLoadNegativeModels()
+        public void LoadNegativeModels()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
 
 

+ 2 - 1
tests/SharpGLTF.Tests/Schema2/LoadAndSave/LoadInvalidTests.cs

@@ -7,10 +7,11 @@ using NUnit.Framework;
 namespace SharpGLTF.Schema2.LoadAndSave
 namespace SharpGLTF.Schema2.LoadAndSave
 {
 {
     [TestFixture]
     [TestFixture]
+    [Category("Model Load and Save")]
     public class LoadInvalidTests
     public class LoadInvalidTests
     {
     {
         [Test]
         [Test]
-        public void TestLoadInvalidJson()
+        public void LoadInvalidJsonModel()
         {
         {
             var path = System.IO.Path.Combine(TestContext.CurrentContext.TestDirectory, "Assets", "Invalid_Json.gltf");
             var path = System.IO.Path.Combine(TestContext.CurrentContext.TestDirectory, "Assets", "Invalid_Json.gltf");
 
 

+ 2 - 1
tests/SharpGLTF.Tests/Schema2/LoadAndSave/LoadPollyTest.cs

@@ -10,6 +10,7 @@ namespace SharpGLTF.Schema2.LoadAndSave
     /// Test cases for models found in <see href="https://github.com/KhronosGroup/glTF-Blender-Exporter"/>
     /// Test cases for models found in <see href="https://github.com/KhronosGroup/glTF-Blender-Exporter"/>
     /// </summary>
     /// </summary>
     [TestFixture]
     [TestFixture]
+    [Category("Model Load and Save")]
     public class LoadPollyTest
     public class LoadPollyTest
     {
     {
         #region setup
         #region setup
@@ -23,7 +24,7 @@ namespace SharpGLTF.Schema2.LoadAndSave
         #endregion
         #endregion
 
 
         [Test(Description = "Example of traversing the visual tree all the way to individual vertices and indices")]
         [Test(Description = "Example of traversing the visual tree all the way to individual vertices and indices")]
-        public void TestLoadPolly()
+        public void LoadPollyModel()
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
 
 

+ 34 - 18
tests/SharpGLTF.Tests/Schema2/LoadAndSave/LoadSampleTests.cs

@@ -11,6 +11,7 @@ namespace SharpGLTF.Schema2.LoadAndSave
     /// Test cases for models found in <see href="https://github.com/KhronosGroup/glTF-Sample-Models"/>
     /// Test cases for models found in <see href="https://github.com/KhronosGroup/glTF-Sample-Models"/>
     /// </summary>
     /// </summary>
     [TestFixture]
     [TestFixture]
+    [Category("Model Load and Save")]
     public class LoadSampleTests
     public class LoadSampleTests
     {
     {
         #region setup
         #region setup
@@ -29,7 +30,7 @@ namespace SharpGLTF.Schema2.LoadAndSave
         [TestCase("\\glTF-Binary\\")]
         [TestCase("\\glTF-Binary\\")]
         [TestCase("\\glTF-Embedded\\")]
         [TestCase("\\glTF-Embedded\\")]
         [TestCase("\\glTF-pbrSpecularGlossiness\\")]
         [TestCase("\\glTF-pbrSpecularGlossiness\\")]
-        public void TestLoadSampleModels(string section)
+        public void LoadSampleModels(string section)
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
@@ -57,7 +58,7 @@ namespace SharpGLTF.Schema2.LoadAndSave
                     CollectionAssert.AreEquivalent(model.ExtensionsUsed, detectedExtensions);
                     CollectionAssert.AreEquivalent(model.ExtensionsUsed, detectedExtensions);
                 }
                 }
                 
                 
-                // evaluate and save all the triangles to a Wavefront Object
+                // Save models
                 model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(f), ".obj"));
                 model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(f), ".obj"));
                 var perf_wavefront = perf.ElapsedMilliseconds;
                 var perf_wavefront = perf.ElapsedMilliseconds;
 
 
@@ -83,33 +84,31 @@ namespace SharpGLTF.Schema2.LoadAndSave
         }
         }
 
 
         [TestCase("SpecGlossVsMetalRough.gltf")]
         [TestCase("SpecGlossVsMetalRough.gltf")]
-        [TestCase(@"UnlitTest\glTF-Binary\UnlitTest.glb")]
-        public void TestLoadSpecialCaseModels(string filePath)
+        [TestCase(@"TextureTransformTest.gltf")]
+        [TestCase(@"UnlitTest\glTF-Binary\UnlitTest.glb")]        
+        public void LoadExtendedModels(string filePath)
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
             TestContext.CurrentContext.AttachGltfValidatorLink();
 
 
-            var f = TestFiles.GetSampleModelsPaths()
+            filePath = TestFiles
+                .GetSampleModelsPaths()
                 .FirstOrDefault(item => item.EndsWith(filePath));
                 .FirstOrDefault(item => item.EndsWith(filePath));
 
 
-            var model = ModelRoot.Load(f);
+            var model = ModelRoot.Load(filePath);
             Assert.NotNull(model);
             Assert.NotNull(model);
 
 
-            // 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"));
-            model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(f), ".gltf"));
-
-            // do a model roundtrip
-            var bytes = model.WriteGLB();
-            var modelBis = ModelRoot.ParseGLB(bytes);
+            // do a model clone and compare it
+            _AssertAreEqual(model, model.DeepClone());
 
 
-            // clone
-            var cloned = model.DeepClone();
+            // evaluate and save all the triangles to a Wavefront Object
+            model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(filePath), ".obj"));
+            model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(filePath), ".glb"));
+            model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(filePath), ".gltf"));
         }
         }
 
 
         [Test]
         [Test]
-        public void TestLoadUnlitModel()
+        public void LoadUnlitModel()
         {
         {
             var f = TestFiles.GetSampleModelsPaths()
             var f = TestFiles.GetSampleModelsPaths()
                 .FirstOrDefault(item => item.EndsWith(@"UnlitTest\glTF-Binary\UnlitTest.glb"));
                 .FirstOrDefault(item => item.EndsWith(@"UnlitTest\glTF-Binary\UnlitTest.glb"));
@@ -127,7 +126,7 @@ namespace SharpGLTF.Schema2.LoadAndSave
         }
         }
 
 
         [Test]
         [Test]
-        public void TestLoadLightsModel()
+        public void LoadLightsModel()
         {
         {
             var f = TestFiles.GetSchemaExtensionsModelsPaths()
             var f = TestFiles.GetSchemaExtensionsModelsPaths()
                 .FirstOrDefault(item => item.EndsWith("lights.gltf"));
                 .FirstOrDefault(item => item.EndsWith("lights.gltf"));
@@ -140,5 +139,22 @@ namespace SharpGLTF.Schema2.LoadAndSave
             Assert.AreEqual(1, model.DefaultScene.VisualChildren.ElementAt(0).PunctualLight.LogicalIndex);
             Assert.AreEqual(1, model.DefaultScene.VisualChildren.ElementAt(0).PunctualLight.LogicalIndex);
             Assert.AreEqual(0, model.DefaultScene.VisualChildren.ElementAt(1).PunctualLight.LogicalIndex);
             Assert.AreEqual(0, model.DefaultScene.VisualChildren.ElementAt(1).PunctualLight.LogicalIndex);
         }
         }
+
+        [Test]
+        public void LoadSparseModel()
+        {
+            var path = TestFiles.GetSampleModelsPaths().FirstOrDefault(item => item.Contains("SimpleSparseAccessor.gltf"));
+
+            var model = ModelRoot.Load(path);
+            Assert.NotNull(model);
+
+            var primitive = model.LogicalMeshes[0].Primitives[0];
+
+            var accessor = primitive.GetVertexAccessor("POSITION");
+
+            var basePositions = accessor._GetMemoryAccessor().AsVector3Array();
+
+            var positions = accessor.AsVector3Array();
+        }
     }
     }
 }
 }