Skip to content

Commit

Permalink
Merge pull request #1210 from Mattriks/density_dark_test
Browse files Browse the repository at this point in the history
Runtests_upgrade
  • Loading branch information
bjarthur committed Oct 18, 2018
2 parents 3483498 + 16c843e commit fefe8d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
10 changes: 6 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ testfiles = isempty(ARGS) ?
ARGS

@testset "Gadfly" begin
for filename in testfiles, (backend_name, backend) in backends
@info string(filename,'.',backend_name)
for filename in testfiles
Random.seed!(1)
p = evalfile(joinpath(testdir, "$(filename).jl"))
@test typeof(p) in [Plot,Compose.Context]
r = draw(backend(filename), p)
@test typeof(r) in [Bool,Nothing]
for (backend_name, backend) in backends
@info string(filename,'.',backend_name)
r = draw(backend(filename), p)
@test typeof(r) in [Bool,Nothing]
end
end
end

Expand Down
12 changes: 3 additions & 9 deletions test/testscripts/density_dark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,21 @@ using Gadfly, RDatasets, Test, Base64

set_default_plot_size(6inch, 3inch)

global density_dark_tested

p = Gadfly.with_theme(:dark) do
plot(dataset("ggplot2", "diamonds"), x="Price", color="Cut", Geom.density)
end

# prevent these tests from running more than once
if ! @isdefined density_dark_tested
svg_str_dark = stringmime(MIME("image/svg+xml"), p)
@test occursin(Base.hex(Gadfly.dark_theme.default_color), svg_str_dark)
@test occursin(Base.hex(Gadfly.dark_theme.background_color), svg_str_dark)
@test occursin(Base.hex(Gadfly.dark_theme.panel_fill), svg_str_dark)
@test occursin("rgba(34,40,48,1)", svg_str_dark) # dark theme background color
@test occursin("rgba(34,40,48,1)", svg_str_dark) # dark theme panel fill

# Test reset.
p2 = plot(dataset("ggplot2", "diamonds"), x="Price", color="Cut", Geom.density)
svg_str_light = stringmime(MIME("image/svg+xml"), p2)
@test !occursin(Base.hex(Gadfly.dark_theme.default_color), svg_str_light)
@test !occursin(Base.hex(Gadfly.dark_theme.background_color), svg_str_light)
@test !occursin(Base.hex(Gadfly.dark_theme.panel_fill), svg_str_light)
@test !occursin("rgba(34,40,48,1)", svg_str_light)

density_dark_tested=true
end

p

0 comments on commit fefe8d9

Please sign in to comment.