|
1 |
| -include("../../utilities/prelude.jl") |
2 |
| - |
3 |
| - |
4 |
| -@testset "CairoMakie fig-formats" begin |
5 |
| - s = read( |
6 |
| - joinpath(@__DIR__, "../../examples/integrations/CairoMakieFigFormat.qmd"), |
7 |
| - String, |
8 |
| - ) |
9 |
| - |
10 |
| - env = abspath(joinpath(@__DIR__, "../../examples/integrations/CairoMakie/Project.toml")) |
11 |
| - |
12 |
| - showable_mimes(::Union{Val{:png},Val{:jpeg},Val{:retina}}) = ["image/png", "text/html"] |
13 |
| - showable_mimes(::Union{Val{:pdf},Val{:svg}}) = ["image/svg+xml", "application/pdf"] |
14 |
| - not_showable_mimes(::Union{Val{:png},Val{:jpeg},Val{:retina}}) = |
15 |
| - showable_mimes(Val(:pdf)) |
16 |
| - not_showable_mimes(::Union{Val{:pdf},Val{:svg}}) = ["text/html"] # png stays as a fallback that should not be chosen if svg or pdf are accepted |
17 |
| - |
18 |
| - mktempdir() do dir |
19 |
| - server = QuartoNotebookRunner.Server() |
20 |
| - file = joinpath(dir, "temp.qmd") |
21 |
| - |
22 |
| - @testset "$format" for format in [:png, :jpeg, :retina, :svg, :pdf] |
23 |
| - open(file, "w") do io |
24 |
| - # 1.6 doesn't support multiple patterns |
25 |
| - for pattern in [ |
26 |
| - "retina" => format, |
27 |
| - "CAIROMAKIE_ENV" => repr(env), |
28 |
| - "NOT_SHOWABLE_MIMES" => repr(not_showable_mimes(Val(format))), |
29 |
| - "SHOWABLE_MIMES" => repr(showable_mimes(Val(format))), |
30 |
| - ] |
31 |
| - s = replace(s, pattern) |
| 1 | +if VERSION >= v"1.10" |
| 2 | + include("../../utilities/prelude.jl") |
| 3 | + |
| 4 | + |
| 5 | + @testset "CairoMakie fig-formats" begin |
| 6 | + s = read( |
| 7 | + joinpath(@__DIR__, "../../examples/integrations/CairoMakieFigFormat.qmd"), |
| 8 | + String, |
| 9 | + ) |
| 10 | + |
| 11 | + env = abspath( |
| 12 | + joinpath(@__DIR__, "../../examples/integrations/CairoMakie/Project.toml"), |
| 13 | + ) |
| 14 | + |
| 15 | + showable_mimes(::Union{Val{:png},Val{:jpeg},Val{:retina}}) = |
| 16 | + ["image/png", "text/html"] |
| 17 | + showable_mimes(::Union{Val{:pdf},Val{:svg}}) = ["image/svg+xml", "application/pdf"] |
| 18 | + not_showable_mimes(::Union{Val{:png},Val{:jpeg},Val{:retina}}) = |
| 19 | + showable_mimes(Val(:pdf)) |
| 20 | + not_showable_mimes(::Union{Val{:pdf},Val{:svg}}) = ["text/html"] # png stays as a fallback that should not be chosen if svg or pdf are accepted |
| 21 | + |
| 22 | + mktempdir() do dir |
| 23 | + server = QuartoNotebookRunner.Server() |
| 24 | + file = joinpath(dir, "temp.qmd") |
| 25 | + |
| 26 | + @testset "$format" for format in [:png, :jpeg, :retina, :svg, :pdf] |
| 27 | + open(file, "w") do io |
| 28 | + # 1.6 doesn't support multiple patterns |
| 29 | + for pattern in [ |
| 30 | + "retina" => format, |
| 31 | + "CAIROMAKIE_ENV" => repr(env), |
| 32 | + "NOT_SHOWABLE_MIMES" => repr(not_showable_mimes(Val(format))), |
| 33 | + "SHOWABLE_MIMES" => repr(showable_mimes(Val(format))), |
| 34 | + ] |
| 35 | + s = replace(s, pattern) |
| 36 | + end |
| 37 | + print(io, s) |
32 | 38 | end
|
33 |
| - print(io, s) |
| 39 | + |
| 40 | + result = QuartoNotebookRunner.run!(server, file) |
| 41 | + @test result.cells[6].outputs[1].data["text/plain"] == "true" |
| 42 | + @test result.cells[8].outputs[1].data["text/plain"] == "true" |
34 | 43 | end
|
35 | 44 |
|
36 |
| - result = QuartoNotebookRunner.run!(server, file) |
37 |
| - @test result.cells[6].outputs[1].data["text/plain"] == "true" |
38 |
| - @test result.cells[8].outputs[1].data["text/plain"] == "true" |
| 45 | + QuartoNotebookRunner.close!(server) |
39 | 46 | end
|
40 |
| - |
41 |
| - QuartoNotebookRunner.close!(server) |
42 | 47 | end
|
43 | 48 | end
|
0 commit comments