mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Add unit test for scaling layout view with layouts in pixels
This commit is contained in:
parent
cd2c62e825
commit
cbc5782cd8
@ -14,6 +14,7 @@ __revision__ = '$Format:%H$'
|
||||
|
||||
import qgis # NOQA
|
||||
|
||||
from qgis.core import QgsProject, QgsLayout, QgsUnitTypes
|
||||
from qgis.gui import QgsLayoutView
|
||||
from qgis.PyQt.QtCore import QRectF
|
||||
from qgis.PyQt.QtGui import QTransform
|
||||
@ -58,6 +59,18 @@ class TestQgsLayoutView(unittest.TestCase):
|
||||
view.scaleSafe(0.5)
|
||||
self.assertAlmostEqual(view.transform().m11(), scale)
|
||||
|
||||
def testLayoutScalePixels(self):
|
||||
p = QgsProject()
|
||||
l = QgsLayout(p)
|
||||
l.setUnits(QgsUnitTypes.LayoutPixels)
|
||||
view = QgsLayoutView()
|
||||
view.setCurrentLayout(l)
|
||||
view.setZoomLevel(1)
|
||||
# should be no transform, since 100% with pixel units should be pixel-pixel
|
||||
self.assertEqual(view.transform().m11(), 1)
|
||||
view.setZoomLevel(0.5)
|
||||
self.assertEqual(view.transform().m11(), 0.5)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user