-
Notifications
You must be signed in to change notification settings - Fork 17
/
runtests.jl
83 lines (61 loc) · 2.69 KB
/
runtests.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using Gadfly
using ElectronDisplay
using Electron
using VegaDatasets
using Test
struct DummyDisplayable{M}
data
end
Base.show(io::IO, m::M, x::DummyDisplayable{M}) where {M} = true
Base.show(io::IO, m::M, x::DummyDisplayable{M}) where {M} = print(io, x.data)
include("construct_vega_specs.jl")
@testset "ElectronDisplay" begin
p1 = plot(y=[1,2,3])
f = display(p1)
@test f isa Electron.Window
ElectronDisplay.CONFIG.single_window = true
f = display(p1)
@test f === ElectronDisplay._getglobalplotwindow()
p2 = plot(y=[1,2,3])
f2 = display(p2)
@test f2 === f # Window is reused
eldt = ElectronDisplay.ElectronDisplayType()
@test electrondisplay(vl2) isa Electron.Window
@test electrondisplay(vl3) isa Electron.Window
@test electrondisplay(vg3) isa Electron.Window
@test electrondisplay(vg4) isa Electron.Window
@test electrondisplay(vg5) isa Electron.Window
@test_logs(
(:warn, r"The size of JSON representation.*exceeds.*max_json_bytes"),
electrondisplay(vl3png; max_json_bytes=-1)::Electron.Window
)
mdo = DummyDisplayable{MIME"text/markdown"}("""foo""")
@test electrondisplay(mdo) isa Electron.Window
pngo = DummyDisplayable{MIME"image/png"}("""fakedata""")
@test electrondisplay(pngo) isa Electron.Window
dro = DummyDisplayable{MIME"application/vnd.dataresource+json"}("""{"schema":{"fields":[{"name": "Miles_per_Gallon","type": "number"}]},"data":[{"Miles_per_Gallon":18}]}""")
@test electrondisplay(dro) isa Electron.Window
@test displayable(eldt, "text/html") == true
@test displayable(eldt, "text/markdown") == true
@test displayable(eldt, "image/png") == true
@test displayable(eldt, "image/svg+xml") == true
@test displayable(eldt, "application/vnd.vegalite.v2+json") == true
@test displayable(eldt, "application/vnd.vegalite.v3+json") == true
@test displayable(eldt, "application/vnd.vegalite.v4+json") == true
@test displayable(eldt, "application/vnd.vega.v3+json") == true
@test displayable(eldt, "application/vnd.vega.v4+json") == true
@test displayable(eldt, "application/vnd.vega.v5+json") == true
@test displayable(eldt, "application/vnd.plotly.v1+json") == true
@test displayable(eldt, "application/vnd.dataresource+json") == true
@testset "smoke test: single_window=$single_window focus=$focus " for
single_window in [false, true],
focus in [false, true]
ElectronDisplay.CONFIG.single_window = single_window
ElectronDisplay.CONFIG.focus = focus
@test electrondisplay(dataset("cars")) isa Electron.Window
@test electrondisplay(@doc reduce) isa Electron.Window
config = (single_window=single_window, focus=focus)
@test electrondisplay(dataset("cars"); config...) isa Electron.Window
@test electrondisplay(@doc reduce; config...) isa Electron.Window
end
end