Skip to content

Commit 7e0b52c

Browse files
committed
fix cairomakie integration test
1 parent 73fc64b commit 7e0b52c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

test/examples/integrations/CairoMakie.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ import CairoMakie
1616

1717
```{julia}
1818
CairoMakie.scatter([1, 2, 3], [1, 2, 3])
19+
```
20+
21+
```{julia}
22+
CairoMakie.Makie.current_default_theme()[:CairoMakie][:px_per_unit][]
1923
```

test/testsets/integrations/CairoMakie.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ include("../../utilities/prelude.jl")
33
test_example(joinpath(@__DIR__, "../../examples/integrations/CairoMakie.qmd")) do json
44
cells = json["cells"]
55
cell = cells[6]
6+
7+
px_per_inch = 96
8+
9+
# the size metadata is just inches converted to CSS pixels, independent of pixel resolution
610
@test cell["outputs"][1]["metadata"]["image/png"] ==
7-
Dict("width" => 4 * 150, "height" => 3 * 150)
11+
Dict("width" => 4 * px_per_inch, "height" => 3 * px_per_inch)
12+
13+
# the pixel resolution is controlled by px_per_unit and that reflects the dpi that is set
14+
px_per_unit_str = cells[end-1]["outputs"][1]["data"]["text/plain"]
15+
px_per_unit = parse(Float64, px_per_unit_str)
16+
@test px_per_unit == 150 / px_per_inch
817
end

0 commit comments

Comments
 (0)