Skip to content
Permalink
Browse files

Restore a disabled test for Qt5 which works OK now

(cherry-picked from 44143c1)
  • Loading branch information
nyalldawson committed Apr 2, 2018
1 parent 1926efa commit 05eba14f9163f3b3fbbe51c80e569e584f7c89fc
@@ -18,7 +18,7 @@
import socketserver
import threading
import http.server
from qgis.PyQt.QtCore import QRectF
from qgis.PyQt.QtCore import QRectF, QDir

from qgis.core import (QgsLayoutItemPicture,
QgsLayout,
@@ -70,24 +70,33 @@ def __init__(self, methodName):
self.picture.setFrameEnabled(True)
self.layout.addLayoutItem(self.picture)

def setUp(self):
self.report = "<h1>Python QgsLayoutItemPicture Tests</h1>\n"

def tearDown(self):
report_file_path = "%s/qgistest.html" % QDir.tempPath()
with open(report_file_path, 'a') as report_file:
report_file.write(self.report)

def testResizeZoom(self):
"""Test picture resize zoom mode."""
self.picture.setResizeMode(QgsLayoutItemPicture.Zoom)

checker = QgsLayoutChecker('composerpicture_resize_zoom', self.layout)
checker.setControlPathPrefix("composer_picture")
testResult, message = checker.testLayout()
self.report += checker.report()

assert testResult, message

@unittest.skip('test is broken for qt5/python3 - feature works')
def testRemoteImage(self):
"""Test fetching remote picture."""
self.picture.setPicturePath('http://localhost:' + str(TestQgsLayoutPicture.port) + '/qgis_local_server/logo.png')

checker = QgsLayoutChecker('picture_remote', self.layout)
checker = QgsLayoutChecker('composerpicture_remote', self.layout)
checker.setControlPathPrefix("composer_picture")
testResult, message = checker.testLayout()
self.report += checker.report()

self.picture.setPicturePath(self.pngImage)
assert testResult, message
Binary file not shown.

0 comments on commit 05eba14

Please sign in to comment.
You can’t perform that action at this time.