Browse Source

DebugTools: supply two different materials to the "same" test.

Otherwise the code could also just return true only if the instances are
the exact same location in memory, which is definitely undesired.
pull/610/head
Vladimír Vondruš 4 years ago
parent
commit
037952a979
  1. 48
      src/Magnum/DebugTools/Test/CompareMaterialTest.cpp

48
src/Magnum/DebugTools/Test/CompareMaterialTest.cpp

@ -47,21 +47,39 @@ using namespace Math::Literals;
const struct {
const char* name;
Trade::MaterialData material;
Trade::MaterialData actual;
Trade::MaterialData expected;
} SameData[]{
{"empty", Trade::MaterialData{{}, {}}},
{"empty with types", Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness|Trade::MaterialType::PbrClearCoat, {}}},
{"base attributes", Trade::MaterialData{Trade::MaterialType::Phong, {
{Trade::MaterialAttribute::DiffuseColor, 0x556699aa_rgbaf},
{Trade::MaterialAttribute::NormalTexture, 5u},
{"name", "hello"_s},
}}},
{"layers", Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness|Trade::MaterialType::PbrClearCoat, {
{Trade::MaterialAttribute::NormalTexture, 5u},
{Trade::MaterialLayer::ClearCoat},
{Trade::MaterialAttribute::LayerFactor, 0.76f},
{"name", "hello"_s},
}, {1, 3, 4}}},
{"empty",
Trade::MaterialData{{}, {}},
Trade::MaterialData{{}, {}}},
{"empty with types",
Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness|Trade::MaterialType::PbrClearCoat, {}},
Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness|Trade::MaterialType::PbrClearCoat, {}}},
{"base attributes",
Trade::MaterialData{Trade::MaterialType::Phong, {
{Trade::MaterialAttribute::DiffuseColor, 0x556699aa_rgbaf},
{Trade::MaterialAttribute::NormalTexture, 5u},
{"name", "hello"_s},
}},
Trade::MaterialData{Trade::MaterialType::Phong, {
{"name", "hello"_s},
{Trade::MaterialAttribute::DiffuseColor, 0x556699aa_rgbaf},
{Trade::MaterialAttribute::NormalTexture, 5u},
}}},
{"layers",
Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness|Trade::MaterialType::PbrClearCoat, {
{Trade::MaterialAttribute::NormalTexture, 5u},
{Trade::MaterialLayer::ClearCoat},
{Trade::MaterialAttribute::LayerFactor, 0.76f},
{"name", "hello"_s},
}, {1, 3, 4}},
Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness|Trade::MaterialType::PbrClearCoat, {
{Trade::MaterialAttribute::NormalTexture, 5u},
{Trade::MaterialAttribute::LayerFactor, 0.76f},
{Trade::MaterialLayer::ClearCoat},
{"name", "hello"_s},
}, {1, 3, 4}}},
};
const struct {
@ -271,7 +289,7 @@ void CompareMaterialTest::same() {
auto&& data = SameData[testCaseInstanceId()];
setTestCaseDescription(data.name);
CORRADE_COMPARE_AS(data.material, data.material, CompareMaterial);
CORRADE_COMPARE_AS(data.actual, data.expected, CompareMaterial);
}
void CompareMaterialTest::different() {

Loading…
Cancel
Save