From 0dcbc1188e8ea78e8a3005eb0ce82f435b4f4670 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Mon, 15 Jul 2024 16:58:19 -0400 Subject: [PATCH 1/5] resolve CairoMakie insert! ambiguity --- CairoMakie/src/screen.jl | 1 + CairoMakie/test/runtests.jl | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CairoMakie/src/screen.jl b/CairoMakie/src/screen.jl index d9d23959c6d..53141f7eabc 100644 --- a/CairoMakie/src/screen.jl +++ b/CairoMakie/src/screen.jl @@ -204,6 +204,7 @@ Base.size(screen::Screen) = round.(Int, (screen.surface.width, screen.surface.he # we render the scene directly, since we have # no screen dependent state like in e.g. opengl Base.insert!(screen::Screen, scene::Scene, plot) = nothing +Base.insert!(screen::Screen, scene::Scene, plot::Plot{plotlist}) = nothing function Base.delete!(screen::Screen, scene::Scene, plot::AbstractPlot) # Currently, we rerender every time, so nothing needs # to happen here. However, in the event that changes, diff --git a/CairoMakie/test/runtests.jl b/CairoMakie/test/runtests.jl index dd0c200495a..3cb6145bcc5 100644 --- a/CairoMakie/test/runtests.jl +++ b/CairoMakie/test/runtests.jl @@ -134,6 +134,11 @@ end rm("test.mp4") end +@testset "plotlist no ambiguity" begin + plotlist([Makie.SpecApi.Scatter(1:10)]) + plotlist!([Makie.SpecApi.Scatter(1:10)]) +end + excludes = Set([ "Colored Mesh", From 4dc2acc05fb2432fb01ff8c4e6c20068cf85bd07 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Tue, 16 Jul 2024 09:11:52 +0530 Subject: [PATCH 2/5] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 958c9d22511..601ad136683 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] - Correct a bug in the `project` function when projecting using a `Scene`. [#3909](https://github.com/MakieOrg/Makie.jl/pull/3909). +- Correct a method ambiguity in `insert!` which was causing `PlotList` to fail on CairoMakie. [#4038](https://github.com/MakieOrg/Makie.jl/pull/4038) ## [0.21.5] - 2024-07-07 From d1d5a468a3887e0d3a952cf1ce56b806da926e5f Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Tue, 16 Jul 2024 06:08:52 -0400 Subject: [PATCH 3/5] xxx: test should error --- CairoMakie/src/screen.jl | 2 +- CairoMakie/test/runtests.jl | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CairoMakie/src/screen.jl b/CairoMakie/src/screen.jl index 53141f7eabc..1d26657836d 100644 --- a/CairoMakie/src/screen.jl +++ b/CairoMakie/src/screen.jl @@ -204,7 +204,7 @@ Base.size(screen::Screen) = round.(Int, (screen.surface.width, screen.surface.he # we render the scene directly, since we have # no screen dependent state like in e.g. opengl Base.insert!(screen::Screen, scene::Scene, plot) = nothing -Base.insert!(screen::Screen, scene::Scene, plot::Plot{plotlist}) = nothing +# Base.insert!(screen::Screen, scene::Scene, plot::Plot{plotlist}) = nothing function Base.delete!(screen::Screen, scene::Scene, plot::AbstractPlot) # Currently, we rerender every time, so nothing needs # to happen here. However, in the event that changes, diff --git a/CairoMakie/test/runtests.jl b/CairoMakie/test/runtests.jl index 3cb6145bcc5..344c9009b2e 100644 --- a/CairoMakie/test/runtests.jl +++ b/CairoMakie/test/runtests.jl @@ -135,7 +135,8 @@ end end @testset "plotlist no ambiguity" begin - plotlist([Makie.SpecApi.Scatter(1:10)]) + f = plotlist([Makie.SpecApi.Scatter(1:10)]) + save("test.png", f) plotlist!([Makie.SpecApi.Scatter(1:10)]) end From 57603dbcee776290e803462b4c0ae7213b9414a7 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Tue, 16 Jul 2024 07:07:59 -0400 Subject: [PATCH 4/5] use colorbuffer() --- CairoMakie/test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CairoMakie/test/runtests.jl b/CairoMakie/test/runtests.jl index 344c9009b2e..88d2925bca6 100644 --- a/CairoMakie/test/runtests.jl +++ b/CairoMakie/test/runtests.jl @@ -136,7 +136,7 @@ end @testset "plotlist no ambiguity" begin f = plotlist([Makie.SpecApi.Scatter(1:10)]) - save("test.png", f) + Makie.colorbuffer(f; backend=CairoMakie) plotlist!([Makie.SpecApi.Scatter(1:10)]) end From f10495e5900e73049455e70467fa7f51590a83af Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Tue, 16 Jul 2024 07:53:18 -0400 Subject: [PATCH 5/5] upd following review --- CairoMakie/src/screen.jl | 3 ++- CairoMakie/test/runtests.jl | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CairoMakie/src/screen.jl b/CairoMakie/src/screen.jl index 1d26657836d..e24b488332a 100644 --- a/CairoMakie/src/screen.jl +++ b/CairoMakie/src/screen.jl @@ -204,7 +204,8 @@ Base.size(screen::Screen) = round.(Int, (screen.surface.width, screen.surface.he # we render the scene directly, since we have # no screen dependent state like in e.g. opengl Base.insert!(screen::Screen, scene::Scene, plot) = nothing -# Base.insert!(screen::Screen, scene::Scene, plot::Plot{plotlist}) = nothing +# to resolve method ambiguity, since this method is defined in Makie for MakieScreen and PlotList: +Base.insert!(screen::Screen, scene::Scene, plot::Plot{plotlist}) = nothing function Base.delete!(screen::Screen, scene::Scene, plot::AbstractPlot) # Currently, we rerender every time, so nothing needs # to happen here. However, in the event that changes, diff --git a/CairoMakie/test/runtests.jl b/CairoMakie/test/runtests.jl index 88d2925bca6..49158cdb546 100644 --- a/CairoMakie/test/runtests.jl +++ b/CairoMakie/test/runtests.jl @@ -134,7 +134,7 @@ end rm("test.mp4") end -@testset "plotlist no ambiguity" begin +@testset "plotlist no ambiguity (#4038)" begin f = plotlist([Makie.SpecApi.Scatter(1:10)]) Makie.colorbuffer(f; backend=CairoMakie) plotlist!([Makie.SpecApi.Scatter(1:10)])