mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-13 22:39:39 -05:00
Test の Dispose が足りないところを修正
This commit is contained in:
@@ -137,30 +137,32 @@ namespace UniGLTF
|
||||
: MeshExporter_SharedVertexBuffer.Export(data, unityMesh, Materials, axisInverter, meshExportSettings)
|
||||
;
|
||||
|
||||
var parsed = GltfData.CreateFromGltfDataForTest(data.GLTF, data.BinBytes);
|
||||
|
||||
using (var parsed = GltfData.CreateFromGltfDataForTest(data.GLTF, data.BinBytes))
|
||||
{
|
||||
var indices = parsed.GetIndices(gltfMesh.primitives[0].indices);
|
||||
Assert.AreEqual(0, indices[0]);
|
||||
Assert.AreEqual(1, indices[1]);
|
||||
Assert.AreEqual(5, indices[2]);
|
||||
Assert.AreEqual(5, indices[3]);
|
||||
Assert.AreEqual(1, indices[4]);
|
||||
Assert.AreEqual(4, indices[5]);
|
||||
}
|
||||
|
||||
{
|
||||
var indices = parsed.GetIndices(gltfMesh.primitives[1].indices);
|
||||
Assert.AreEqual(1, indices[0]);
|
||||
Assert.AreEqual(2, indices[1]);
|
||||
Assert.AreEqual(4, indices[2]);
|
||||
Assert.AreEqual(4, indices[3]);
|
||||
Assert.AreEqual(2, indices[4]);
|
||||
Assert.AreEqual(3, indices[5]);
|
||||
}
|
||||
{
|
||||
var indices = parsed.GetIndices(gltfMesh.primitives[0].indices);
|
||||
Assert.AreEqual(0, indices[0]);
|
||||
Assert.AreEqual(1, indices[1]);
|
||||
Assert.AreEqual(5, indices[2]);
|
||||
Assert.AreEqual(5, indices[3]);
|
||||
Assert.AreEqual(1, indices[4]);
|
||||
Assert.AreEqual(4, indices[5]);
|
||||
}
|
||||
|
||||
var positions = parsed.GetArrayFromAccessor<Vector3>(gltfMesh.primitives[0].attributes.POSITION);
|
||||
Assert.AreEqual(6, positions.Length);
|
||||
{
|
||||
var indices = parsed.GetIndices(gltfMesh.primitives[1].indices);
|
||||
Assert.AreEqual(1, indices[0]);
|
||||
Assert.AreEqual(2, indices[1]);
|
||||
Assert.AreEqual(4, indices[2]);
|
||||
Assert.AreEqual(4, indices[3]);
|
||||
Assert.AreEqual(2, indices[4]);
|
||||
Assert.AreEqual(3, indices[5]);
|
||||
}
|
||||
|
||||
var positions = parsed.GetArrayFromAccessor<Vector3>(gltfMesh.primitives[0].attributes.POSITION);
|
||||
Assert.AreEqual(6, positions.Length);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -88,10 +88,7 @@ namespace UniGLTF
|
||||
return;
|
||||
}
|
||||
|
||||
// parse
|
||||
var data = new GlbFileParser(path.FullName).Parse();
|
||||
|
||||
// load
|
||||
using (var data = new GlbFileParser(path.FullName).Parse())
|
||||
using (var context = new ImporterContext(data))
|
||||
{
|
||||
var instance = context.Load();
|
||||
|
||||
@@ -115,9 +115,7 @@ namespace UniGLTF
|
||||
}
|
||||
|
||||
// parse
|
||||
var parsed = GltfData.CreateFromExportForTest(data);
|
||||
|
||||
// import
|
||||
using (var parsed = GltfData.CreateFromExportForTest(data))
|
||||
using (var context = new ImporterContext(parsed))
|
||||
using (var loaded = context.Load())
|
||||
{
|
||||
|
||||
@@ -21,13 +21,15 @@ namespace VRM
|
||||
|
||||
static GameObject Load(byte[] bytes, string path)
|
||||
{
|
||||
var gltf = new GlbLowLevelParser(path, bytes).Parse();
|
||||
var data = new VRMData(gltf);
|
||||
using (var loader = new VRMImporterContext(data))
|
||||
using (var gltf = new GlbLowLevelParser(path, bytes).Parse())
|
||||
{
|
||||
var loaded = loader.Load();
|
||||
loaded.ShowMeshes();
|
||||
return loaded.gameObject;
|
||||
var data = new VRMData(gltf);
|
||||
using (var loader = new VRMImporterContext(data))
|
||||
{
|
||||
var loaded = loader.Load();
|
||||
loaded.ShowMeshes();
|
||||
return loaded.gameObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,14 +40,16 @@ namespace UniVRM10.Test
|
||||
Debug.Log($"load: {path}");
|
||||
|
||||
Assert.IsTrue(Vrm10Data.TryParseOrMigrate(path, true, out Vrm10Data result));
|
||||
using (result)
|
||||
{
|
||||
var go = BuildGameObject(result, true);
|
||||
Debug.Log(go);
|
||||
|
||||
var go = BuildGameObject(result, true);
|
||||
Debug.Log(go);
|
||||
// export
|
||||
var vrmBytes = Vrm10Exporter.Export(go, new EditorTextureSerializer());
|
||||
|
||||
// export
|
||||
var vrmBytes = Vrm10Exporter.Export(go, new EditorTextureSerializer());
|
||||
|
||||
Debug.Log($"export {vrmBytes.Length} bytes");
|
||||
Debug.Log($"export {vrmBytes.Length} bytes");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace UniVRM10
|
||||
{
|
||||
try
|
||||
{
|
||||
Vrm10Data.TryParseOrMigrate(gltf.FullName, true, out Vrm10Data vrm);
|
||||
Assert.True(Vrm10Data.TryParseOrMigrate(gltf.FullName, true, out Vrm10Data vrm));
|
||||
using (vrm)
|
||||
using (var loader = new Vrm10Importer(vrm))
|
||||
{
|
||||
@@ -263,6 +263,7 @@ namespace UniVRM10
|
||||
public void MigrateMeta()
|
||||
{
|
||||
Assert.True(Vrm10Data.TryParseOrMigrate(AliciaPath, true, out Vrm10Data vrm));
|
||||
vrm.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user