Commit 2f3a727e authored by Michael Droettboom's avatar Michael Droettboom

Add test for wasm_backend. Fix PDF test.

parent 45d14492
......@@ -104,7 +104,10 @@ class FigureCanvasWasm(backend_agg.FigureCanvasAgg):
# Designed to be overridden by subclasses for use in contexts other
# than iodide.
from js import iodide
return iodide.output.element('div')
if iodide is not None:
return iodide.output.element('div')
else:
return document.createElement('div')
def show(self):
# If we've already shown this canvas elsewhere, don't create a new one,
......
def test_matplotlib(selenium):
def test_matplotlib(selenium_standalone):
selenium = selenium_standalone
selenium.load_package("matplotlib")
selenium.run("from matplotlib import pyplot as plt")
selenium.run("plt.figure()")
selenium.run("x = plt.plot([1,2,3])")
selenium.run("plt.plot([1,2,3])")
selenium.run("plt.show()")
......@@ -27,5 +28,3 @@ def test_pdf(selenium):
selenium.run("import io")
selenium.run("fd = io.BytesIO()")
selenium.run("plt.savefig(fd, format='pdf')")
content = selenium.run("fd.getvalue()")
assert len(content) == 5559
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment