diff options
Diffstat (limited to 'libs/assimp/test/unit/Common')
-rw-r--r-- | libs/assimp/test/unit/Common/uiScene.cpp | 109 | ||||
-rw-r--r-- | libs/assimp/test/unit/Common/utAssertHandler.cpp | 110 | ||||
-rw-r--r-- | libs/assimp/test/unit/Common/utBase64.cpp | 72 | ||||
-rw-r--r-- | libs/assimp/test/unit/Common/utLineSplitter.cpp | 71 | ||||
-rw-r--r-- | libs/assimp/test/unit/Common/utMesh.cpp | 97 | ||||
-rw-r--r-- | libs/assimp/test/unit/Common/utSpatialSort.cpp | 120 | ||||
-rw-r--r-- | libs/assimp/test/unit/Common/utStandardShapes.cpp | 57 | ||||
-rw-r--r-- | libs/assimp/test/unit/Common/utXmlParser.cpp | 86 |
8 files changed, 0 insertions, 722 deletions
diff --git a/libs/assimp/test/unit/Common/uiScene.cpp b/libs/assimp/test/unit/Common/uiScene.cpp deleted file mode 100644 index 87001ce..0000000 --- a/libs/assimp/test/unit/Common/uiScene.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (assimp) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2022, assimp team - -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the following -conditions are met: - -* Redistributions of source code must retain the above -copyright notice, this list of conditions and the -following disclaimer. - -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the -following disclaimer in the documentation and/or other -materials provided with the distribution. - -* Neither the name of the assimp team, nor the names of its -contributors may be used to endorse or promote products -derived from this software without specific prior -written permission of the assimp team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- -*/ - -#include "UnitTestPCH.h" - -#include <assimp/scene.h> -#include <assimp/SceneCombiner.h> - -using namespace Assimp; - -class utScene : public ::testing::Test { -protected: - aiScene *scene; - - void SetUp() override { - scene = new aiScene; - } - - void TearDown() override { - delete scene; - scene = nullptr; - } -}; - -TEST_F(utScene, findNodeTest) { - scene->mRootNode = new aiNode(); - scene->mRootNode->mName.Set("test"); - aiNode *child = new aiNode; - child->mName.Set("child"); - scene->mRootNode->addChildren(1, &child); - aiNode *found = scene->mRootNode->FindNode("child"); - EXPECT_EQ(child, found); -} - -TEST_F(utScene, sceneHasContentTest) { - EXPECT_FALSE(scene->HasAnimations()); - EXPECT_FALSE(scene->HasMaterials()); - EXPECT_FALSE(scene->HasMeshes()); - EXPECT_FALSE(scene->HasCameras()); - EXPECT_FALSE(scene->HasLights()); - EXPECT_FALSE(scene->HasTextures()); -} - -TEST_F(utScene, getShortFilenameTest) { - std::string long_filename1 = "foo_bar/name"; - const char *name1 = scene->GetShortFilename(long_filename1.c_str()); - EXPECT_NE(nullptr, name1); - - std::string long_filename2 = "foo_bar\\name"; - const char *name2 = scene->GetShortFilename(long_filename2.c_str()); - EXPECT_NE(nullptr, name2); -} - -TEST_F(utScene, deepCopyTest) { - scene->mRootNode = new aiNode(); - - scene->mNumMeshes = 1; - scene->mMeshes = new aiMesh *[scene->mNumMeshes] (); - scene->mMeshes[0] = new aiMesh (); - - scene->mMeshes[0]->SetTextureCoordsName (0, aiString ("test")); - - { - aiScene* copied = nullptr; - SceneCombiner::CopyScene(&copied,scene); - delete copied; - } -} - -TEST_F(utScene, getEmbeddedTextureTest) { -} diff --git a/libs/assimp/test/unit/Common/utAssertHandler.cpp b/libs/assimp/test/unit/Common/utAssertHandler.cpp deleted file mode 100644 index a2585fe..0000000 --- a/libs/assimp/test/unit/Common/utAssertHandler.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (assimp) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2022, assimp team - -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the following -conditions are met: - -* Redistributions of source code must retain the above -copyright notice, this list of conditions and the -following disclaimer. - -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the -following disclaimer in the documentation and/or other -materials provided with the distribution. - -* Neither the name of the assimp team, nor the names of its -contributors may be used to endorse or promote products -derived from this software without specific prior -written permission of the assimp team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- -*/ - -#include "UnitTestPCH.h" - -/// Ensure this test has asserts on, even if the build type doesn't have asserts by default. -#if !defined(ASSIMP_BUILD_DEBUG) -#define ASSIMP_BUILD_DEBUG -#endif - -#include <assimp/ai_assert.h> -#include <code/Common/AssertHandler.h> - -namespace -{ - /// An exception which is thrown by the testAssertHandler - struct TestAssertException - { - TestAssertException(const char* failedExpression, const char* file, int line) - : m_failedExpression(failedExpression) - , m_file(file) - , m_line(line) - { - } - - std::string m_failedExpression; - std::string m_file; - int m_line; - }; - - /// Swap the default handler, which aborts, by one which throws. - void testAssertHandler(const char* failedExpression, const char* file, int line) - { - throw TestAssertException(failedExpression, file, line); - } - - /// Ensure that the default assert handler is restored after the test is finished. - struct ReplaceHandlerScope - { - ReplaceHandlerScope() - { - Assimp::setAiAssertHandler(testAssertHandler); - } - - ~ReplaceHandlerScope() - { - Assimp::setAiAssertHandler(Assimp::defaultAiAssertHandler); - } - }; -} - -TEST(utAssertHandler, replaceWithThrow) -{ - ReplaceHandlerScope scope; - - try - { - ai_assert((2 + 2 == 5) && "Sometimes people put messages here"); - EXPECT_TRUE(false); - } - catch(const TestAssertException& e) - { - EXPECT_STREQ(e.m_failedExpression.c_str(), "(2 + 2 == 5) && \"Sometimes people put messages here\""); - EXPECT_STREQ(e.m_file.c_str(), __FILE__); - EXPECT_GT(e.m_line, 0); - EXPECT_LT(e.m_line, __LINE__); - } - catch(...) - { - EXPECT_TRUE(false); - } -} diff --git a/libs/assimp/test/unit/Common/utBase64.cpp b/libs/assimp/test/unit/Common/utBase64.cpp deleted file mode 100644 index 8b0a60e..0000000 --- a/libs/assimp/test/unit/Common/utBase64.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (assimp) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2022, assimp team - -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the following -conditions are met: - -* Redistributions of source code must retain the above -copyright notice, this list of conditions and the -following disclaimer. - -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the -following disclaimer in the documentation and/or other -materials provided with the distribution. - -* Neither the name of the assimp team, nor the names of its -contributors may be used to endorse or promote products -derived from this software without specific prior -written permission of the assimp team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- -*/ - -#include "UnitTestPCH.h" -#include "TestIOSystem.h" - -#include <assimp/Base64.hpp> - -using namespace std; -using namespace Assimp; - -class Base64Test : public ::testing::Test { -public: - virtual void SetUp() { - } - - virtual void TearDown() { - } -}; - -static const std::vector<uint8_t> assimpStringBinary = { 97, 115, 115, 105, 109, 112 }; -static const std::string assimpStringEncoded = "YXNzaW1w"; - -TEST_F( Base64Test, encodeTest ) { - EXPECT_EQ( "", Base64::Encode (std::vector<uint8_t>{}) ); - EXPECT_EQ( "Vg==", Base64::Encode (std::vector<uint8_t>{ 86 }) ); - EXPECT_EQ( assimpStringEncoded, Base64::Encode (assimpStringBinary) ); -} - -TEST_F( Base64Test, decodeTest ) { - EXPECT_EQ( std::vector<uint8_t> {}, Base64::Decode ("") ); - EXPECT_EQ( std::vector<uint8_t> { 86 }, Base64::Decode ("Vg==") ); - EXPECT_EQ( assimpStringBinary, Base64::Decode (assimpStringEncoded) ); -} diff --git a/libs/assimp/test/unit/Common/utLineSplitter.cpp b/libs/assimp/test/unit/Common/utLineSplitter.cpp deleted file mode 100644 index 0a97f72..0000000 --- a/libs/assimp/test/unit/Common/utLineSplitter.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (assimp) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2022, assimp team - - - -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the following -conditions are met: - -* Redistributions of source code must retain the above -copyright notice, this list of conditions and the -following disclaimer. - -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the -following disclaimer in the documentation and/or other -materials provided with the distribution. - -* Neither the name of the assimp team, nor the names of its -contributors may be used to endorse or promote products -derived from this software without specific prior -written permission of the assimp team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- -*/ -#include "UnitTestPCH.h" - -#include <assimp/LineSplitter.h> -#include <assimp/DefaultIOSystem.h> -#include <string> - -using namespace Assimp; - -class utLineSplitter : public ::testing::Test { - // empty -}; - -TEST_F(utLineSplitter, tokenizetest) { - DefaultIOSystem fs; - IOStream* file = fs.Open(ASSIMP_TEST_MODELS_DIR"/ParsingFiles/linesplitter_tokenizetest.txt", "rb"); - - StreamReaderLE stream(file); - LineSplitter myLineSplitter(stream); -} - -TEST_F( utLineSplitter, issue212Test) { - DefaultIOSystem fs; - IOStream* file = fs.Open(ASSIMP_TEST_MODELS_DIR"/ParsingFiles/linesplitter_emptyline_test.txt", "rb"); - - StreamReaderLE stream(file); - LineSplitter myLineSplitter(stream); - myLineSplitter++; - EXPECT_THROW( myLineSplitter++, std::logic_error ); -} diff --git a/libs/assimp/test/unit/Common/utMesh.cpp b/libs/assimp/test/unit/Common/utMesh.cpp deleted file mode 100644 index 77a7113..0000000 --- a/libs/assimp/test/unit/Common/utMesh.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (assimp) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2022, assimp team - -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the following -conditions are met: - -* Redistributions of source code must retain the above -copyright notice, this list of conditions and the -following disclaimer. - -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the -following disclaimer in the documentation and/or other -materials provided with the distribution. - -* Neither the name of the assimp team, nor the names of its -contributors may be used to endorse or promote products -derived from this software without specific prior -written permission of the assimp team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- -*/ - -#include "UnitTestPCH.h" - -#include <assimp/mesh.h> - -using namespace Assimp; - -class utMesh : public ::testing::Test { -protected: - aiMesh* mesh = nullptr; - - void SetUp() override { - mesh = new aiMesh; - } - - void TearDown() override { - delete mesh; - mesh = nullptr; - } -}; - -TEST_F(utMesh, emptyMeshHasNoContentTest) { - EXPECT_EQ(0u, mesh->mName.length); - EXPECT_FALSE(mesh->HasPositions()); - EXPECT_FALSE(mesh->HasFaces()); - EXPECT_FALSE(mesh->HasNormals()); - EXPECT_FALSE(mesh->HasTangentsAndBitangents()); - EXPECT_FALSE(mesh->HasVertexColors(0)); - EXPECT_FALSE(mesh->HasVertexColors(AI_MAX_NUMBER_OF_COLOR_SETS)); - EXPECT_FALSE(mesh->HasTextureCoords(0)); - EXPECT_FALSE(mesh->HasTextureCoords(AI_MAX_NUMBER_OF_TEXTURECOORDS)); - EXPECT_EQ(0u, mesh->GetNumUVChannels()); - EXPECT_EQ(0u, mesh->GetNumColorChannels()); - EXPECT_FALSE(mesh->HasBones()); - EXPECT_FALSE(mesh->HasTextureCoordsName(0)); - EXPECT_FALSE(mesh->HasTextureCoordsName(AI_MAX_NUMBER_OF_TEXTURECOORDS)); -} - -TEST_F(utMesh, setTextureCoordsName) { - EXPECT_FALSE(mesh->HasTextureCoordsName(0)); - const aiString texcoords_name("texcoord_name"); - mesh->SetTextureCoordsName(0, texcoords_name); - EXPECT_TRUE(mesh->HasTextureCoordsName(0u)); - EXPECT_FALSE(mesh->HasTextureCoordsName(1u)); - ASSERT_NE(nullptr, mesh->mTextureCoordsNames); - ASSERT_NE(nullptr, mesh->mTextureCoordsNames[0]); - EXPECT_STREQ(texcoords_name.C_Str(), mesh->mTextureCoordsNames[0]->C_Str()); - EXPECT_STREQ(texcoords_name.C_Str(), mesh->GetTextureCoordsName(0)->C_Str()); - - // Now clear the name - mesh->SetTextureCoordsName(0, aiString()); - EXPECT_FALSE(mesh->HasTextureCoordsName(0)); - ASSERT_NE(nullptr, mesh->mTextureCoordsNames); - EXPECT_EQ(nullptr, mesh->mTextureCoordsNames[0]); - EXPECT_EQ(nullptr, mesh->GetTextureCoordsName(0)); -} - diff --git a/libs/assimp/test/unit/Common/utSpatialSort.cpp b/libs/assimp/test/unit/Common/utSpatialSort.cpp deleted file mode 100644 index 0684e83..0000000 --- a/libs/assimp/test/unit/Common/utSpatialSort.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (assimp) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2022, assimp team - -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the following -conditions are met: - -* Redistributions of source code must retain the above -copyright notice, this list of conditions and the -following disclaimer. - -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the -following disclaimer in the documentation and/or other -materials provided with the distribution. - -* Neither the name of the assimp team, nor the names of its -contributors may be used to endorse or promote products -derived from this software without specific prior -written permission of the assimp team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- -*/ -#include "UnitTestPCH.h" - -#include <assimp/SpatialSort.h> - -using namespace Assimp; - -class utSpatialSort : public ::testing::Test { -public - : - aiVector3D *vecs; - -protected: - void SetUp() override { - ::srand(static_cast<unsigned>(time(0))); - vecs = new aiVector3D[100]; - for (size_t i = 0; i < 100; ++i) { - vecs[i].x = static_cast<float>(rand()) / (static_cast<float>(RAND_MAX / 100)); - vecs[i].y = static_cast<float>(rand()) / (static_cast<float>(RAND_MAX / 100)); - vecs[i].z = static_cast<float>(rand()) / (static_cast<float>(RAND_MAX / 100)); - } - } - - void TearDown() override { - delete[] vecs; - } -}; - -TEST_F( utSpatialSort, findIdenticalsTest ) { - SpatialSort sSort; - sSort.Fill(vecs, 100, sizeof(aiVector3D)); - - std::vector<unsigned int> indices; - sSort.FindIdenticalPositions(vecs[0], indices); - EXPECT_EQ(1u, indices.size()); -} - -TEST_F(utSpatialSort, findPositionsTest) { - SpatialSort sSort; - sSort.Fill(vecs, 100, sizeof(aiVector3D)); - - std::vector<unsigned int> indices; - sSort.FindPositions(vecs[0], 0.01f, indices); - EXPECT_EQ(1u, indices.size()); -} - -TEST_F(utSpatialSort, highlyDisplacedPositionsTest) { - // Make a cube of positions, and then query it using the SpatialSort object. - constexpr unsigned int verticesPerAxis = 10; - constexpr ai_real step = 0.001f; - // Note the large constant offset here. - constexpr ai_real offset = 5000.0f - (0.5f * verticesPerAxis * step); - constexpr unsigned int totalNumPositions = verticesPerAxis * verticesPerAxis * verticesPerAxis; - aiVector3D* positions = new aiVector3D[totalNumPositions]; - for (unsigned int x = 0; x < verticesPerAxis; ++x) { - for (unsigned int y = 0; y < verticesPerAxis; ++y) { - for (unsigned int z = 0; z < verticesPerAxis; ++z) { - const unsigned int index = (x * verticesPerAxis * verticesPerAxis) + (y * verticesPerAxis) + z; - positions[index] = aiVector3D(offset + (x * step), offset + (y * step), offset + (z * step)); - } - } - } - - SpatialSort sSort; - sSort.Fill(positions, totalNumPositions, sizeof(aiVector3D)); - - // Enough to find a point and its 6 immediate neighbors, but not any other point. - const ai_real epsilon = 1.1f * step; - std::vector<unsigned int> indices; - // Iterate through the _interior_ points of the cube. - for (unsigned int x = 1; x < verticesPerAxis - 1; ++x) { - for (unsigned int y = 1; y < verticesPerAxis - 1; ++y) { - for (unsigned int z = 1; z < verticesPerAxis - 1; ++z) { - const unsigned int index = (x * verticesPerAxis * verticesPerAxis) + (y * verticesPerAxis) + z; - sSort.FindPositions(positions[index], epsilon, indices); - ASSERT_EQ(7u, indices.size()); - } - } - } - delete[] positions; -} diff --git a/libs/assimp/test/unit/Common/utStandardShapes.cpp b/libs/assimp/test/unit/Common/utStandardShapes.cpp deleted file mode 100644 index d7e6d21..0000000 --- a/libs/assimp/test/unit/Common/utStandardShapes.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* -Open Asset Import Library (assimp) ----------------------------------------------------------------------- -Copyright (c) 2006-2022, assimp team -All rights reserved. -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the -following conditions are met: -* Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. -* Neither the name of the assimp team, nor the names of its - contributors may be used to endorse or promote products - derived from this software without specific prior - written permission of the assimp team. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------- -*/ -#include "UnitTestPCH.h" -#include <assimp/mesh.h> -#include <assimp/StandardShapes.h> - -using namespace Assimp; - -class utStandardShapes : public ::testing::Test { - // empty -}; - -TEST_F( utStandardShapes, testMakeMesh ) { - // Make sphere positions - std::vector<aiVector3D> positions; - Assimp::StandardShapes::MakeSphere(1, positions); - - // Make mesh - const auto numIndicesPerPrimitive = 3u; - aiMesh *aiMeshPtr = Assimp::StandardShapes::MakeMesh(positions, numIndicesPerPrimitive); - - // The mNumIndices member of the second face is now incorrect - const auto& face = aiMeshPtr->mFaces[0]; - EXPECT_EQ(face.mNumIndices, numIndicesPerPrimitive); - delete aiMeshPtr; -} - diff --git a/libs/assimp/test/unit/Common/utXmlParser.cpp b/libs/assimp/test/unit/Common/utXmlParser.cpp deleted file mode 100644 index 2db78e3..0000000 --- a/libs/assimp/test/unit/Common/utXmlParser.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/*------------------------------------------------------------------------- -Open Asset Import Library (assimp) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2022, assimp team - -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the following -conditions are met: - -* Redistributions of source code must retain the above -copyright notice, this list of conditions and the -following disclaimer. - -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the -following disclaimer in the documentation and/or other -materials provided with the distribution. - -* Neither the name of the assimp team, nor the names of its -contributors may be used to endorse or promote products -derived from this software without specific prior -written permission of the assimp team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------*/ -#include "UnitTestPCH.h" -#include <assimp/XmlParser.h> -#include <assimp/DefaultIOStream.h> -#include <assimp/DefaultIOSystem.h> - -using namespace Assimp; - -class utXmlParser : public ::testing::Test { -public: - utXmlParser() : - Test(), - mIoSystem() { - // empty - } - -protected: - DefaultIOSystem mIoSystem; -}; - -TEST_F(utXmlParser, parse_xml_test) { - XmlParser parser; - std::string filename = ASSIMP_TEST_MODELS_DIR "/X3D/ComputerKeyboard.x3d"; - std::unique_ptr<IOStream> stream(mIoSystem.Open(filename.c_str(), "rb")); - EXPECT_NE(stream.get(), nullptr); - bool result = parser.parse(stream.get()); - EXPECT_TRUE(result); -} - -TEST_F(utXmlParser, parse_xml_and_traverse_test) { - XmlParser parser; - std::string filename = ASSIMP_TEST_MODELS_DIR "/X3D/ComputerKeyboard.x3d"; - std::unique_ptr<IOStream> stream(mIoSystem.Open(filename.c_str(), "rb")); - EXPECT_NE(stream.get(), nullptr); - bool result = parser.parse(stream.get()); - EXPECT_TRUE(result); - XmlNode root = parser.getRootNode(); - - XmlNodeIterator nodeIt(root, XmlNodeIterator::PreOrderMode); - const size_t numNodes = nodeIt.size(); - bool empty = nodeIt.isEmpty(); - EXPECT_FALSE(empty); - EXPECT_NE(numNodes, 0U); - XmlNode node; - while (nodeIt.getNext(node)) { - const std::string nodeName = node.name(); - EXPECT_FALSE(nodeName.empty()); - } -} |