z-axis checks; compare function

This commit is contained in:
BerndR 2021-09-17 16:05:43 +02:00
parent ae207dc476
commit a4b339bad1

View File

@ -90,28 +90,31 @@ end
end
@testset "aliases" begin
p = plot(1:2, guide = "both labels")
@test p[1][:xaxis][:guide] === p[1][:yaxis][:guide] === "both labels"
compare(p::Plots.Plot, s::Symbol, val, op::Symbol) =
eval(Expr(:comparison, Meta.quot(p[1][:xaxis][s]), op, Meta.quot(p[1][:yaxis][s]), op, Meta.quot(p[1][:zaxis][s]), op, Meta.quot(val)))
p = plot(1:2, guide = "all labels")
@test compare(p, :guide, "all labels", :(===))
p = plot(1:2, label = "test")
@test p[1][:xaxis][:guide] === p[1][:yaxis][:guide] === ""
@test compare(p, :guide, "", :(===))
p = plot(1:2, lim = (0, 3))
@test xlims(p) === ylims(p) === (0,3)
@test xlims(p) === ylims(p) === zlims(p) === (0,3)
p = plot(1:2, tick = [1.25, 1.5, 1.75])
@test p[1][:xaxis][:ticks] == p[1][:yaxis][:ticks] == [1.25, 1.5, 1.75]
@test compare(p,:ticks,[1.25, 1.5, 1.75], :(==))
p = plot(1:2, labelfontsize = 4)
@test p[1][:xaxis][:guidefontsize] == p[1][:yaxis][:guidefontsize] == 4
@test compare(p,:guidefontsize,4, :(==))
p = plot(1:2, gα = .07)
@test p[1][:xaxis][:gridalpha] p[1][:yaxis][:gridalpha] .07
@test compare(p,:gridalpha,.07, :())
p = plot(1:2, gridls = :dashdot)
@test p[1][:xaxis][:gridstyle] === p[1][:yaxis][:gridstyle] === :dashdot
@test compare(p,:gridstyle,:dashdot, :(===))
p = plot(1:2, gridcolor = :red)
@test p[1][:xaxis][:foreground_color_grid] === p[1][:yaxis][:foreground_color_grid] === RGBA{Float64}(1.,0.,0.,1.)
@test compare(p,:foreground_color_grid,RGBA{Float64}(1.,0.,0.,1.), :(===))
p = plot(1:2, minorgridcolor = :red)
@test p[1][:xaxis][:foreground_color_minor_grid] === p[1][:yaxis][:foreground_color_minor_grid] === RGBA{Float64}(1.,0.,0.,1.)
@test compare(p,:foreground_color_minor_grid,RGBA{Float64}(1.,0.,0.,1.), :(===))
p = plot(1:2, grid_lw = .01)
@test p[1][:xaxis][:gridlinewidth] p[1][:yaxis][:gridlinewidth] .01
@test compare(p,:gridlinewidth,.01, :())
p = plot(1:2, minorgrid_lw = .01)
@test p[1][:xaxis][:minorgridlinewidth] p[1][:yaxis][:minorgridlinewidth] .01
@test compare(p,:minorgridlinewidth,.01, :())
p = plot(1:2, tickor = :out)
@test p[1][:xaxis][:tick_direction] === p[1][:yaxis][:tick_direction] === :out
@test compare(p,:tick_direction,:out, :(===))
end