Add tests for axis letter
This commit is contained in:
parent
5cb7a8efb7
commit
255a32663e
24
test/axis_letter.jl
Normal file
24
test/axis_letter.jl
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
@testset "axis letter" begin
|
||||
using Plots, RecipesBase
|
||||
# a custom type for dispacthing the axis-letter-testing recipe
|
||||
struct MyType <: Number
|
||||
val::Float64
|
||||
end
|
||||
value(m::MyType) = m.val
|
||||
data = MyType.(sort(randn(20)))
|
||||
# A recipe that puts the axis letter in the title
|
||||
@recipe function f(::Type{T}, m::T) where T <: AbstractArray{<:MyType}
|
||||
title --> string(plotattributes[:letter])
|
||||
value.(m)
|
||||
end
|
||||
@testset "$f (orientation = $o)" for f in [histogram, barhist, stephist, scatterhist], o in [:vertical, :horizontal]
|
||||
@test f(data, orientation=o).subplots[1].attr[:title] == (o == :vertical ? "x" : "y")
|
||||
end
|
||||
@testset "$f" for f in [hline, hspan]
|
||||
@test f(data).subplots[1].attr[:title] == "y"
|
||||
end
|
||||
@testset "$f" for f in [vline, vspan]
|
||||
@test f(data).subplots[1].attr[:title] == "x"
|
||||
end
|
||||
end
|
||||
@ -9,8 +9,10 @@ using Gtk
|
||||
using LibGit2
|
||||
import GeometryTypes, GeometryBasics
|
||||
using Dates
|
||||
using RecipesBase
|
||||
|
||||
include("test_axes.jl")
|
||||
include("axis_letter.jl")
|
||||
include("test_recipes.jl")
|
||||
include("test_hdf5plots.jl")
|
||||
include("test_pgfplotsx.jl")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user