Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/2193.test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adding test for nurbs sketching
28 changes: 28 additions & 0 deletions tests/test_sketch.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
Slot,
SpurGear,
Triangle,
nurbs,
)

from .conftest import are_graphics_available
Expand Down Expand Up @@ -369,6 +370,33 @@ def test_sketch_nurbs():
assert not sketch.edges[0].contains_point(Point2D([5, 5]))


def test_sketch_nurbs_misc():
"""Test NURBS Sketch for code coverage"""
control_points = [
Point2D([0.0, 0.0]),
Point2D([1.0, 2.0]),
Point2D([2.0, 0.0]),
Point2D([3.0, 3.0]),
]
# Checking geomdl_nurbs_curve usage
nurbs_curve = nurbs.SketchNurbs.fit_curve_from_points(points=control_points, degree=3)
assert nurbs_curve.geomdl_nurbs_curve.ctrlpts[0][0] == 0.0
# Checking value error for degrees less than 1
with pytest.raises(
ValueError,
match="Degree must be at least 1",
):
nurbs.SketchNurbs.fit_curve_from_points(points=control_points, degree=0)
# Checking Force linear interpolation
control_points = [
Point2D([0.0, 0.0]),
Point2D([1.0, 1.0]),
]
nurbs_curve = nurbs.SketchNurbs.fit_curve_from_points(points=control_points)
assert nurbs_curve.control_points[0].x == 0.0
assert nurbs_curve.degree == 1


def test_sketch_triangle_face():
"""Test Triangle SketchFace sketching."""
# Create a Sketch instance
Expand Down
Loading