Skip to content

Commit

Permalink
Restore a disabled test for Qt5 which works OK now
Browse files Browse the repository at this point in the history
(cherry-picked from 44143c1)
  • Loading branch information
nyalldawson committed Apr 2, 2018
1 parent 1926efa commit 05eba14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/src/python/test_qgslayoutpicture.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 05eba14

Please sign in to comment.