Browse Source

Fixed exception with curve conversion

Vicente Penades 4 years ago
parent
commit
0d38407fe5

+ 0 - 1
src/SharpGLTF.Toolkit/Animations/CurveBuilder.cs

@@ -362,7 +362,6 @@ namespace SharpGLTF.Animations
 
 
         IReadOnlyDictionary<float, T> IConvertibleCurve<T>.ToLinearCurve()
         IReadOnlyDictionary<float, T> IConvertibleCurve<T>.ToLinearCurve()
         {
         {
-            if (MaxDegree != 1) throw new NotSupportedException();
             if (_Keys.Count == 0) return new Dictionary<float, T>();
             if (_Keys.Count == 0) return new Dictionary<float, T>();
 
 
             if (_Keys.All(item => item.Value.Degree == 1))
             if (_Keys.All(item => item.Value.Degree == 1))

+ 2 - 0
tests/SharpGLTF.NUnit/Plotting.cs

@@ -240,6 +240,8 @@ namespace SharpGLTF
     {
     {
         public static void AttachToCurrentTest(this Plotting.Point2Series points, string fileName)
         public static void AttachToCurrentTest(this Plotting.Point2Series points, string fileName)
         {
         {
+            System.Diagnostics.Debug.Assert(fileName.ToLower().EndsWith(".html"));
+
             fileName = NUnit.Framework.TestContext.CurrentContext.GetAttachmentPath(fileName);
             fileName = NUnit.Framework.TestContext.CurrentContext.GetAttachmentPath(fileName);
 
 
             points.DrawToFile(fileName);
             points.DrawToFile(fileName);

+ 3 - 3
tests/SharpGLTF.Toolkit.Tests/Animation/CurveBuilderTests.cs

@@ -57,7 +57,7 @@ namespace SharpGLTF.Animations
                 .Select(kvp => new Vector2(kvp.Value.X, kvp.Value.Y))
                 .Select(kvp => new Vector2(kvp.Value.X, kvp.Value.Y))
                 .ToPointSeries()
                 .ToPointSeries()
                 .WithLineType(Plotting.LineType.Continuous)
                 .WithLineType(Plotting.LineType.Continuous)
-                .AttachToCurrentTest("plot.png");
+                .AttachToCurrentTest("plot.html");
         }
         }
 
 
         [Test]
         [Test]
@@ -106,7 +106,7 @@ namespace SharpGLTF.Animations
                 .Select(kvp => new Vector2(kvp.Key, kvp.Value.W))
                 .Select(kvp => new Vector2(kvp.Key, kvp.Value.W))
                 .ToPointSeries()
                 .ToPointSeries()
                 .WithLineType(Plotting.LineType.Continuous)
                 .WithLineType(Plotting.LineType.Continuous)
-                .AttachToCurrentTest("plot.png");
+                .AttachToCurrentTest("plot.html");
         }
         }
 
 
         [Test]
         [Test]
@@ -160,7 +160,7 @@ namespace SharpGLTF.Animations
                 .Select(kvp => new Vector2(kvp.Value[0], kvp.Value[1]))
                 .Select(kvp => new Vector2(kvp.Value[0], kvp.Value[1]))
                 .ToPointSeries()
                 .ToPointSeries()
                 .WithLineType(Plotting.LineType.Continuous)
                 .WithLineType(Plotting.LineType.Continuous)
-                .AttachToCurrentTest("plot.png");
+                .AttachToCurrentTest("plot.html");
         }
         }
     }
     }