From c35adbfeff8c629ab832f9794be957ddaaec4142 Mon Sep 17 00:00:00 2001 From: Thatcher Chamberlin Date: Tue, 1 Dec 2020 18:34:25 -0500 Subject: [PATCH] Added tests for xlims with Date and DateTime types --- test/integration_dates.jl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/integration_dates.jl b/test/integration_dates.jl index 6a5756c7..7ff0af46 100644 --- a/test/integration_dates.jl +++ b/test/integration_dates.jl @@ -14,3 +14,29 @@ using Plots, Test, Dates @test Plots.ylims(p) == ref_ylims @test Plots.xlims(p) == ref_xlims end # testset + +@testset "Date xlims" begin + y=[1.0*i*i for i in 1:10] + x=[Date(2019,11,i) for i in 1:10] + span = (Date(2019,10,31), Date(2019,11,11)) + + p = plot(x,y, xlims=span, widen = false) + + ref_ylims = (y[1], y[end]) + ref_xlims = span + @test Plots.ylims(p) == ref_ylims + @test Plots.xlims(p) == ref_xlims +end # testset + +@testset "DateTime xlims" begin + y=[1.0*i*i for i in 1:10] + x=[Date(2019,11,i) for i in 1:10] + span = (DateTime(2019,10,31,11,59,59), DateTime(2019,11,11,12,01,15)) + + p = plot(x,y, xlims=span, widen = false) + + ref_ylims = (y[1], y[end]) + ref_xlims = span + @test Plots.ylims(p) == ref_ylims + @test Plots.xlims(p) == ref_xlims +end # testset