Skip to content

Commit fadf1b0

Browse files
committed
Increase test coverage
1 parent 6f45eb2 commit fadf1b0

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

ext/VortexStepMethodControlPlotsExt.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function VortexStepMethod.save_plot(fig, save_path, title; data_type=".pdf")
7979
end
8080

8181
"""
82-
show_plot(fig; dpi=130)
82+
show_plot(fig::plt.Figure; dpi=130)
8383
8484
Display a plot at specified DPI.
8585
@@ -89,7 +89,8 @@ Display a plot at specified DPI.
8989
# Keyword arguments
9090
- `dpi`: Dots per inch for the figure (default: 130)
9191
"""
92-
function VortexStepMethod.show_plot(fig; dpi=130)
92+
function VortexStepMethod.show_plot(fig::plt.Figure; dpi=130)
93+
fig.set_dpi(dpi)
9394
plt.display(fig)
9495
end
9596

test/plotting/test_plotting.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
backend = if "plot-controlplots" in ARGS
22
using ControlPlots
3+
import ControlPlots: plt
34
"ControlPlots"
45
else
56
using CairoMakie
@@ -213,5 +214,19 @@ end
213214
else
214215
@test fig !== nothing
215216
end
217+
218+
if backend == "ControlPlots"
219+
fig_dpi = plt.figure()
220+
default_dpi = fig_dpi.get_dpi()
221+
@test default_dpi != 173
222+
223+
show_plot(fig_dpi; dpi=173)
224+
@test fig_dpi.get_dpi() == 173
225+
226+
# Also verify the default keyword value is applied.
227+
show_plot(fig_dpi)
228+
@test fig_dpi.get_dpi() == 130
229+
plt.close(fig_dpi)
230+
end
216231
end
217232
nothing

0 commit comments

Comments
 (0)