From eabba4f1558d962d658be5b68d8ca40da88d6089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 13 May 2023 19:04:08 +0200 Subject: [PATCH] Trade,SceneTools: use lowercase in custom field / attribute name tests. Custom material attributes are enforced to start with a lowercase letter, so I think it makes sense to be consistent and use the same for custom scene fields and mesh attributes as well. It's not enforced in any way but the tests should reflect that choice so new code that gets written based on these inherits that practice. --- .../Test/SceneConverterImplementationTest.cpp | 4 ++-- .../info-meshes-bounds.txt | 2 +- .../info-scenes-no-default.txt | 2 +- .../info-scenes-objects.txt | 6 ++--- .../info-scenes.txt | 2 +- .../SceneTools/Test/SceneConverterTest.cpp | 8 +++---- .../Trade/Test/AbstractImporterTest.cpp | 8 +++---- .../Trade/Test/AbstractSceneConverterTest.cpp | 24 +++++++++---------- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp b/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp index 37605d315..3c605a3c5 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp +++ b/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp @@ -225,7 +225,7 @@ void SceneConverterImplementationTest::infoScenesObjects() { return ""; } Containers::String doSceneFieldName(Trade::SceneField name) override { - if(name == Trade::sceneFieldCustom(1337)) return "DirectionVector"; + if(name == Trade::sceneFieldCustom(1337)) return "directionVector"; return ""; } Containers::Optional doScene(UnsignedInt id) override { @@ -757,7 +757,7 @@ void SceneConverterImplementationTest::infoMeshesBounds() { Containers::String doMeshAttributeName(Trade::MeshAttribute name) override { if(name == Trade::meshAttributeCustom(25)) - return "NormalButCustomSoNoBoundsPrinted"; + return "normalButCustomSoNoBoundsPrinted"; return ""; } diff --git a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes-bounds.txt b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes-bounds.txt index e2eb5d31d..ba336db7c 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes-bounds.txt +++ b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes-bounds.txt @@ -10,7 +10,7 @@ Mesh 0: Bounds: (12, 155) Normal @ Vector3bNormalized, offset 76, stride 3 Bounds: ({-1, 0, 0}, {0, 1, 1}) - Custom(25:NormalButCustomSoNoBoundsPrinted) @ Vector3b, offset 76, stride 3 + Custom(25:normalButCustomSoNoBoundsPrinted) @ Vector3b, offset 76, stride 3 TextureCoordinates @ Vector2, offset 84, stride 8 Bounds: ({0.5, 0.5}, {1.5, 0.5}) Color @ Vector4, offset 100, stride 16 diff --git a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes-no-default.txt b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes-no-default.txt index acd050cc3..5410f9833 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes-no-default.txt +++ b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes-no-default.txt @@ -7,5 +7,5 @@ Scene 1: Bound: 8 objects @ UnsignedByte (0.0 kB, ExternallyOwned|Mutable) Fields: Custom(42:) @ Double, 2 entries - Custom(1337:DirectionVector) @ Short[3], 3 entries + Custom(1337:directionVector) @ Short[3], 3 entries Total scene data size: 0.1 kB diff --git a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes-objects.txt b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes-objects.txt index 1faf222df..462e0544a 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes-objects.txt +++ b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes-objects.txt @@ -8,18 +8,18 @@ Scene 1: Bound: 8 objects @ UnsignedByte (0.0 kB, ExternallyOwned|Mutable) Fields: Custom(42:) @ Double, 2 entries - Custom(1337:DirectionVector) @ Short[3], 3 entries + Custom(1337:directionVector) @ Short[3], 3 entries Total scene data size: 0.1 kB Object 0 (referenced by 1 scenes): Parent-less mesh Fields: Mesh Object 1 (referenced by 1 scenes): Fields: Parent, Mesh Object 2 (referenced by 2 scenes): Two meshes, shared among two scenes - Fields: Parent, Mesh[2], Custom(1337:DirectionVector) + Fields: Parent, Mesh[2], Custom(1337:directionVector) Object 3 (referenced by 2 scenes): Fields: Parent, Custom(42:) Object 4 (referenced by 1 scenes): Two custom arrays - Fields: Custom(1337:DirectionVector)[2] + Fields: Custom(1337:directionVector)[2] Object 6 (referenced by 0 scenes): Only in the second scene, but no fields, thus same as unreferenced Object 7 (referenced by 1 scenes): Fields: Custom(42:) diff --git a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes.txt b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes.txt index be4b3da29..2fab1ae80 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes.txt +++ b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-scenes.txt @@ -8,5 +8,5 @@ Scene 1: Bound: 8 objects @ UnsignedByte (0.0 kB, ExternallyOwned|Mutable) Fields: Custom(42:) @ Double, 2 entries - Custom(1337:DirectionVector) @ Short[3], 3 entries + Custom(1337:directionVector) @ Short[3], 3 entries Total scene data size: 0.1 kB diff --git a/src/Magnum/SceneTools/Test/SceneConverterTest.cpp b/src/Magnum/SceneTools/Test/SceneConverterTest.cpp index daf995f30..e62da54be 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterTest.cpp +++ b/src/Magnum/SceneTools/Test/SceneConverterTest.cpp @@ -688,8 +688,8 @@ const struct { "materials-pbr.gltf", nullptr, "MaterialTools::phongToPbrMetallicRoughness(): unconvertable Trade::MaterialAttribute::AmbientColor attribute, skipping\n" /** @todo remove this once GltfSceneConverter supports bit fields */ - "Trade::GltfSceneConverter::add(): custom scene field Visibility has unsupported type Trade::SceneFieldType::Bit, skipping\n" - "Trade::GltfSceneConverter::add(): custom scene field GeometryTransformHelper has unsupported type Trade::SceneFieldType::Bit, skipping\n"}, + "Trade::GltfSceneConverter::add(): custom scene field visibility has unsupported type Trade::SceneFieldType::Bit, skipping\n" + "Trade::GltfSceneConverter::add(): custom scene field geometryTransformHelper has unsupported type Trade::SceneFieldType::Bit, skipping\n"}, {"Phong to PBR, verbose", {InPlaceInit, { /* Same as above, just with -v added */ "-I", "UfbxImporter", "-C", "GltfSceneConverter", "--phong-to-pbr", @@ -711,8 +711,8 @@ const struct { "Trade::AbstractSceneConverter::addImporterContents(): adding mesh 1 out of 2\n" "Trade::AbstractSceneConverter::addImporterContents(): adding scene 0 out of 1\n" /** @todo remove this once GltfSceneConverter supports bit fields */ - "Trade::GltfSceneConverter::add(): custom scene field Visibility has unsupported type Trade::SceneFieldType::Bit, skipping\n" - "Trade::GltfSceneConverter::add(): custom scene field GeometryTransformHelper has unsupported type Trade::SceneFieldType::Bit, skipping\n"}, + "Trade::GltfSceneConverter::add(): custom scene field visibility has unsupported type Trade::SceneFieldType::Bit, skipping\n" + "Trade::GltfSceneConverter::add(): custom scene field geometryTransformHelper has unsupported type Trade::SceneFieldType::Bit, skipping\n"}, {"data unsupported by the converter", {InPlaceInit, { "-I", "GltfImporter", "-i", "experimentalKhrTextureKtx", "-C", "StanfordSceneConverter", diff --git a/src/Magnum/Trade/Test/AbstractImporterTest.cpp b/src/Magnum/Trade/Test/AbstractImporterTest.cpp index 26cad1420..5f7634a59 100644 --- a/src/Magnum/Trade/Test/AbstractImporterTest.cpp +++ b/src/Magnum/Trade/Test/AbstractImporterTest.cpp @@ -3767,18 +3767,18 @@ void AbstractImporterTest::sceneFieldName() { void doClose() override {} SceneField doSceneFieldForName(Containers::StringView name) override { - if(name == "OctreeCell") return sceneFieldCustom(100037); + if(name == "octreeCell") return sceneFieldCustom(100037); return SceneField{}; } Containers::String doSceneFieldName(SceneField id) override { - if(id == sceneFieldCustom(100037)) return "OctreeCell"; + if(id == sceneFieldCustom(100037)) return "octreeCell"; return ""; } } importer; - CORRADE_COMPARE(importer.sceneFieldForName("OctreeCell"), sceneFieldCustom(100037)); - CORRADE_COMPARE(importer.sceneFieldName(sceneFieldCustom(100037)), "OctreeCell"); + CORRADE_COMPARE(importer.sceneFieldForName("octreeCell"), sceneFieldCustom(100037)); + CORRADE_COMPARE(importer.sceneFieldName(sceneFieldCustom(100037)), "octreeCell"); } void AbstractImporterTest::sceneFieldNameNotImplemented() { diff --git a/src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp b/src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp index 50b531003..544adc890 100644 --- a/src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp +++ b/src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp @@ -6216,8 +6216,8 @@ void AbstractSceneConverterTest::addImporterContentsCustomSceneFields() { return SceneData{SceneMappingType::UnsignedInt, 0, nullptr, {}}; } Containers::String doSceneFieldName(SceneField name) override { - if(name == sceneFieldCustom(34977)) return "OffsetSmall"; - if(name == sceneFieldCustom(5266)) return "ValueData"; + if(name == sceneFieldCustom(34977)) return "offsetSmall"; + if(name == sceneFieldCustom(5266)) return "valueData"; CORRADE_FAIL("This should not be reached"); CORRADE_INTERNAL_ASSERT_UNREACHABLE(); } @@ -6250,11 +6250,11 @@ void AbstractSceneConverterTest::addImporterContentsCustomSceneFields() { CORRADE_COMPARE(out.str(), "Adding scene\n" /** @todo cache the names to avoid querying repeatedly */ - "Setting field 34977 name to OffsetSmall\n" - "Setting field 5266 name to ValueData\n" + "Setting field 34977 name to offsetSmall\n" + "Setting field 5266 name to valueData\n" "Adding scene\n" - "Setting field 34977 name to OffsetSmall\n" - "Setting field 5266 name to ValueData\n" + "Setting field 34977 name to offsetSmall\n" + "Setting field 5266 name to valueData\n" "Adding scene\n"); } @@ -6281,8 +6281,8 @@ void AbstractSceneConverterTest::addImporterContentsCustomMeshAttributes() { return MeshData{MeshPrimitive::Points, 0}; } Containers::String doMeshAttributeName(MeshAttribute name) override { - if(name == meshAttributeCustom(31977)) return "OffsetSmall"; - if(name == meshAttributeCustom(5266)) return "ValueData"; + if(name == meshAttributeCustom(31977)) return "offsetSmall"; + if(name == meshAttributeCustom(5266)) return "valueData"; CORRADE_FAIL("This should not be reached"); CORRADE_INTERNAL_ASSERT_UNREACHABLE(); } @@ -6316,10 +6316,10 @@ void AbstractSceneConverterTest::addImporterContentsCustomMeshAttributes() { CORRADE_COMPARE(out.str(), "Adding mesh levels\n" /** @todo cache the names to avoid querying repeatedly */ - "Setting attribute 31977 name to OffsetSmall\n" - "Setting attribute 5266 name to ValueData\n" - "Setting attribute 31977 name to OffsetSmall\n" - "Setting attribute 5266 name to ValueData\n" + "Setting attribute 31977 name to offsetSmall\n" + "Setting attribute 5266 name to valueData\n" + "Setting attribute 31977 name to offsetSmall\n" + "Setting attribute 5266 name to valueData\n" "Adding mesh levels\n"); }