AssemblyTest: Introduce assembly test module

This commit is contained in:
PaddleStroke
2024-01-24 18:42:47 +01:00
parent 7af02003d8
commit 1062ea4eb0
7 changed files with 244 additions and 13 deletions

View File

@@ -0,0 +1,57 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#include "gtest/gtest.h"
#include <FCConfig.h>
#include <App/Application.h>
#include <App/Document.h>
#include <App/Expression.h>
#include <App/ObjectIdentifier.h>
#include <Mod/Assembly/App/AssemblyObject.h>
#include <Mod/Assembly/App/JointGroup.h>
#include <src/App/InitApplication.h>
class AssemblyObjectTest: public ::testing::Test
{
protected:
static void SetUpTestSuite()
{
tests::initApplication();
}
void SetUp() override
{
_docName = App::GetApplication().getUniqueDocumentName("test");
auto _doc = App::GetApplication().newDocument(_docName.c_str(), "testUser");
_assemblyObj =
static_cast<Assembly::AssemblyObject*>(_doc->addObject("Assembly::AssemblyObject"));
_jointGroupObj = static_cast<Assembly::JointGroup*>(
_assemblyObj->addObject("Assembly::JointGroup", "jointGroupTest"));
}
void TearDown() override
{
App::GetApplication().closeDocument(_docName.c_str());
}
Assembly::AssemblyObject* getObject()
{
return _assemblyObj;
}
private:
// TODO: use shared_ptr or something else here?
Assembly::AssemblyObject* _assemblyObj;
Assembly::JointGroup* _jointGroupObj;
std::string _docName;
};
TEST_F(AssemblyObjectTest, createAssemblyObject) // NOLINT
{
// Arrange
// Act
// Assert
}

View File

@@ -0,0 +1,5 @@
target_sources(
Assembly_tests_run
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/AssemblyObject.cpp
)

View File

@@ -0,0 +1,15 @@
target_include_directories(Assembly_tests_run PUBLIC
${EIGEN3_INCLUDE_DIR}
${OCC_INCLUDE_DIR}
${Python3_INCLUDE_DIRS}
${XercesC_INCLUDE_DIRS}
)
target_link_libraries(Assembly_tests_run
gtest_main
${Google_Tests_LIBS}
Assembly
)
add_subdirectory(App)

View File

@@ -1,3 +1,6 @@
if(BUILD_ASSEMBLY)
add_subdirectory(Assembly)
endif(BUILD_ASSEMBLY)
if(BUILD_MATERIAL)
add_subdirectory(Material)
endif(BUILD_MATERIAL)