From c499e6f1ecae55d9655552e5de8bde59909a8e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 9 Nov 2022 23:35:40 +0100 Subject: [PATCH] DebugTools: test CompareMaterial with an empty base layer. Asserts because some of the checks weren't properly passing the layer ID. Sigh. --- .../DebugTools/Test/CompareMaterialTest.cpp | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/Magnum/DebugTools/Test/CompareMaterialTest.cpp b/src/Magnum/DebugTools/Test/CompareMaterialTest.cpp index 70276412f..680035d7d 100644 --- a/src/Magnum/DebugTools/Test/CompareMaterialTest.cpp +++ b/src/Magnum/DebugTools/Test/CompareMaterialTest.cpp @@ -160,6 +160,40 @@ const struct { " + NormalTextureLayer @ UnsignedInt: 2\n" " - NormalTextureScale @ Float: 0.5\n" " - OcclusionTexture @ UnsignedInt: 3\n"}, + {"different attributes, empty base layer", + /* Same as above, except everything is in the second layer to verify + we're not accidentally checking just the first layer */ + Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness, { + {Trade::MaterialAttribute::DoubleSided, true}, + {Trade::MaterialAttribute::NormalTexture, 5u}, + {Trade::MaterialAttribute::NormalTextureScale, 0.5f}, + {Trade::MaterialAttribute::OcclusionTexture, 3u}, + }, {0, 4}}, + Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness, { + {Trade::MaterialAttribute::Metalness, 5.5f}, + {Trade::MaterialAttribute::NormalTexture, 5u}, + {Trade::MaterialAttribute::NormalTextureLayer, 2u}, + }, {0, 3}}, + "Materials a and b have different attributes. Actual (+) vs expected (-):\n" + " Types: PbrMetallicRoughness\n" + " Base layer:\n" + " Layer 1:\n" + " + DoubleSided @ Bool: true\n" + " - Metalness @ Float: 5.5\n" + " NormalTexture @ UnsignedInt: 5\n" + " - NormalTextureLayer @ UnsignedInt: 2\n" + " + NormalTextureScale @ Float: 0.5\n" + " + OcclusionTexture @ UnsignedInt: 3\n", + "Materials b and a have different attributes. Actual (+) vs expected (-):\n" + " Types: PbrMetallicRoughness\n" + " Base layer:\n" + " Layer 1:\n" + " - DoubleSided @ Bool: true\n" + " + Metalness @ Float: 5.5\n" + " NormalTexture @ UnsignedInt: 5\n" + " + NormalTextureLayer @ UnsignedInt: 2\n" + " - NormalTextureScale @ Float: 0.5\n" + " - OcclusionTexture @ UnsignedInt: 3\n"}, {"different attribute types", Trade::MaterialData{{}, { {"pointer", reinterpret_cast(0xdead)},