forked from GiovineItalia/Gadfly.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.jl
executable file
·162 lines (145 loc) · 6.96 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/usr/bin/env julia
using RDatasets, Gadfly
tests = [
("points", 6inch, 3inch),
("colored_points", 6inch, 3inch),
("function_plots", 6inch, 3inch),
("function_explicit_colors", 6inch, 3inch),
("function_layers", 6inch, 3inch),
("multicolumn_colorkey", 6inch, 2inch),
("vstack", 6inch, 6inch),
("hstack", 6inch, 3inch),
("colorful_hist", 6inch, 3inch),
("discrete_histogram", 6inch, 3inch),
("discrete_bar", 6inch, 3inch),
("discrete_bar_horizontal", 6inch, 3inch),
("stacked_discrete_histogram", 6inch, 3inch),
("stacked_discrete_histogram_horizontal", 6inch, 3inch),
("stacked_continuous_histogram", 6inch, 3inch),
("dodged_discrete_histogram", 6inch, 3inch),
("dodged_discrete_histogram_horizontal", 6inch, 3inch),
("array_aesthetics", 6inch, 3inch),
("subplot_grid", 10inch, 10inch),
("subplot_grid_free_axis", 10inch, 10inch),
("subplot_grid_histogram", 6inch, 3inch),
("subplot_layers", 8inch, 6inch),
("labels", 6inch, 6inch),
("percent", 6inch, 6inch),
("timeseries_day", 6inch, 3inch),
("timeseries_month", 6inch, 3inch),
("timeseries_year_1", 6inch, 3inch),
("timeseries_year_2", 6inch, 3inch),
("timeseries_year_3", 6inch, 3inch),
("timeseries_colorful", 6inch, 3inch),
# ("date_bar", 6inch, 3inch),
("custom_themes", 6inch, 3inch),
("issue98", 6inch, 3inch),
("issue82", 6inch, 3inch),
("histogram2d", 6inch, 3inch),
("rectbin", 6inch, 3inch),
("density", 6inch, 3inch),
("colorful_density", 6inch, 3inch),
("explicit_colorkey_title", 6inch, 3inch),
("explicit_subplot_titles", 6inch, 3inch),
("subplot_grid_smooth", 6inch, 8inch),
("smooth_lm", 6inch, 8inch),
("colored_smooth_lm", 6inch, 8inch),
("histogram_errorbar", 6inch, 3inch),
("issue106", 6inch, 3inch),
("continuous_color_scale_range", 6inch, 3inch),
("continuous_scale_range", 6inch, 3inch),
("log10_scale_range", 6inch, 3inch),
("histogram_explicit_bins", 6inch, 3inch),
("histogram2d_explicit_bins", 6inch, 3inch),
("explicit_number_format", 6inch, 3inch),
("explicit_xy_ticks", 6inch, 3inch),
("boxplot", 6inch, 3inch),
("subplot_categorical_bar", 6inch, 3inch),
("errorbar", 6inch, 3inch),
("issue120", 6inch, 3inch),
("histogram2d_discrete", 6inch, 3inch),
("layer_themes", 6inch, 3inch),
("discrete_color_manual", 6inch, 3inch),
("ordered_line", 6inch, 3inch),
("nan_skipping", 6inch, 3inch),
("hexbin", 6inch, 3inch),
("spy", 6inch, 3inch),
("issue177", 6inch, 3inch),
("ribbon", 6inch, 3inch),
("colored_ribbon", 6inch, 3inch),
("layer_leak", 6inch, 3inch),
("hline_vline", 6inch, 3inch),
("grid_strokedash", 6inch, 3inch),
("aspect_ratio", 6inch, 3inch),
("contour_function", 6inch, 3inch),
("contour_matrix", 6inch, 3inch),
("stat_qq", 6inch, 16inch),
("line_histogram", 6inch, 3inch),
("layer_data", 6inch, 3inch),
("multi_geom_layer", 6inch, 3inch),
("raster", 6inch, 3inch),
("single_boxplot", 6inch, 3inch),
("subplot_scales", 6inch, 3inch),
]
backends = {
"svg" => (name, width, height) -> SVG("output/$(name).svg", width, height),
"svgjs" => (name, width, height) -> SVGJS("output/$(name).js.svg", width, height, jsmode=:linkabs),
"png" => (name, width, height) -> PNG("output/$(name).png", width, height),
#"ps" => (name, width, height) -> PS("output/$(name).ps", width, height),
#"pdf" => (name, width, height) -> PDF("output/$(name).pdf", width, height)
"pgf" => (name, width, height) -> PGF("output/$(name).tex", width, height)
}
function run_tests(output_filename)
testdir = Pkg.dir("Gadfly", "test")
whitelist = Set()
if !isempty(ARGS)
union!(whitelist, ARGS)
else
union!(whitelist, [name for (name, width, height) in tests])
end
for (name, width, height) in tests
if !in(name, whitelist)
continue
end
for (backend_name, backend) in backends
println(STDERR, "Rendering $(name) on $(backend_name) backend.")
try
p = evalfile(joinpath(testdir, "$(name).jl"))
draw(backend(name, width, height), p)
catch
println(STDERR, "FAILED!")
rethrow()
end
end
end
output = open(output_filename, "w")
print(output,
"""
<!DOCTYPE html>
<html>
<meta charset="utf-8" />
<head>
<title>Gadfly Test Plots</title>
</head>
<body>
<script src="$(Compose.snapsvgjs)"></script>
<script src="$(Gadfly.gadflyjs)"></script>
<div style="width:900; margin:auto; text-align: center; font-family: sans-serif; font-size: 20pt;">
""")
for (name, width, height) in tests
if !in(name, whitelist)
continue
end
println(output, "<p>", name, "</p>")
print(output, """<div id="$(name)"><object type="image/svg+xml" data="$(name).js.svg"></object></div>""")
print(output, """<img width="450px" src="$(name).svg">""")
print(output, """<img width="450px" src="$(name).png">\n""")
end
print(output,
"""
</div>
</body>
""")
close(output)
end
run_tests("output/test.html")