Skip to content

Commit

Permalink
high-level plotting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emmaccode authored May 11, 2024
1 parent 36e3113 commit 82fa8ca
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,55 +1,63 @@
df = Dict("A" => [5, 10, 15, 20], "B" => [1, 2, 3, 4], "C" => [1, 2, 3, 4])

using Test
using Gattino

df = Dict("A" => [5, 10, 15, 20], "B" => [1, 2, 3, 4])

@testset "gattino plots" verbose = true begin
@testset "high-level plotting" verbose = true begin
@testset "hist" begin
ran = false
h = nothing
try
h = hist(df)
h = hist("A", "B", df)
hist(df["A"], df["B"], ymin = 0, ymax = 50)
hist(["1", "2", "3", "4", "5"], df["B"], ymin = 0, ymax = 50)
catch

hist(["1", "2", "3", "4"], df["B"], ymin = 0, ymax = 50)
ran = true
catch e
throw(e)
end
@test ran
layers = [p[2] for p in layers(h)]
@test "A" in layers
@test "axes" in layers
@test ran == true
lays = [p[2] for p in layers(h)]
@test "bars" in lays
@test "axes" in lays
end
@testset "scatter" begin
ran = false
h = nothing
try
scatter(df)
scatter("A", "B", df)
h = scatter(df["A"], df["B"], ymin = 0, ymax = 50, title = "sample")
ran = true
catch

end
@test ran
layers = [p[2] for p in layers(h)]
@test "points" in layers
lays = [p[2] for p in layers(h)]
@test "points" in lays
@test length(h.window[:children]["points"][:children]) == length(df["A"])
@test "axes" in layers
@test "axes" in lays
end
@testset "line" begin
ran = false
h = nothing
try
line(df)
h = line(df["A"], df["B"], ymin = 0, ymax = 50, title = "sample")
h = line("A", "B", df)
line(df["A"], df["B"], ymin = 0, ymax = 50, title = "sample")
line(["hi", "hello"], df["A"][1:2])
ran = true
catch

end
@test ran
layers = [p[2] for p in layers(h)]
@test "points" in layers
@test length(h.window[:children]["points"][:children]) == length(df["A"])
@test "axes" in layers
lays = [p[2] for p in layers(h)]
@test "C" in lays
@test "axes" in lays
@test "grid" in lays
end
end
@testset "contexts" verbose = true begin

end
@testset "context plotting" verbose = true begin

end
end

0 comments on commit 82fa8ca

Please sign in to comment.