From 363f401474fe8ea4be1b74a488a111eab4bc7ca3 Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Mon, 12 Oct 2020 17:25:40 +0200 Subject: [PATCH] Fix loading of themes (#3057) * Fix loading of themes Fix #3053 Needs test * Create test_defaults.jl * Update runtests.jl * Update test_defaults.jl * Update test_defaults.jl * Update test_defaults.jl * Update test_defaults.jl * Update test_defaults.jl --- src/init.jl | 5 +++-- test/runtests.jl | 1 + test/test_defaults.jl | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 test/test_defaults.jl diff --git a/src/init.jl b/src/init.jl index 0c431963..efa41cd9 100644 --- a/src/init.jl +++ b/src/init.jl @@ -15,9 +15,10 @@ end function __init__() user_defaults = _plots_defaults() if haskey(user_defaults, :theme) - theme(pop!(user_defaults, :theme)) + theme(pop!(user_defaults, :theme); user_defaults...) + else + default(; user_defaults...) end - default(; user_defaults...) insert!(Base.Multimedia.displays, findlast(x -> x isa Base.TextDisplay || x isa REPL.REPLDisplay, Base.Multimedia.displays) + 1, PlotsDisplay()) diff --git a/test/runtests.jl b/test/runtests.jl index 4e4ba79c..4daff777 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -11,6 +11,7 @@ import GeometryTypes, GeometryBasics using Dates using RecipesBase +include("test_defaults.jl") include("test_axes.jl") include("test_axis_letter.jl") include("test_recipes.jl") diff --git a/test/test_defaults.jl b/test/test_defaults.jl new file mode 100644 index 00000000..96c0ac44 --- /dev/null +++ b/test/test_defaults.jl @@ -0,0 +1,11 @@ +using Plots, Test + +const PLOTS_DEFAULTS = Dict(:theme => :wong2) +Plots.__init__() + +@testset "Loading theme" begin + @test plot(1:5)[1][1][:seriescolor] == RGBA(colorant"black") +end + +empty!(PLOTS_DEFAULTS) +Plots.__init__()