Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 22, 2017
1 parent 46f2ea1 commit 4a800a1
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 40 deletions.
6 changes: 3 additions & 3 deletions scripts/parse_dash_results.py
Expand Up @@ -44,7 +44,7 @@
import struct
import glob

dash_url = 'http://dash.orfeo-toolbox.org'
dash_url = 'https://dash.orfeo-toolbox.org'


def error(msg):
Expand All @@ -61,7 +61,7 @@ def colorDiff(c1, c2):


def imageFromPath(path):
if (path[:7] == 'http://' or path[:7] == 'file://'):
if (path[:7] == 'https://' or path[:7] == 'file://'):
# fetch remote image
data = urllib.request.urlopen(path).read()
image = QImage()
Expand Down Expand Up @@ -181,7 +181,7 @@ def load_images(self, control_image_path, rendered_image_path, mask_image_path):
),
self.rendered_image.width(
),
self.rendered_image.height()))
self.rendered_image.height()))

max_width = min(
self.rendered_image.width(), self.control_image.width())
Expand Down
37 changes: 0 additions & 37 deletions tests/src/python/test_qgssymbollayerutils.py
Expand Up @@ -53,43 +53,6 @@ def testEncodeDecodePoint(self):
s2 = QgsSymbolLayerUtils.decodePoint('')
self.assertEqual(s2, QPointF())

def testConvertToMapUnits(self):
# test QgsSymbolLayerUtils::convertToMapUnits() without QgsMapUnitScale

ms = QgsMapSettings()
ms.setExtent(QgsRectangle(0, 0, 100, 100))
ms.setOutputSize(QSize(100, 50))
ms.setOutputDpi(300)
r = QgsRenderContext.fromMapSettings(ms)

# renderer scale should be about 1:291937841
size = QgsSymbolLayerUtils.convertToMapUnits(r, 2, QgsUnitTypes.RenderMapUnits)
self.assertEqual(size, 2.0)
size = QgsSymbolLayerUtils.convertToMapUnits(r, 2, QgsUnitTypes.RenderMillimeters)
self.assertAlmostEqual(size, 47.244094, places=5)
size = QgsSymbolLayerUtils.convertToMapUnits(r, 5.66929, QgsUnitTypes.RenderPoints)
self.assertAlmostEqual(size, 47.2440833, places=5)
size = QgsSymbolLayerUtils.convertToMapUnits(r, 2, QgsUnitTypes.RenderPixels)
self.assertAlmostEqual(size, 4.0, places=5)

def testConvertFromMapUnits(self):
# test QgsSymbolLayerUtils::convertToMapUnits() without QgsMapUnitScale

ms = QgsMapSettings()
ms.setExtent(QgsRectangle(0, 0, 100, 100))
ms.setOutputSize(QSize(100, 50))
ms.setOutputDpi(300)
r = QgsRenderContext.fromMapSettings(ms)

# renderer scale should be about 1:291937841
size = QgsSymbolLayerUtils.convertFromMapUnits(r, 2, QgsUnitTypes.RenderMapUnits)
self.assertEqual(size, 2.0)
size = QgsSymbolLayerUtils.convertFromMapUnits(r, 50, QgsUnitTypes.RenderMillimeters)
self.assertAlmostEqual(size, 2.1166666666, places=5)
size = QgsSymbolLayerUtils.convertFromMapUnits(r, 50, QgsUnitTypes.RenderPoints)
self.assertAlmostEqual(size, 6.0000000015, places=5)
size = QgsSymbolLayerUtils.convertFromMapUnits(r, 4, QgsUnitTypes.RenderPixels)
self.assertAlmostEqual(size, 2.0, places=5)

if __name__ == '__main__':
unittest.main()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 4a800a1

Please sign in to comment.