|
1 | | -using ManifoldsBase, GLMakie, Plots, Statistics, Test |
| 1 | +using ManifoldsBase, Plots, Statistics, Test |
2 | 2 | # don't show plots actually |
3 | 3 | default(; show = false, reuse = true) |
4 | 4 |
|
@@ -207,4 +207,38 @@ default(; show = false, reuse = true) |
207 | 207 | X2[2:4] .= 2.0 |
208 | 208 | @test_throws ErrorException check_geodesic(M, q, X2; error = :error) |
209 | 209 | end |
| 210 | + # Now load CairoMakie – default is Makie so we test the slope and geodesic again |
| 211 | + using CairoMakie |
| 212 | + @testset "Test retract checks" begin |
| 213 | + M = ManifoldsBase.Test.TestSphere(10) |
| 214 | + q = zeros(11) |
| 215 | + q[1] = 1.0 |
| 216 | + p = zeros(11) |
| 217 | + p[1:4] .= 1 / sqrt(4) |
| 218 | + X = log(M, p, q) |
| 219 | + # One call with generating a plot |
| 220 | + f = check_retraction(M, ProjectionRetraction(), p, X; limits = (-2.5, 0.0), plot = true) |
| 221 | + @test f isa Figure |
| 222 | + # One call with generating a plot |
| 223 | + f2 = check_geodesic(M, p, X; plot = true) |
| 224 | + @test f2 isa CairoMakie.Figure |
| 225 | + end |
| 226 | + @testset "get/set plotting backend and that it actually switches back to Plots.jl" begin |
| 227 | + ManifoldsBase.set_plotting_backend!("Plots") |
| 228 | + @test ManifoldsBase.get_plotting_backend() == "Plots" |
| 229 | + |
| 230 | + M = ManifoldsBase.Test.TestSphere(10) |
| 231 | + q = zeros(11) |
| 232 | + q[1] = 1.0 |
| 233 | + p = zeros(11) |
| 234 | + p[1:4] .= 1 / sqrt(4) |
| 235 | + X = log(M, p, q) |
| 236 | + # One call with generating a plot |
| 237 | + f = check_retraction(M, ProjectionRetraction(), p, X; limits = (-2.5, 0.0), plot = true) |
| 238 | + @test f isa Plots.Plot |
| 239 | + # and back |
| 240 | + ManifoldsBase.set_plotting_backend!("Makie") |
| 241 | + f2 = check_retraction(M, ProjectionRetraction(), p, X; limits = (-2.5, 0.0), plot = true) |
| 242 | + @test f2 isa CairoMakie.Figure |
| 243 | + end |
210 | 244 | end |
0 commit comments