|
|
|
|
@ -33,7 +33,7 @@ class BbmodelCodecSecurityTest {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void roundTripEmptyModel() {
|
|
|
|
|
Bbmodel original = new Bbmodel(64, 64, List.of(), List.of(), List.of(), List.of());
|
|
|
|
|
Bbmodel original = new Bbmodel(64, 64, false, List.of(), List.of(), List.of(), List.of());
|
|
|
|
|
Bbmodel decoded = roundTrip(original);
|
|
|
|
|
assertEquals(64, decoded.resolutionWidth());
|
|
|
|
|
assertEquals(64, decoded.resolutionHeight());
|
|
|
|
|
@ -47,9 +47,10 @@ class BbmodelCodecSecurityTest {
|
|
|
|
|
new Vector3f(0, 0, 0), new Vector3f(1, 1, 1),
|
|
|
|
|
0f,
|
|
|
|
|
new Vector3f(0, 0, 0), new Vector3f(0, 0, 0),
|
|
|
|
|
Map.of()
|
|
|
|
|
Map.of(),
|
|
|
|
|
null, false, null
|
|
|
|
|
);
|
|
|
|
|
Bbmodel original = new Bbmodel(64, 64,
|
|
|
|
|
Bbmodel original = new Bbmodel(64, 64, false,
|
|
|
|
|
List.of(cube), List.of(), List.of(),
|
|
|
|
|
List.of(new BbOutlinerNode.ElementRef("uuid-1")));
|
|
|
|
|
Bbmodel decoded = roundTrip(original);
|
|
|
|
|
@ -63,12 +64,13 @@ class BbmodelCodecSecurityTest {
|
|
|
|
|
new Vector3f(0, 0, 0), new Vector3f(1, 1, 1),
|
|
|
|
|
0f,
|
|
|
|
|
new Vector3f(0, 0, 0), new Vector3f(0, 0, 0),
|
|
|
|
|
Map.of());
|
|
|
|
|
Map.of(),
|
|
|
|
|
null, false, null);
|
|
|
|
|
BbLocator loc = new BbLocator("l", "loc",
|
|
|
|
|
new Vector3f(1, 2, 3), new Vector3f(0, 0, 0));
|
|
|
|
|
BbGroup grp = new BbGroup("g", "group",
|
|
|
|
|
new Vector3f(0, 0, 0), new Vector3f(0, 0, 0));
|
|
|
|
|
Bbmodel original = new Bbmodel(64, 64,
|
|
|
|
|
Bbmodel original = new Bbmodel(64, 64, false,
|
|
|
|
|
List.of(cube), List.of(loc), List.of(grp),
|
|
|
|
|
List.of(new BbOutlinerNode.GroupRef("g", List.of(
|
|
|
|
|
new BbOutlinerNode.ElementRef("c"),
|
|
|
|
|
@ -121,7 +123,7 @@ class BbmodelCodecSecurityTest {
|
|
|
|
|
// A valid decode is followed by extra bytes — callers MUST verify
|
|
|
|
|
// readableBytes() == 0 after decode (we do so in SharedCosmeticCache/uploader).
|
|
|
|
|
// Codec itself doesn't enforce that; this test documents the contract.
|
|
|
|
|
Bbmodel original = new Bbmodel(64, 64, List.of(), List.of(), List.of(), List.of());
|
|
|
|
|
Bbmodel original = new Bbmodel(64, 64, false, List.of(), List.of(), List.of(), List.of());
|
|
|
|
|
ByteBuf buf = Unpooled.buffer();
|
|
|
|
|
try {
|
|
|
|
|
BbmodelCodec.CODEC.encode(buf, original);
|
|
|
|
|
@ -149,14 +151,16 @@ class BbmodelCodecSecurityTest {
|
|
|
|
|
BbCube cubeA = new BbCube("u", "n",
|
|
|
|
|
new Vector3f(0, 0, 0), new Vector3f(1, 1, 1),
|
|
|
|
|
0f,
|
|
|
|
|
new Vector3f(0, 0, 0), new Vector3f(0, 0, 0), a);
|
|
|
|
|
new Vector3f(0, 0, 0), new Vector3f(0, 0, 0), a,
|
|
|
|
|
null, false, null);
|
|
|
|
|
BbCube cubeB = new BbCube("u", "n",
|
|
|
|
|
new Vector3f(0, 0, 0), new Vector3f(1, 1, 1),
|
|
|
|
|
0f,
|
|
|
|
|
new Vector3f(0, 0, 0), new Vector3f(0, 0, 0), b);
|
|
|
|
|
Bbmodel modelA = new Bbmodel(64, 64, List.of(cubeA), List.of(), List.of(),
|
|
|
|
|
new Vector3f(0, 0, 0), new Vector3f(0, 0, 0), b,
|
|
|
|
|
null, false, null);
|
|
|
|
|
Bbmodel modelA = new Bbmodel(64, 64, false, List.of(cubeA), List.of(), List.of(),
|
|
|
|
|
List.of(new BbOutlinerNode.ElementRef("u")));
|
|
|
|
|
Bbmodel modelB = new Bbmodel(64, 64, List.of(cubeB), List.of(), List.of(),
|
|
|
|
|
Bbmodel modelB = new Bbmodel(64, 64, false, List.of(cubeB), List.of(), List.of(),
|
|
|
|
|
List.of(new BbOutlinerNode.ElementRef("u")));
|
|
|
|
|
|
|
|
|
|
assertArrayEquals(encode(modelA), encode(modelB),
|
|
|
|
|
|