@@ -413,13 +413,32 @@ def dut(data):
413
413
self .assertNotEqual (gltf_hash_2 , empty_hash )
414
414
self .assertNotEqual (gltf_hash_2 , gltf_hash_1 )
415
415
416
- # Valid glTF file reference an external image.
416
+ # Valid glTF file references an external image.
417
417
with open (gltf_filename , "w" ) as f :
418
418
f .write (json .dumps ({"images" : [{"uri" : str (png_filename )}]}))
419
419
gltf_hash_3 = dut (message )
420
420
self .assertNotEqual (gltf_hash_3 , empty_hash )
421
421
self .assertNotEqual (gltf_hash_3 , gltf_hash_2 )
422
422
423
+ # Valid glTF file references an inline image.
424
+ with open (gltf_filename , "w" ) as f :
425
+ data_uri = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD"
426
+ f .write (json .dumps ({"images" : [{"uri" : data_uri }]}))
427
+ gltf_hash_4 = dut (message )
428
+ self .assertNotEqual (gltf_hash_4 , empty_hash )
429
+ self .assertNotEqual (gltf_hash_4 , gltf_hash_3 )
430
+
431
+ # Valid(ish) glTF file references a buffer image.
432
+ with open (gltf_filename , "w" ) as f :
433
+ f .write (json .dumps ({
434
+ "buffers" : [{"byteLength" : 0 }],
435
+ "bufferViews" : [{"buffer" : 0 , "byteLength" : 0 }],
436
+ "images" : [{"bufferView" : 0 , "mimeType" : "image/png" }],
437
+ }))
438
+ gltf_hash_5 = dut (message )
439
+ self .assertNotEqual (gltf_hash_5 , empty_hash )
440
+ self .assertNotEqual (gltf_hash_5 , gltf_hash_4 )
441
+
423
442
# Now finally, the glTF file has a .bin. This time, as a cross-check,
424
443
# inspect the filenames that were hashed instead of the hash itself.
425
444
bin_filename = test_tmpdir / "mesh_checksum_test.bin"
0 commit comments