From 500b59d2aee5b36211bec9145ade3f2550367a32 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 16 Dec 2021 18:45:16 +0900 Subject: [PATCH] =?UTF-8?q?Test=20=E8=BF=BD=E5=8A=A0=E3=80=82Empty=5Fexten?= =?UTF-8?q?sionUsed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runtime/UniGLTF/IO/GltfJsonUtil.cs | 1 - .../Tests/UniGLTF/GltfJsonUtilTests.cs | 39 ++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfJsonUtil.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfJsonUtil.cs index eecdc8a86..d3bc1696c 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfJsonUtil.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfJsonUtil.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using System.Text.RegularExpressions; using UniJSON; using UnityEngine; diff --git a/Assets/UniGLTF/Tests/UniGLTF/GltfJsonUtilTests.cs b/Assets/UniGLTF/Tests/UniGLTF/GltfJsonUtilTests.cs index 9c58fd5d0..547c32d56 100644 --- a/Assets/UniGLTF/Tests/UniGLTF/GltfJsonUtilTests.cs +++ b/Assets/UniGLTF/Tests/UniGLTF/GltfJsonUtilTests.cs @@ -88,5 +88,42 @@ namespace UniGLTF Assert.AreEqual(new string[] { "KHR_materials_unlit" }, parsed["extensionUsed"].ArrayItems().Select(x => x.GetString()).ToArray()); } + + [Test] + public void Empty_extensionUsed() + { + var dst = GltfJsonUtil.FindUsedExtensionsAndUpdateJson(@"{ + ""asset"": { + ""generator"": ""COLLADA2GLTF"", + ""version"": ""2.0"" + }, + ""scene"": 0, + ""scenes"": [ + { + ""nodes"": [ + 0 + ] } -} \ No newline at end of file + ], + ""extensionUsed"": [""dummy""], + ""materials"": [ + { + ""pbrMetallicRoughness"": { + ""baseColorFactor"": [ + 0.800000011920929, + 0.0, + 0.0, + 1.0 + ], + ""metallicFactor"": 0.0 + }, + ""name"": ""Red"" + } + ] +}"); + + var parsed = dst.ParseAsJson(); + Assert.False(parsed.ContainsKey("extensionUsed")); + } + } +}