Skip to content

Commit

Permalink
fix plot_draw tests
Browse files Browse the repository at this point in the history
Update test_plot_draw.py
  • Loading branch information
PointlessUser committed Aug 14, 2024
1 parent 79c468b commit d021ff4
Showing 1 changed file with 5 additions and 62 deletions.
67 changes: 5 additions & 62 deletions PyTests/test_plot_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def run_all_functions():
assert calculate_midpoint((0, 0), (1, 1)) == (0.5, 0.5)

# Draw an arc of a circumference
draw_arc(radius=0.5, start_angle=0, end_angle=np.pi / 2)
draw_semicircle(radius=0.5, start_angle=0, end_angle=np.pi / 2)

create_blank_canvas()

Expand All @@ -61,45 +61,8 @@ def run_all_functions():
draw_negative_x=True,
)

# Plot a segment in pixels
assert plot_line_segment(
(100, 200), (400, 500), label="Segment", min_spacing=20
) == (400, 500)

# plot annotation arrow
start = (100, 200)
angle = 45
length = 100
x, y = plot_annotate_arrow(start, angle, length, text="Arrow", degrees=True)
assert round(x, 2), round(y, 2) == (170.71, 270.71)

# Draw a custom arrow
draw_custom_arrow(
start=(200, 200),
end=(300, 300),
factor=0.5,
max_value=400,
arrow_vector_length=100,
arrow_width=10,
text="Custom Arrow",
)

# Calculate arrow endpoint in pixels
x, y = calculate_arrow_endpoint_pixels(
(100, 200), angle=45, length=50, degrees=True
)
assert (round(x, 2), round(y, 2)) == (135.36, 235.36)

# Plot a segment with properties
x, y = plot_segment((100, 200), 45, 50, text="Value", degrees=True)
assert (round(x, 2), round(y, 2)) == (135.36, 235.36)

# Plot a dashed segment
x, y = plot_segment_dashed((100, 200), 45, 50, text="Value", degrees=True)
assert (round(x, 2), round(y, 2)) == (135.36, 235.36)

# Draw a custom circle
draw_custom_circle((100, 100), radius=20, color="red")
draw_circle((100, 100), radius=20, color="red")

# Draw a rounded rectangle
draw_rounded_rectangle(4, 2, center=(0, 0), corner_radius=0.5, color="blue")
Expand All @@ -110,20 +73,8 @@ def run_all_functions():
)
assert intersection_point == (1.0, 0.9999999999999999)

# Draw a segment
draw_segment((0.2, 0.2), (0.8, 0.8))

x, y = plot_annotate_arrow_end(
(1, 1),
45,
1,
text="End",
text_offset=0.5,
fontsize=12,
text_align={"ha": "center", "va": "top"},
degrees=True,
)
assert round(x, 2), round(y, 2) == (10.90, 10.90)
# Draw a line
draw_line((0.2, 0.2), (0.8, 0.8))

# Draw three rotated axes
draw_three_axes_rotated(
Expand All @@ -138,9 +89,6 @@ def run_all_functions():
# Draw a double arrowhead
draw_double_arrowhead((0.1, 0.1), (0.4, 0.4))

# Draw custom arrow end
draw_custom_arrow_end((0.1, 0.1), (0.4, 0.4))

# Draw two axes
draw_two_axes(
arrow_length=0.4,
Expand All @@ -157,19 +105,14 @@ def run_all_functions():
)

# Horizontal arrow rain
draw_rain_arrows_horizontal(
horizontal_arrow_rain(
quantity_arrows=5, x_origin=0.5, start=(0.1, 0.1), end=(0.1, 0.9)
)

# Calculate angle between two points
angle = calculate_angle((0, 0), (1, 1), degrees=True)
assert angle == 45

# Draw segments in different colors
draw_segment_1((0.1, 0.1), (0.4, 0.4))
draw_segment_2((0.4, 0.4), (0.7, 0.7))
draw_segment_3((0.7, 0.7), (1.0, 1.0))

# Get arc points
x, y = get_arc_points(start_angle=0, end_angle=180, radius=0.5, center=(0.5, 0.5))
plt.plot(x, y, color="green")

0 comments on commit d021ff4

Please sign in to comment.