tests/model: comments: specs only
This commit is contained in:
1 parent
5f7f6005f6
commit
fe7566cbba
37 files changed
+72
-440
No files matched your search
+2
-13
@@ -1,9 +1,5 @@
|
||||
-- model/gltf tests: Khronos glTF-Sample-Assets models (JSON with external / embedded buffers, GLB, sparse, interleaved,
|
||||
-- quantized, morph targets, skins, animations, cameras, lights, texture transforms, material extensions), gltfpack
|
||||
-- quantized variants and assimp's exporter output, against assimp (meshes, faces, bounds, animations, cameras,
|
||||
-- lights) and trimesh (area, triangles); full-structure round trips through GLB, embedded .gltf and external files;
|
||||
-- assimp / trimesh reading our output (gltf_xcheck); textures decoded lazily at the api layer; errors; the fuzz
|
||||
-- no-throw pass. Fixtures: tools/fixtures/gltf.py.
|
||||
-- model/gltf tests: glTF-Sample-Assets, gltfpack and assimp output against assimp and trimesh; round trips.
|
||||
-- Fixtures: tools/fixtures/gltf.py.
|
||||
local T = require("@tests/T")
|
||||
local F = require("@rosetta")
|
||||
local Gltf = require("@rosetta/model/gltf")
|
||||
@@ -76,7 +72,6 @@ local function counts(scene: any): (number, number)
|
||||
return prims, faces
|
||||
end
|
||||
|
||||
-- every value of two scenes equal (buffers by content), meta skipped
|
||||
local function same(a: any, b: any, path: string, seen: { [any]: boolean }?, skip: { [string]: boolean }?): (boolean, string?)
|
||||
local s = seen or {}
|
||||
local sk = skip or { meta = true, extras = true }
|
||||
@@ -154,7 +149,6 @@ for i, c in Cases do
|
||||
end
|
||||
checked.trimesh += 1
|
||||
end
|
||||
-- round trips: GLB, embedded .gltf, external files
|
||||
local glb, gerr = Gltf.encode(scene, { binary = true })
|
||||
t:check(glb, c.name .. ": encode glb: " .. tostring(gerr))
|
||||
local back = decode(glb)
|
||||
@@ -179,7 +173,6 @@ for i, c in Cases do
|
||||
end
|
||||
t:note("%d files: %d against assimp, %d against trimesh, %d round trips", #Cases, checked.assimp, checked.trimesh, checked.roundTrips)
|
||||
|
||||
-- the reference tools read our files like the originals
|
||||
local nx = 0
|
||||
for _, x in Xcheck do
|
||||
local c = Cases[x.case]
|
||||
@@ -202,7 +195,6 @@ for _, x in Xcheck do
|
||||
end
|
||||
t:note("%d of our files read back by assimp / trimesh like the originals", nx)
|
||||
|
||||
-- details
|
||||
do
|
||||
local function load(name: string): any
|
||||
local c = byName[name]
|
||||
@@ -298,7 +290,6 @@ do
|
||||
local out = Gltf.encode(s2, { binary = true }) :: buffer
|
||||
local back = decode(out)
|
||||
t:check(back and back.meshes[1].primitives[1].indices.count == 6 and back.meshes[1].primitives[1].attributes.COLOR_0.type == "unorm8", "polygons fan-triangulated, unorm8 VEC3 colours (padded stride)")
|
||||
-- through the api: the destination's extension picks GLB
|
||||
local viaApi = F.save(s2, nil, { format = "glb" })
|
||||
t:check(viaApi and buffer.readstring(viaApi, 0, 4) == "glTF", "F.save format glb")
|
||||
local viaApi2 = F.save(s2, nil, { format = "gltf" })
|
||||
@@ -307,7 +298,6 @@ do
|
||||
t:check(loaded and loaded.kind == "scene" and loaded.meta.source.format == "gltf", "F.load detects GLB")
|
||||
end
|
||||
|
||||
-- errors
|
||||
do
|
||||
local _, e = decode("{ not json")
|
||||
t:check(e and (e.code == Err.CORRUPT or e.code == Err.TRUNCATED), "bad JSON: " .. tostring(e))
|
||||
@@ -330,7 +320,6 @@ do
|
||||
t:check(e8 and e8.code == Err.ARG, "encode a short accessor: " .. tostring(e8))
|
||||
end
|
||||
|
||||
-- fuzz
|
||||
do
|
||||
local samples = {}
|
||||
for _, c in Cases do
|
||||
|
||||
Reference in new issue
Block a user