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 30, 2024
1 parent a0ae88d commit 6954f49
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 @@ -572,6 +572,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 @@ -588,6 +590,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 6954f49

Please sign in to comment.