AssemblyTest: Introduce assembly test module
This commit is contained in:
57
tests/src/Mod/Assembly/App/AssemblyObject.cpp
Normal file
57
tests/src/Mod/Assembly/App/AssemblyObject.cpp
Normal 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
|
||||
}
|
||||
5
tests/src/Mod/Assembly/App/CMakeLists.txt
Normal file
5
tests/src/Mod/Assembly/App/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
target_sources(
|
||||
Assembly_tests_run
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AssemblyObject.cpp
|
||||
)
|
||||
15
tests/src/Mod/Assembly/CMakeLists.txt
Normal file
15
tests/src/Mod/Assembly/CMakeLists.txt
Normal 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)
|
||||
@@ -1,3 +1,6 @@
|
||||
if(BUILD_ASSEMBLY)
|
||||
add_subdirectory(Assembly)
|
||||
endif(BUILD_ASSEMBLY)
|
||||
if(BUILD_MATERIAL)
|
||||
add_subdirectory(Material)
|
||||
endif(BUILD_MATERIAL)
|
||||
|
||||
Reference in New Issue
Block a user