0031382: Data Exchange - BinXCAF should preserve length unit information
[occt.git] / tests / de_mesh / gltf_write / helmet
index a2e9f91..39d9854 100644 (file)
@@ -4,7 +4,11 @@ puts "Test case exporting glTF model into glTF file."
 puts "========"
 
 Close D1 -silent
-ReadGltf D1 [locate_data_file bug30691_DamagedHelmet.gltf]
+XNewDoc D1
+XSetLengthUnit D1 cm
+ReadGltf D1 [locate_data_file bug30691_DamagedHelmet.gltf] -nocreatedoc
+XGetOneShape s1 D1
+set aLProps1 [uplevel #0 sprops $s1]
 
 set aTmpGltfBase "${imagedir}/${casename}_tmp"
 set aTmpGltf "${aTmpGltfBase}.gltf"
@@ -14,7 +18,17 @@ lappend occ_tmp_files "${aTmpGltfBase}_textures"
 
 WriteGltf D1 "$aTmpGltf"
 
-ReadGltf D "$aTmpGltf"
+Close D -silent
+XNewDoc D
+XSetLengthUnit D cm
+ReadGltf D "$aTmpGltf" -nocreatedoc
+
 XGetOneShape s D
+set aLProps2 [uplevel #0 sprops $s]
 checknbshapes s -face 1 -compound 0
 checktrinfo s -tri 15452 -nod 14556
+regexp {Mass\s:\s*([0-9\.]+)} $aLProps1 dummy anArea1
+regexp {Mass\s:\s*([0-9\.]+)} $aLProps2 dummy anArea2
+if {abs($anArea1 - $anArea2) > 1e-8 * $anArea1} {
+  puts "Error: invalid area $anArea1 instead of $anArea2"
+}