From e8101a424599c9544619db033737b58174b2e4e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 4 Mar 2025 16:17:56 +0100 Subject: [PATCH] MeshTools: make interleavedData() test order match call order. --- src/Magnum/MeshTools/Test/InterleaveTest.cpp | 68 ++++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/Magnum/MeshTools/Test/InterleaveTest.cpp b/src/Magnum/MeshTools/Test/InterleaveTest.cpp index 9f10b60e2..b9cb5e855 100644 --- a/src/Magnum/MeshTools/Test/InterleaveTest.cpp +++ b/src/Magnum/MeshTools/Test/InterleaveTest.cpp @@ -518,40 +518,6 @@ void InterleaveTest::interleavedDataArrayAttributes() { CORRADE_COMPARE(interleaved.stride()[1], 1); } -void InterleaveTest::interleavedDataZeroStride() { - Containers::Array vertexData{100 + 20}; - Containers::StridedArrayView1D positions{vertexData, - reinterpret_cast(vertexData.data() + 100), 3, 0}; - Containers::StridedArrayView1D normals{vertexData, - reinterpret_cast(vertexData.data() + 100 + 8), 3, 0}; - - Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), { - Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions}, - Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals} - }}; - - /* Technically they *are*, but it causes way too many problems especially - when used within interleavedLayout() etc. May tackle properly later. */ - CORRADE_VERIFY(!MeshTools::isInterleaved(data)); -} - -void InterleaveTest::interleavedDataNegativeStride() { - Containers::Array vertexData{100 + 3*20}; - Containers::StridedArrayView1D positions{vertexData, - reinterpret_cast(vertexData.data() + 100), 3, 20}; - Containers::StridedArrayView1D normals{vertexData, - reinterpret_cast(vertexData.data() + 100 + 8), 3, 20}; - - Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), { - Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions.flipped<0>()}, - Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals.flipped<0>()} - }}; - - /* Technically they *are*, but it causes way too many problems especially - when used within interleavedLayout() etc. May tackle properly later. */ - CORRADE_VERIFY(!MeshTools::isInterleaved(data)); -} - void InterleaveTest::interleavedDataEmpty() { Trade::MeshData data{MeshPrimitive::Triangles, 5}; CORRADE_VERIFY(MeshTools::isInterleaved(data)); @@ -657,6 +623,40 @@ void InterleaveTest::interleavedDataAttributeAcrossStride() { } } +void InterleaveTest::interleavedDataZeroStride() { + Containers::Array vertexData{100 + 20}; + Containers::StridedArrayView1D positions{vertexData, + reinterpret_cast(vertexData.data() + 100), 3, 0}; + Containers::StridedArrayView1D normals{vertexData, + reinterpret_cast(vertexData.data() + 100 + 8), 3, 0}; + + Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), { + Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions}, + Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals} + }}; + + /* Technically they *are*, but it causes way too many problems especially + when used within interleavedLayout() etc. May tackle properly later. */ + CORRADE_VERIFY(!MeshTools::isInterleaved(data)); +} + +void InterleaveTest::interleavedDataNegativeStride() { + Containers::Array vertexData{100 + 3*20}; + Containers::StridedArrayView1D positions{vertexData, + reinterpret_cast(vertexData.data() + 100), 3, 20}; + Containers::StridedArrayView1D normals{vertexData, + reinterpret_cast(vertexData.data() + 100 + 8), 3, 20}; + + Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), { + Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions.flipped<0>()}, + Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals.flipped<0>()} + }}; + + /* Technically they *are*, but it causes way too many problems especially + when used within interleavedLayout() etc. May tackle properly later. */ + CORRADE_VERIFY(!MeshTools::isInterleaved(data)); +} + void InterleaveTest::interleavedDataVertexDataWholeMemory() { struct Vertex { int:32;