Skip to content
Permalink
Browse files

Add unit test for #33540

  • Loading branch information
nyalldawson committed Dec 31, 2019
1 parent 12006de commit 5a1a7438c445cc75781b2bfaa2fb997351e6e2a9
Showing with 28 additions and 0 deletions.
  1. +28 −0 tests/src/python/test_qgslayoutpicture.py
@@ -99,6 +99,34 @@ def testRemoteImage(self):
self.picture.setPicturePath(self.pngImage)
assert testResult, message

def testNorthArrowWithMapItemRotation(self):
"""Test picture rotation when map item is also rotated"""

layout = QgsLayout(QgsProject.instance())

map = QgsLayoutItemMap(layout)
map.setExtent(QgsRectangle(0, -256, 256, 0))
layout.addLayoutItem(map)

picture = QgsLayoutItemPicture(layout)
layout.addLayoutItem(picture)

picture.setLinkedMap(map)
self.assertEqual(picture.linkedMap(), map)

picture.setNorthMode(QgsLayoutItemPicture.GridNorth)
map.setItemRotation(45)
self.assertEqual(picture.pictureRotation(), 45)
map.setMapRotation(-34)
self.assertEqual(picture.pictureRotation(), 11)

# add an offset
picture.setNorthOffset(-10)
self.assertEqual(picture.pictureRotation(), 1)

map.setItemRotation(55)
self.assertEqual(picture.pictureRotation(), 11)

def testGridNorth(self):
"""Test syncing picture to grid north"""

0 comments on commit 5a1a743

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