Skip to content

Commit

Permalink
Add unit test for #33540
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and nyalldawson committed Dec 31, 2019
1 parent 85cc185 commit f7975a1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/src/python/test_qgslayoutpicture.py
Expand Up @@ -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"""

Expand Down

0 comments on commit f7975a1

Please sign in to comment.