|
18 | 18 | import socketserver
|
19 | 19 | import threading
|
20 | 20 | import http.server
|
21 |
| -from qgis.PyQt.QtCore import QRectF |
| 21 | +from qgis.PyQt.QtCore import QRectF, QDir |
22 | 22 |
|
23 | 23 | from qgis.core import (QgsLayoutItemPicture,
|
24 | 24 | QgsLayout,
|
@@ -70,24 +70,33 @@ def __init__(self, methodName):
|
70 | 70 | self.picture.setFrameEnabled(True)
|
71 | 71 | self.layout.addLayoutItem(self.picture)
|
72 | 72 |
|
| 73 | + def setUp(self): |
| 74 | + self.report = "<h1>Python QgsLayoutItemPicture Tests</h1>\n" |
| 75 | + |
| 76 | + def tearDown(self): |
| 77 | + report_file_path = "%s/qgistest.html" % QDir.tempPath() |
| 78 | + with open(report_file_path, 'a') as report_file: |
| 79 | + report_file.write(self.report) |
| 80 | + |
73 | 81 | def testResizeZoom(self):
|
74 | 82 | """Test picture resize zoom mode."""
|
75 | 83 | self.picture.setResizeMode(QgsLayoutItemPicture.Zoom)
|
76 | 84 |
|
77 | 85 | checker = QgsLayoutChecker('composerpicture_resize_zoom', self.layout)
|
78 | 86 | checker.setControlPathPrefix("composer_picture")
|
79 | 87 | testResult, message = checker.testLayout()
|
| 88 | + self.report += checker.report() |
80 | 89 |
|
81 | 90 | assert testResult, message
|
82 | 91 |
|
83 |
| - @unittest.skip('test is broken for qt5/python3 - feature works') |
84 | 92 | def testRemoteImage(self):
|
85 | 93 | """Test fetching remote picture."""
|
86 | 94 | self.picture.setPicturePath('http://localhost:' + str(TestQgsLayoutPicture.port) + '/qgis_local_server/logo.png')
|
87 | 95 |
|
88 |
| - checker = QgsLayoutChecker('picture_remote', self.layout) |
| 96 | + checker = QgsLayoutChecker('composerpicture_remote', self.layout) |
89 | 97 | checker.setControlPathPrefix("composer_picture")
|
90 | 98 | testResult, message = checker.testLayout()
|
| 99 | + self.report += checker.report() |
91 | 100 |
|
92 | 101 | self.picture.setPicturePath(self.pngImage)
|
93 | 102 | assert testResult, message
|
|
0 commit comments