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
This commit is contained in:
Simon Christ 2020-10-12 17:25:40 +02:00 committed by GitHub
parent 2ef13c19ea
commit 363f401474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -15,9 +15,10 @@ end
function __init__() function __init__()
user_defaults = _plots_defaults() user_defaults = _plots_defaults()
if haskey(user_defaults, :theme) if haskey(user_defaults, :theme)
theme(pop!(user_defaults, :theme)) theme(pop!(user_defaults, :theme); user_defaults...)
else
default(; user_defaults...)
end end
default(; user_defaults...)
insert!(Base.Multimedia.displays, findlast(x -> x isa Base.TextDisplay || x isa REPL.REPLDisplay, Base.Multimedia.displays) + 1, PlotsDisplay()) insert!(Base.Multimedia.displays, findlast(x -> x isa Base.TextDisplay || x isa REPL.REPLDisplay, Base.Multimedia.displays) + 1, PlotsDisplay())

View File

@ -11,6 +11,7 @@ import GeometryTypes, GeometryBasics
using Dates using Dates
using RecipesBase using RecipesBase
include("test_defaults.jl")
include("test_axes.jl") include("test_axes.jl")
include("test_axis_letter.jl") include("test_axis_letter.jl")
include("test_recipes.jl") include("test_recipes.jl")

11
test/test_defaults.jl Normal file
View File

@ -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__()