From a3c492d54fb1d28744ebb0c06ab8dd5692407a24 Mon Sep 17 00:00:00 2001 From: soul Date: Thu, 19 Nov 2026 20:39:45 +0100 Subject: [PATCH] Pin that a compressed bufferView under an emitter's accessor is refused Co-Authored-By: Claude Sonnet 5.5 --- .../ShipEmitterExhaustTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/Aetheria.Shared.Tests/ShipEmitterExhaustTests.cs b/tests/Aetheria.Shared.Tests/ShipEmitterExhaustTests.cs index edb0ac8b2..e3af827dc 100644 --- a/tests/Aetheria.Shared.Tests/ShipEmitterExhaustTests.cs +++ b/tests/Aetheria.Shared.Tests/ShipEmitterExhaustTests.cs @@ -167,4 +167,22 @@ public sealed class ShipEmitterExhaustTests : IDisposable public void ASidewaysEmitterWhoseNormalIsPerpendicularToThePushIsRefused() => // Normal exactly +X, dot with the push exactly 0: the rule is non-negative, so it fires along the axis it is not meant to. Assert.False(Accepts(WriteCustom(new[] { 0f, 0f, 0f, 0f, 1f, 0f, 0f, 1f, 1f, 0f, 0f, 1f }, Quad))); + + [Theory] + [InlineData("KHR_draco_mesh_compression"), InlineData("EXT_meshopt_compression")] + public void AnAccessorWhoseBufferViewIsCompressedIsRefused(string extension) + { + // The compression sits on the bufferView, not the primitive: the accessor's bytes are not positions. + var path = WriteCustom(Plane(0), Quad); + var glb = Path.Combine(_directory.Path, "mod.skiff", "skiff.glb"); + var bytes = File.ReadAllBytes(glb); + var length = (int)BitConverter.ToUInt32(bytes, 12); + var json = JObject.Parse(System.Text.Encoding.UTF8.GetString(bytes, 20, length)); + var views = (JArray)json["bufferViews"]; + var positions = (int)json["accessors"][(int)json["meshes"].Last["primitives"][0]["attributes"]["POSITION"]]["bufferView"]; + views[positions]["extensions"] = JObject.Parse("{\"" + extension + "\":{}}"); + var bin = bytes.Skip(28 + length).ToArray(); + File.WriteAllBytes(glb, ShipFixture.Glb(json.ToString(Newtonsoft.Json.Formatting.None), bin)); + Assert.Contains("compressed by " + extension, Assert.Throws(() => ShipModCatalog.ReadPackage(path)).Message); + } }