Skip to content

Commit 589f403

Browse files
committed
Add simple test for Pdf export
1 parent 817afcc commit 589f403

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Orange/widgets/tests/test_io.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import os
2+
import tempfile
3+
import unittest
4+
5+
from AnyQt.QtWidgets import QGraphicsScene, QGraphicsRectItem
6+
from Orange.widgets.tests.base import GuiTest
7+
8+
from Orange.widgets import io as imgio
9+
10+
@unittest.skipUnless(hasattr(imgio, "PdfFormat"), "QPdfWriter not available")
11+
class TestIO(GuiTest):
12+
def test_pdf(self):
13+
sc = QGraphicsScene()
14+
sc.addItem(QGraphicsRectItem(0, 0, 20, 20))
15+
fd, fname = tempfile.mkstemp()
16+
os.close(fd)
17+
try:
18+
imgio.PdfFormat.write_image(fname, sc)
19+
finally:
20+
os.unlink(fname)

0 commit comments

Comments
 (0)