Add test for solids test file.

This commit is contained in:
kovacsv 2021-11-13 09:18:16 +01:00
parent c504d74b5d
commit 543324851f
2 changed files with 50 additions and 6 deletions

View File

@ -25,23 +25,23 @@
"materials" : [
{
"name" : "Red",
"color" : [204, 51, 51]
"color" : [194, 41, 41]
},
{
"name" : "Green",
"color" : [39, 155, 97]
"color" : [29, 145, 87]
},
{
"name" : "Blue",
"color" : [0, 138, 184]
"color" : [0, 128, 174]
},
{
"name" : "Orange",
"color" : [255, 204, 51]
"name" : "Yellow",
"color" : [245, 194, 41]
},
{
"name" : "Purple",
"color" : [204, 102, 153]
"color" : [194, 92, 143]
}
],
"meshes" : [

View File

@ -37,4 +37,48 @@ describe ('O3dv Importer', function () {
done ();
});
});
it ('solids.o3dv', function (done) {
testFiles.ImportO3dvFile ('solids.o3dv', function (model) {
assert (OV.CheckModel (model));
assert.deepStrictEqual (testUtils.ModelNodesToTree (model), {
name : '<Root>',
childNodes : [
{
name : 'Tetrahedral',
childNodes : [],
meshNames : ['Tetrahedron']
},
{
name : 'Octahedral',
childNodes : [],
meshNames : ['Hexahedron', 'Octahedron']
}, {
name : 'Icosahedral',
childNodes : [],
meshNames : ['Dodecahedron', 'Icosahedron']
}
],
meshNames : []
});
assert.strictEqual (model.MaterialCount (), 5);
assert.strictEqual (model.MeshCount (), 5);
assert.strictEqual (model.MeshInstanceCount (), 5);
assert (OV.IsEqual (OV.CalculateVolume (model), 8.707448863695035));
assert (OV.IsEqual (OV.CalculateSurfaceArea (model), 39.636169009449105));
assert.strictEqual (model.PropertyGroupCount (), 1);
assert.strictEqual (model.GetPropertyGroup (0).PropertyCount (), 2);
for (let i = 0; i < model.MeshCount (); i++) {
let mesh = model.GetMesh (i);
assert.strictEqual (mesh.PropertyGroupCount (), 1);
assert.strictEqual (mesh.GetPropertyGroup (0).PropertyCount (), 5);
}
done ();
});
});
});