Merge pull request #1151 from ixjlyons/imageexporter-tests
ImageExporter py2-pyside fix with test
This commit is contained in:
commit
7cbc703449
@ -47,10 +47,7 @@ class ImageExporter(Exporter):
|
||||
|
||||
def export(self, fileName=None, toBytes=False, copy=False):
|
||||
if fileName is None and not toBytes and not copy:
|
||||
if QT_LIB in ['PySide', 'PySide2']:
|
||||
filter = ["*."+str(f, encoding='utf-8') for f in QtGui.QImageWriter.supportedImageFormats()]
|
||||
else:
|
||||
filter = ["*."+bytes(f).decode('utf-8') for f in QtGui.QImageWriter.supportedImageFormats()]
|
||||
filter = ["*."+f.data().decode('utf-8') for f in QtGui.QImageWriter.supportedImageFormats()]
|
||||
preferred = ['*.png', '*.tif', '*.jpg']
|
||||
for p in preferred[::-1]:
|
||||
if p in filter:
|
||||
|
13
pyqtgraph/exporters/tests/test_image.py
Normal file
13
pyqtgraph/exporters/tests/test_image.py
Normal file
@ -0,0 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pyqtgraph as pg
|
||||
from pyqtgraph.exporters import ImageExporter
|
||||
|
||||
app = pg.mkQApp()
|
||||
|
||||
|
||||
def test_ImageExporter_filename_dialog():
|
||||
"""Tests ImageExporter code path that opens a file dialog. Regression test
|
||||
for pull request 1133."""
|
||||
p = pg.plot()
|
||||
exp = ImageExporter(p.getPlotItem())
|
||||
exp.export()
|
Loading…
Reference in New Issue
Block a user