Skip to content

Commit

Permalink
[Sketcher] add null case to constraint change on deletion checks
Browse files Browse the repository at this point in the history
  • Loading branch information
AjinkyaDahale committed Sep 23, 2024
1 parent 81c14cd commit 79803cd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/src/Mod/Sketcher/App/SketchObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ TEST_F(SketchObjectTest, testConstraintAfterDeletingGeo)
// Arrange
int geoId1 = 42, geoId2 = 10, geoId3 = 0, geoId4 = -8;

Sketcher::Constraint* nullConstr = nullptr;

Sketcher::Constraint constr1;
constr1.Type = Sketcher::ConstraintType::Coincident;
constr1.First = geoId1;
Expand All @@ -576,6 +578,18 @@ TEST_F(SketchObjectTest, testConstraintAfterDeletingGeo)
constr2.Third = geoId1;
constr2.ThirdPos = Sketcher::PointPos::start;

// Act
auto nullConstrAfter = getObject()->getConstraintAfterDeletingGeo(nullConstr, 5);

// Assert
EXPECT_EQ(nullConstrAfter, nullptr);

// Act
getObject()->changeConstraintAfterDeletingGeo(nullConstr, 5);

// Assert
EXPECT_EQ(nullConstr, nullptr);

// Act
// delete typical in-sketch geo
auto constr1PtrAfter1 = getObject()->getConstraintAfterDeletingGeo(&constr1, 5);
Expand Down

0 comments on commit 79803cd

Please sign in to comment.