| | |
| |
|
| | #include <FCConfig.h> |
| |
|
| | #include <Base/Reader.h> |
| | #include <Base/Writer.h> |
| | #include <Mod/Sketcher/App/Constraint.h> |
| |
|
| | #include <gtest/gtest.h> |
| | #include <xercesc/util/PlatformUtils.hpp> |
| | #include <QTemporaryFile> |
| |
|
| | #include <src/App/InitApplication.h> |
| |
|
| |
|
| | |
| | class XercesEnvironment: public ::testing::Environment |
| | { |
| | public: |
| | void SetUp() override |
| | { |
| | try { |
| | xercesc::XMLPlatformUtils::Initialize(); |
| | } |
| | catch (const xercesc::XMLException& e) { |
| | FAIL() << "Xerces init failed: " << xercesc::XMLString::transcode(e.getMessage()); |
| | } |
| | } |
| |
|
| | void TearDown() override |
| | { |
| | xercesc::XMLPlatformUtils::Terminate(); |
| | } |
| | }; |
| |
|
| | ::testing::Environment* const xercesEnv = ::testing::AddGlobalTestEnvironment(new XercesEnvironment); |
| |
|
| | class ConstraintPointsAccess: public ::testing::Test |
| | { |
| | protected: |
| | static void SetUpTestSuite() |
| | { |
| | tests::initApplication(); |
| | } |
| | }; |
| |
|
| | TEST_F(ConstraintPointsAccess, testDefaultGeoElementIdsAreSane) |
| | { |
| | |
| | auto constraint = Sketcher::Constraint(); |
| |
|
| | |
| |
|
| | |
| | #if SKETCHER_CONSTRAINT_USE_LEGACY_ELEMENTS |
| | |
| | EXPECT_EQ(constraint.First, Sketcher::GeoEnum::GeoUndef); |
| | EXPECT_EQ(constraint.FirstPos, Sketcher::PointPos::none); |
| |
|
| | EXPECT_EQ(constraint.Second, Sketcher::GeoEnum::GeoUndef); |
| | EXPECT_EQ(constraint.SecondPos, Sketcher::PointPos::none); |
| |
|
| | EXPECT_EQ(constraint.Third, Sketcher::GeoEnum::GeoUndef); |
| | EXPECT_EQ(constraint.ThirdPos, Sketcher::PointPos::none); |
| |
|
| | |
| | #endif |
| | EXPECT_EQ( |
| | constraint.getElement(0), |
| | Sketcher::GeoElementId(Sketcher::GeoEnum::GeoUndef, Sketcher::PointPos::none) |
| | ); |
| | EXPECT_EQ( |
| | constraint.getElement(1), |
| | Sketcher::GeoElementId(Sketcher::GeoEnum::GeoUndef, Sketcher::PointPos::none) |
| | ); |
| | EXPECT_EQ( |
| | constraint.getElement(2), |
| | Sketcher::GeoElementId(Sketcher::GeoEnum::GeoUndef, Sketcher::PointPos::none) |
| | ); |
| | } |
| |
|
| | #if SKETCHER_CONSTRAINT_USE_LEGACY_ELEMENTS |
| | TEST_F(ConstraintPointsAccess, testOldWriteIsReadByNew) |
| | { |
| | |
| | auto constraint = Sketcher::Constraint(); |
| |
|
| | |
| | constraint.First = 23; |
| | constraint.FirstPos = Sketcher::PointPos::start; |
| | constraint.Second = 34; |
| | constraint.SecondPos = Sketcher::PointPos::end; |
| | constraint.Third = 45; |
| | constraint.ThirdPos = Sketcher::PointPos::mid; |
| |
|
| | |
| | EXPECT_EQ( |
| | constraint.getElement(0), |
| | Sketcher::GeoElementId(Sketcher::GeoElementId(23, Sketcher::PointPos::start)) |
| | ); |
| | EXPECT_EQ( |
| | constraint.getElement(1), |
| | Sketcher::GeoElementId(Sketcher::GeoElementId(34, Sketcher::PointPos::end)) |
| | ); |
| | EXPECT_EQ( |
| | constraint.getElement(2), |
| | Sketcher::GeoElementId(Sketcher::GeoElementId(45, Sketcher::PointPos::mid)) |
| | ); |
| | } |
| |
|
| | TEST_F(ConstraintPointsAccess, testNewWriteIsReadByOld) |
| | { |
| | |
| | auto constraint = Sketcher::Constraint(); |
| |
|
| | |
| | constraint.setElement(0, Sketcher::GeoElementId(23, Sketcher::PointPos::start)); |
| | constraint.setElement(1, Sketcher::GeoElementId(34, Sketcher::PointPos::end)); |
| | constraint.setElement(2, Sketcher::GeoElementId(45, Sketcher::PointPos::mid)); |
| |
|
| | |
| | EXPECT_EQ(constraint.First, 23); |
| | EXPECT_EQ(constraint.FirstPos, Sketcher::PointPos::start); |
| | EXPECT_EQ(constraint.Second, 34); |
| | EXPECT_EQ(constraint.SecondPos, Sketcher::PointPos::end); |
| | EXPECT_EQ(constraint.Third, 45); |
| | EXPECT_EQ(constraint.ThirdPos, Sketcher::PointPos::mid); |
| | } |
| | #endif |
| |
|
| | TEST_F(ConstraintPointsAccess, testThreeElementsByDefault) |
| | { |
| | |
| | auto constraint = Sketcher::Constraint(); |
| |
|
| | |
| |
|
| | |
| | EXPECT_EQ(constraint.getElementsSize(), 3); |
| | } |
| |
|
| | TEST_F(ConstraintPointsAccess, testFourElementsWhenAddingOne) |
| | { |
| | |
| | auto constraint = Sketcher::Constraint(); |
| |
|
| | |
| | constraint.addElement(Sketcher::GeoElementId(1, Sketcher::PointPos::start)); |
| |
|
| | |
| | EXPECT_EQ(constraint.getElementsSize(), 4); |
| | } |
| |
|
| | #if SKETCHER_CONSTRAINT_USE_LEGACY_ELEMENTS |
| | TEST_F(ConstraintPointsAccess, testElementSerializationWhenAccessingOldWay) |
| | { |
| | |
| | auto constraint = Sketcher::Constraint(); |
| |
|
| | |
| | constraint.First = 23; |
| | constraint.FirstPos = Sketcher::PointPos::start; |
| | constraint.Second = 34; |
| | constraint.SecondPos = Sketcher::PointPos::end; |
| | constraint.Third = 45; |
| | constraint.ThirdPos = Sketcher::PointPos::mid; |
| |
|
| | Base::StringWriter writer = {}; |
| | constraint.Save(writer); |
| |
|
| | |
| | std::string serialized = writer.getString(); |
| | EXPECT_TRUE(serialized.find("First=\"23\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("FirstPos=\"1\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("Second=\"34\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("SecondPos=\"2\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("Third=\"45\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("ThirdPos=\"3\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("ElementIds=\"23 34 45\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("ElementPositions=\"1 2 3\"") != std::string::npos); |
| | } |
| | #endif |
| |
|
| | TEST_F(ConstraintPointsAccess, testElementSerializationWhenAccessingNewWay) |
| | { |
| | |
| | auto constraint = Sketcher::Constraint(); |
| |
|
| | |
| | constraint.setElement(0, Sketcher::GeoElementId(23, Sketcher::PointPos::start)); |
| | constraint.setElement(1, Sketcher::GeoElementId(34, Sketcher::PointPos::end)); |
| | constraint.setElement(2, Sketcher::GeoElementId(45, Sketcher::PointPos::mid)); |
| |
|
| | Base::StringWriter writer = {}; |
| | constraint.Save(writer); |
| |
|
| | |
| | std::string serialized = writer.getString(); |
| | EXPECT_TRUE(serialized.find("First=\"23\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("FirstPos=\"1\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("Second=\"34\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("SecondPos=\"2\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("Third=\"45\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("ThirdPos=\"3\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("ElementIds=\"23 34 45\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("ElementPositions=\"1 2 3\"") != std::string::npos); |
| | } |
| |
|
| | #if SKETCHER_CONSTRAINT_USE_LEGACY_ELEMENTS |
| | TEST_F(ConstraintPointsAccess, testElementSerializationWhenMixingOldAndNew) |
| | { |
| | |
| | auto constraint = Sketcher::Constraint(); |
| |
|
| | |
| | constraint.setElement(0, Sketcher::GeoElementId(23, Sketcher::PointPos::start)); |
| | constraint.setElement(1, Sketcher::GeoElementId(34, Sketcher::PointPos::end)); |
| | constraint.Second = 45; |
| | constraint.SecondPos = Sketcher::PointPos::mid; |
| |
|
| | Base::StringWriter writer = {}; |
| | constraint.Save(writer); |
| |
|
| | |
| | std::string serialized = writer.getString(); |
| | EXPECT_TRUE(serialized.find("First=\"23\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("FirstPos=\"1\"") != std::string::npos); |
| |
|
| | |
| | |
| | EXPECT_EQ(Sketcher::PointPos::mid, static_cast<Sketcher::PointPos>(3)); |
| | EXPECT_TRUE(serialized.find("SecondPos=\"3\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("Second=\"45\"") != std::string::npos); |
| |
|
| | EXPECT_TRUE(serialized.find("Third=\"-2000\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("ThirdPos=\"0\"") != std::string::npos); |
| |
|
| | |
| | EXPECT_TRUE(serialized.find("ElementIds=\"23 45 -2000\"") != std::string::npos); |
| | EXPECT_TRUE(serialized.find("ElementPositions=\"1 3 0\"") != std::string::npos); |
| | } |
| | #endif |
| |
|
| | TEST_F(ConstraintPointsAccess, testElementsRestoredFromSerialization) |
| | { |
| | |
| | Sketcher::Constraint constraint; |
| | constraint.setElement(0, Sketcher::GeoElementId(23, Sketcher::PointPos::start)); |
| | constraint.setElement(1, Sketcher::GeoElementId(34, Sketcher::PointPos::end)); |
| | constraint.setElement(2, Sketcher::GeoElementId(45, Sketcher::PointPos::mid)); |
| |
|
| | Base::StringWriter writer; |
| | writer.Stream() << "<root>\n"; |
| | constraint.Save(writer); |
| | writer.Stream() << "</root>"; |
| |
|
| | |
| | QTemporaryFile tempFile; |
| | tempFile.setAutoRemove(true); |
| | ASSERT_TRUE(tempFile.open()); |
| | tempFile.write(writer.getString().c_str(), writer.getString().size()); |
| | tempFile.flush(); |
| |
|
| | |
| | std::string filename = tempFile.fileName().toStdString(); |
| | std::ifstream inputFile(filename); |
| | ASSERT_TRUE(inputFile.is_open()); |
| |
|
| | Base::XMLReader reader(tempFile.fileName().toStdString().c_str(), inputFile); |
| | Sketcher::Constraint restoredConstraint; |
| | restoredConstraint.Restore(reader); |
| |
|
| | |
| | EXPECT_EQ(restoredConstraint.getElement(0), Sketcher::GeoElementId(23, Sketcher::PointPos::start)); |
| | EXPECT_EQ(restoredConstraint.getElement(1), Sketcher::GeoElementId(34, Sketcher::PointPos::end)); |
| | EXPECT_EQ(restoredConstraint.getElement(2), Sketcher::GeoElementId(45, Sketcher::PointPos::mid)); |
| |
|
| | inputFile.close(); |
| | } |
| |
|
| | TEST_F( |
| | ConstraintPointsAccess, |
| | testElementsRestoredFromSerializationWithoutNewElementStorage |
| | ) |
| | { |
| | |
| |
|
| | |
| | |
| | std::string serializedConstraint = fmt::format( |
| | "<Constrain " |
| | R"(Name="" )" |
| | R"(Type="0" )" |
| | R"(Value="0" )" |
| | R"(LabelDistance="10" )" |
| | R"(LabelPosition="0" )" |
| | R"(IsDriving="1" )" |
| | R"(IsInVirtualSpace="0" )" |
| | R"(IsActive="1" )" |
| |
|
| | R"(First="{}" )" |
| | R"(Second="{}" )" |
| | R"(Third="{}" )" |
| | R"(FirstPos="{}" )" |
| | R"(SecondPos="{}" )" |
| | R"(ThirdPos="{}" )" |
| |
|
| | "/>", |
| |
|
| | 67, |
| | 78, |
| | 89, |
| | static_cast<int>(Sketcher::PointPos::mid), |
| | static_cast<int>(Sketcher::PointPos::start), |
| | static_cast<int>(Sketcher::PointPos::end) |
| | ); |
| |
|
| | Base::StringWriter writer; |
| | auto& stream {writer.Stream()}; |
| | stream << "<root>\n"; |
| | stream << serializedConstraint; |
| | stream << "</root>"; |
| |
|
| | |
| | QTemporaryFile tempFile; |
| | tempFile.setAutoRemove(true); |
| | ASSERT_TRUE(tempFile.open()); |
| | tempFile.write(writer.getString().c_str(), writer.getString().size()); |
| | tempFile.flush(); |
| |
|
| | |
| | std::string filename = tempFile.fileName().toStdString(); |
| | std::ifstream inputFile(filename); |
| | ASSERT_TRUE(inputFile.is_open()); |
| |
|
| | Base::XMLReader reader(tempFile.fileName().toStdString().c_str(), inputFile); |
| | Sketcher::Constraint restoredConstraint; |
| | restoredConstraint.Restore(reader); |
| |
|
| | |
| | EXPECT_EQ(restoredConstraint.getElement(0), Sketcher::GeoElementId(67, Sketcher::PointPos::mid)); |
| | EXPECT_EQ(restoredConstraint.getElement(1), Sketcher::GeoElementId(78, Sketcher::PointPos::start)); |
| | EXPECT_EQ(restoredConstraint.getElement(2), Sketcher::GeoElementId(89, Sketcher::PointPos::end)); |
| |
|
| | inputFile.close(); |
| | } |
| |
|
| | TEST_F( |
| | ConstraintPointsAccess, |
| | testLegacyIsPreferedDuringSerializationWithoutLegacyElementStorage |
| | ) |
| | { |
| | |
| |
|
| | |
| | |
| | std::string serializedConstraint = fmt::format( |
| | "<Constrain " |
| | R"(Name="" )" |
| | R"(Type="0" )" |
| | R"(Value="0" )" |
| | R"(LabelDistance="10" )" |
| | R"(LabelPosition="0" )" |
| | R"(IsDriving="1" )" |
| | R"(IsInVirtualSpace="0" )" |
| | R"(IsActive="1" )" |
| |
|
| | |
| | R"(ElementIds="{} {} {}" )" |
| | R"(ElementPositions="{} {} {}" )" |
| |
|
| | "/>", |
| | |
| | 23, |
| | 34, |
| | 45, |
| | static_cast<int>(Sketcher::PointPos::start), |
| | static_cast<int>(Sketcher::PointPos::end), |
| | static_cast<int>(Sketcher::PointPos::mid) |
| | ); |
| |
|
| | Base::StringWriter writer; |
| | auto& stream {writer.Stream()}; |
| | stream << "<root>\n"; |
| | stream << serializedConstraint; |
| | stream << "</root>"; |
| |
|
| | |
| | QTemporaryFile tempFile; |
| | tempFile.setAutoRemove(true); |
| | ASSERT_TRUE(tempFile.open()); |
| | tempFile.write(writer.getString().c_str(), writer.getString().size()); |
| | tempFile.flush(); |
| |
|
| | |
| | std::string filename = tempFile.fileName().toStdString(); |
| | std::ifstream inputFile(filename); |
| | ASSERT_TRUE(inputFile.is_open()); |
| |
|
| | Base::XMLReader reader(tempFile.fileName().toStdString().c_str(), inputFile); |
| | Sketcher::Constraint restoredConstraint; |
| | restoredConstraint.Restore(reader); |
| |
|
| | |
| | EXPECT_EQ(restoredConstraint.getElement(0), Sketcher::GeoElementId(23, Sketcher::PointPos::start)); |
| | EXPECT_EQ(restoredConstraint.getElement(1), Sketcher::GeoElementId(34, Sketcher::PointPos::end)); |
| | EXPECT_EQ(restoredConstraint.getElement(2), Sketcher::GeoElementId(45, Sketcher::PointPos::mid)); |
| |
|
| | inputFile.close(); |
| | } |
| |
|
| | TEST_F(ConstraintPointsAccess, testLegacyIsPreferedDuringSerializationIfContradicting) |
| | { |
| | |
| |
|
| | |
| | |
| | std::string serializedConstraint = fmt::format( |
| | "<Constrain " |
| | R"(Name="" )" |
| | R"(Type="0" )" |
| | R"(Value="0" )" |
| | R"(LabelDistance="10" )" |
| | R"(LabelPosition="0" )" |
| | R"(IsDriving="1" )" |
| | R"(IsInVirtualSpace="0" )" |
| | R"(IsActive="1" )" |
| |
|
| | |
| | R"(ElementIds="{} {} {}" )" |
| | R"(ElementPositions="{} {} {}" )" |
| |
|
| | |
| | R"(First="{}" )" |
| | R"(Second="{}" )" |
| | R"(Third="{}" )" |
| | R"(FirstPos="{}" )" |
| | R"(SecondPos="{}" )" |
| | R"(ThirdPos="{}" )" |
| |
|
| | "/>", |
| | |
| | 23, |
| | 34, |
| | 45, |
| | static_cast<int>(Sketcher::PointPos::start), |
| | static_cast<int>(Sketcher::PointPos::end), |
| | static_cast<int>(Sketcher::PointPos::mid), |
| |
|
| | |
| | 67, |
| | 78, |
| | 89, |
| | static_cast<int>(Sketcher::PointPos::mid), |
| | static_cast<int>(Sketcher::PointPos::start), |
| | static_cast<int>(Sketcher::PointPos::end) |
| | ); |
| |
|
| | Base::StringWriter writer; |
| | auto& stream {writer.Stream()}; |
| | stream << "<root>\n"; |
| | stream << serializedConstraint; |
| | stream << "</root>"; |
| |
|
| | |
| | QTemporaryFile tempFile; |
| | tempFile.setAutoRemove(true); |
| | ASSERT_TRUE(tempFile.open()); |
| | tempFile.write(writer.getString().c_str(), writer.getString().size()); |
| | tempFile.flush(); |
| |
|
| | |
| | std::string filename = tempFile.fileName().toStdString(); |
| | std::ifstream inputFile(filename); |
| | ASSERT_TRUE(inputFile.is_open()); |
| |
|
| | Base::XMLReader reader(tempFile.fileName().toStdString().c_str(), inputFile); |
| | Sketcher::Constraint restoredConstraint; |
| | restoredConstraint.Restore(reader); |
| |
|
| | |
| | EXPECT_EQ(restoredConstraint.getElement(0), Sketcher::GeoElementId(67, Sketcher::PointPos::mid)); |
| | EXPECT_EQ(restoredConstraint.getElement(1), Sketcher::GeoElementId(78, Sketcher::PointPos::start)); |
| | EXPECT_EQ(restoredConstraint.getElement(2), Sketcher::GeoElementId(89, Sketcher::PointPos::end)); |
| |
|
| | inputFile.close(); |
| | } |
| |
|
| | TEST_F(ConstraintPointsAccess, testSubstituteIndex) |
| | { |
| | |
| | Sketcher::Constraint constraint; |
| | constraint.setElement(0, Sketcher::GeoElementId(10, Sketcher::PointPos::start)); |
| | constraint.setElement(1, Sketcher::GeoElementId(20, Sketcher::PointPos::end)); |
| | constraint.setElement(2, Sketcher::GeoElementId(10, Sketcher::PointPos::mid)); |
| |
|
| | |
| | constraint.substituteIndex(10, 99); |
| |
|
| | |
| | EXPECT_EQ(constraint.getElement(0), Sketcher::GeoElementId(99, Sketcher::PointPos::start)); |
| | EXPECT_EQ(constraint.getElement(1), Sketcher::GeoElementId(20, Sketcher::PointPos::end)); |
| | EXPECT_EQ(constraint.getElement(2), Sketcher::GeoElementId(99, Sketcher::PointPos::mid)); |
| | } |
| |
|
| | TEST_F(ConstraintPointsAccess, testSubstituteIndexAndPos) |
| | { |
| | |
| | Sketcher::Constraint constraint; |
| | constraint.setElement(0, Sketcher::GeoElementId(10, Sketcher::PointPos::start)); |
| | constraint.setElement(1, Sketcher::GeoElementId(20, Sketcher::PointPos::start)); |
| | constraint.setElement(2, Sketcher::GeoElementId(10, Sketcher::PointPos::mid)); |
| |
|
| | |
| | constraint.substituteIndexAndPos(10, Sketcher::PointPos::start, 42, Sketcher::PointPos::end); |
| |
|
| | |
| | EXPECT_EQ(constraint.getElement(0), Sketcher::GeoElementId(42, Sketcher::PointPos::end)); |
| | EXPECT_EQ(constraint.getElement(1), Sketcher::GeoElementId(20, Sketcher::PointPos::start)); |
| | EXPECT_EQ(constraint.getElement(2), Sketcher::GeoElementId(10, Sketcher::PointPos::mid)); |
| | } |
| |
|
| | TEST_F(ConstraintPointsAccess, testInvolvesGeoId) |
| | { |
| | |
| | Sketcher::Constraint constraint; |
| | constraint.setElement(0, Sketcher::GeoElementId(10, Sketcher::PointPos::start)); |
| | constraint.setElement(1, Sketcher::GeoElementId(20, Sketcher::PointPos::end)); |
| |
|
| | |
| | EXPECT_TRUE(constraint.involvesGeoId(10)); |
| | EXPECT_TRUE(constraint.involvesGeoId(20)); |
| | EXPECT_FALSE(constraint.involvesGeoId(99)); |
| | } |
| |
|
| | TEST_F(ConstraintPointsAccess, testInvolvesGeoIdAndPosId) |
| | { |
| | |
| | Sketcher::Constraint constraint; |
| | constraint.setElement(0, Sketcher::GeoElementId(10, Sketcher::PointPos::start)); |
| | constraint.setElement(1, Sketcher::GeoElementId(20, Sketcher::PointPos::mid)); |
| | constraint.setElement(2, Sketcher::GeoElementId(30, Sketcher::PointPos::end)); |
| |
|
| | |
| | EXPECT_TRUE(constraint.involvesGeoIdAndPosId(10, Sketcher::PointPos::start)); |
| | EXPECT_TRUE(constraint.involvesGeoIdAndPosId(20, Sketcher::PointPos::mid)); |
| | EXPECT_FALSE(constraint.involvesGeoIdAndPosId(20, Sketcher::PointPos::start)); |
| | EXPECT_FALSE(constraint.involvesGeoIdAndPosId(99, Sketcher::PointPos::end)); |
| | } |
| |
|
| | #if SKETCHER_CONSTRAINT_USE_LEGACY_ELEMENTS |
| | TEST_F(ConstraintPointsAccess, testLegacyWriteReflectedInInvolvesAndSubstitute) |
| | { |
| | |
| | Sketcher::Constraint constraint; |
| | constraint.First = 10; |
| | constraint.FirstPos = Sketcher::PointPos::start; |
| | constraint.Second = 20; |
| | constraint.SecondPos = Sketcher::PointPos::end; |
| |
|
| | |
| | EXPECT_TRUE(constraint.involvesGeoId(10)); |
| | EXPECT_TRUE(constraint.involvesGeoIdAndPosId(20, Sketcher::PointPos::end)); |
| |
|
| | |
| | constraint.substituteIndex(10, 99); |
| |
|
| | |
| | EXPECT_TRUE(constraint.involvesGeoId(99)); |
| | EXPECT_FALSE(constraint.involvesGeoId(10)); |
| | } |
| |
|
| | TEST_F(ConstraintPointsAccess, testSubstituteUpdatesLegacyFieldsToo) |
| | { |
| | |
| | Sketcher::Constraint constraint; |
| | constraint.setElement(0, Sketcher::GeoElementId(10, Sketcher::PointPos::start)); |
| |
|
| | |
| | constraint.substituteIndex(10, 42); |
| |
|
| | |
| | EXPECT_EQ(constraint.getElement(0), Sketcher::GeoElementId(42, Sketcher::PointPos::start)); |
| | EXPECT_EQ(constraint.First, 42); |
| | EXPECT_EQ(constraint.FirstPos, Sketcher::PointPos::start); |
| | } |
| | #endif |
| |
|