From 0faa169cf42090a56adebc0277c939c10e5c577f Mon Sep 17 00:00:00 2001 From: ffreyer Date: Sat, 14 Dec 2024 00:59:25 +0100 Subject: [PATCH] fix test variations --- ReferenceTests/src/tests/primitives.jl | 64 +++++++++++++++----------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/ReferenceTests/src/tests/primitives.jl b/ReferenceTests/src/tests/primitives.jl index 2662ecdf059..ddae6dc6b0c 100644 --- a/ReferenceTests/src/tests/primitives.jl +++ b/ReferenceTests/src/tests/primitives.jl @@ -225,36 +225,46 @@ end s end -# Circle and Rect have different paths in CairoMakie -for (marker, name) in zip( - ['L', Rect, Circle, :utriangle, Makie.FileIO.load(Makie.assetpath("cow.png"))], - ["Char", "Rect", "Circle", "BezierPath", "image"]) - - @reference_test "scatter Billboard and transform_marker for $name markers" begin - r = Rect3f(Point3f(-0.5), Vec3f(1)) - ps = coordinates(r) - phis = collect(range(0, 2pi, length = 8)) - quats = Makie.to_rotation(phis) - - fig = Figure(size = (500, 800)) - for (k, transform_marker) in zip(0:1, [true, false]) - for (i, space, ms) in zip(1:2, [:data, :pixel], [1, 30]) - for (j, rot, lbl) in zip(1:3, [Billboard(phis), phis, quats], ["Billboard", "angles", "Quaternion"]) - Label(fig[i+2k, j][1,1], "$space | $lbl | $transform_marker", tellwidth = false) - a, p = scatter(fig[i+2k, j][2,1], ps, marker = marker, - strokewidth = 2, strokecolor = :black, color = :yellow, - markersize = ms, markerspace = space, rotation = rot, - transform_marker = transform_marker) - - Makie.rotate!(p, Vec3f(1, 0.5, 0.1), 1.0) - a.scene.camera_controls.settings[:center] = false - Makie.update_cam!(a.scene, r) - end +function make_billboard_rotations_test_fig(marker) + r = Rect3f(Point3f(-0.5), Vec3f(1)) + ps = coordinates(r) + phis = collect(range(0, 2pi, length = 8)) + quats = Makie.to_rotation(phis) + + fig = Figure(size = (500, 800)) + for (k, transform_marker) in zip(0:1, [true, false]) + for (i, space, ms) in zip(1:2, [:data, :pixel], [1, 30]) + for (j, rot, lbl) in zip(1:3, [Billboard(phis), phis, quats], ["Billboard", "angles", "Quaternion"]) + Label(fig[i+2k, j][1,1], "$space | $lbl | $transform_marker", tellwidth = false) + a, p = scatter(fig[i+2k, j][2,1], ps, marker = marker, + strokewidth = 2, strokecolor = :black, color = :yellow, + markersize = ms, markerspace = space, rotation = rot, + transform_marker = transform_marker) + + Makie.rotate!(p, Vec3f(1, 0.5, 0.1), 1.0) + a.scene.camera_controls.settings[:center] = false + Makie.update_cam!(a.scene, r) end end - - fig end + + fig +end + +@reference_test "scatter Billboard and transform_marker for Char markers" begin + make_billboard_rotations_test_fig('L') +end +@reference_test "scatter Billboard and transform_marker for Rect markers" begin + make_billboard_rotations_test_fig(Rect) +end +@reference_test "scatter Billboard and transform_marker for Circle markers" begin + make_billboard_rotations_test_fig(Circle) +end +@reference_test "scatter Billboard and transform_marker for BezierPath markers" begin + make_billboard_rotations_test_fig(:utriangle) +end +@reference_test "scatter Billboard and transform_marker for image markers" begin + make_billboard_rotations_test_fig(Makie.FileIO.load(Makie.assetpath("cow.png"))) end @reference_test "scatter with stroke" begin