62 lines
1.5 KiB
C++
62 lines
1.5 KiB
C++
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
// Tests for the makeShapeWithElementMap method, extracted from the main set of tests for TopoShape
|
|
// due to length and complexity.
|
|
|
|
#include "gtest/gtest.h"
|
|
#include "src/App/InitApplication.h"
|
|
#include "TopoShapeExpansionHelpers.h"
|
|
#include <Mod/Part/App/TopoShape.h>
|
|
|
|
#include <TopoDS_Vertex.hxx>
|
|
|
|
class TopoShapeMakeShapeWithElementMapTests: public ::testing::Test
|
|
{
|
|
protected:
|
|
static void SetUpTestSuite()
|
|
{
|
|
tests::initApplication();
|
|
}
|
|
|
|
void SetUp() override
|
|
{
|
|
_docName = App::GetApplication().getUniqueDocumentName("test");
|
|
App::GetApplication().newDocument(_docName.c_str(), "testUser");
|
|
_sids = &_sid;
|
|
}
|
|
|
|
void TearDown() override
|
|
{
|
|
App::GetApplication().closeDocument(_docName.c_str());
|
|
}
|
|
|
|
Part::TopoShape* Shape()
|
|
{
|
|
return &_shape;
|
|
}
|
|
|
|
Part::TopoShape::Mapper* Mapper()
|
|
{
|
|
return &_mapper;
|
|
}
|
|
|
|
private:
|
|
std::string _docName;
|
|
Data::ElementIDRefs _sid;
|
|
QVector<App::StringIDRef>* _sids = nullptr;
|
|
Part::TopoShape _shape;
|
|
Part::TopoShape::Mapper _mapper;
|
|
};
|
|
|
|
TEST_F(TopoShapeMakeShapeWithElementMapTests, nullShapeThrows)
|
|
{
|
|
// Arrange
|
|
auto [cube1, cube2] = TopoShapeExpansionHelpers::CreateTwoCubes();
|
|
std::vector<Part::TopoShape> sources {cube1, cube2};
|
|
TopoDS_Vertex nullShape;
|
|
|
|
// Act and assert
|
|
EXPECT_THROW(Shape()->makeShapeWithElementMap(nullShape, *Mapper(), sources),
|
|
Part::NullShapeException);
|
|
}
|