Browse Source

TextureTools: properly test AtlasLandfill array recursion failure.

It only verified the case where there are no more slices, but not when
the recursed function fails because there are no more slices. Now it
does.
pull/651/merge
Vladimír Vondruš 1 year ago
parent
commit
490c7b0075
  1. 24
      src/Magnum/TextureTools/Test/AtlasTest.cpp

24
src/Magnum/TextureTools/Test/AtlasTest.cpp

@ -1004,15 +1004,23 @@ void AtlasTest::landfillArrayPadded() {
}
void AtlasTest::landfillArrayNoFit() {
/* Same as landfillArray(portrait, widest first) (which is the default
flags) which fits into {11, 6, 2} but limiting depth to 1 */
AtlasLandfill atlas{{11, 6, 1}};
/* It should fail in the second slice, not first, to test also that the
recursion failure is propagated */
{
AtlasLandfill atlas{{6, 6, 2}};
Vector3i offsets[Containers::arraySize(LandfillArraySizes)];
UnsignedByte rotationData[2];
Containers::MutableBitArrayView rotations{rotationData, 0, Containers::arraySize(LandfillArraySizes)};
CORRADE_VERIFY(!atlas.add(LandfillArraySizes, offsets, rotations));
Vector3i offsets[Containers::arraySize(LandfillArraySizes)];
UnsignedByte rotationData[2];
Containers::MutableBitArrayView rotations{rotationData, 0, Containers::arraySize(LandfillArraySizes)};
CORRADE_VERIFY(!atlas.add(LandfillArraySizes, offsets, rotations));
/* Sanity check that with one more slice it works */
} {
AtlasLandfill atlas{{6, 6, 3}};
Vector3i offsets[Containers::arraySize(LandfillArraySizes)];
UnsignedByte rotationData[2];
Containers::MutableBitArrayView rotations{rotationData, 0, Containers::arraySize(LandfillArraySizes)};
CORRADE_VERIFY(atlas.add(LandfillArraySizes, offsets, rotations));
}
}
void AtlasTest::landfillInvalidSize() {

Loading…
Cancel
Save