| | |
| |
|
| | #include <gtest/gtest.h> |
| |
|
| | #include "Mod/Part/App/FeatureCompound.h" |
| | #include <src/App/InitApplication.h> |
| |
|
| | #include "PartTestHelpers.h" |
| |
|
| | class FeatureCompoundTest: public ::testing::Test, public PartTestHelpers::PartTestHelperClass |
| | { |
| | protected: |
| | static void SetUpTestSuite() |
| | { |
| | tests::initApplication(); |
| | } |
| |
|
| |
|
| | void SetUp() override |
| | { |
| | createTestDoc(); |
| | _compound = _doc->addObject<Part::Compound>(); |
| | } |
| |
|
| | void TearDown() override |
| | {} |
| |
|
| | Part::Compound* _compound = nullptr; |
| | }; |
| |
|
| | TEST_F(FeatureCompoundTest, testIntersecting) |
| | { |
| | |
| | _compound->Links.setValues({_boxes[0], _boxes[1]}); |
| | |
| | _compound->execute(); |
| | Part::TopoShape ts = _compound->Shape.getValue(); |
| | double volume = PartTestHelpers::getVolume(ts.getShape()); |
| | Base::BoundBox3d bb = ts.getBoundBox(); |
| | |
| | EXPECT_DOUBLE_EQ(volume, 12.0); |
| | EXPECT_TRUE(PartTestHelpers::boxesMatch(bb, Base::BoundBox3d(0.0, 0.0, 0.0, 1.0, 3.0, 3.0))); |
| | EXPECT_EQ(ts.countSubShapes(TopAbs_SHAPE), 2); |
| | } |
| |
|
| | TEST_F(FeatureCompoundTest, testNonIntersecting) |
| | { |
| | |
| | _compound->Links.setValues({_boxes[0], _boxes[2]}); |
| | |
| | _compound->execute(); |
| | Part::TopoShape ts = _compound->Shape.getValue(); |
| | double volume = PartTestHelpers::getVolume(ts.getShape()); |
| | Base::BoundBox3d bb = ts.getBoundBox(); |
| | |
| | EXPECT_DOUBLE_EQ(volume, 12.0); |
| | EXPECT_TRUE(PartTestHelpers::boxesMatch(bb, Base::BoundBox3d(0.0, 0.0, 0.0, 1.0, 5.0, 3.0))); |
| | EXPECT_EQ(ts.countSubShapes(TopAbs_SHAPE), 2); |
| | } |
| |
|