diff --git a/tests/src/core/testqgsmapsettings.cpp b/tests/src/core/testqgsmapsettings.cpp index 1a206208b12..6a7c2309c15 100644 --- a/tests/src/core/testqgsmapsettings.cpp +++ b/tests/src/core/testqgsmapsettings.cpp @@ -37,6 +37,7 @@ class TestQgsMapSettings: public QObject void testDefaults(); void visibleExtent(); void mapUnitsPerPixel(); + void testDevicePixelRatio(); void visiblePolygon(); void testIsLayerVisible(); void testMapLayerListUtils(); @@ -137,6 +138,19 @@ void TestQgsMapSettings::mapUnitsPerPixel() QCOMPARE( ms.mapUnitsPerPixel(), 0.2 ); } +void TestQgsMapSettings::testDevicePixelRatio() +{ + QgsMapSettings ms; + ms.setOutputSize( QSize( 100, 50 ) ); + ms.setExtent( QgsRectangle( 0, 0, 100, 100 ) ); + ms.setDevicePixelRatio( 1 ); + double scale = ms.scale(); + ms.setDevicePixelRatio( 1.5 ); + ms.setExtent( QgsRectangle( 0, 0, 100, 100 ) ); + QCOMPARE( ms.outputSize() * 1.5, ms.deviceOutputSize() ); + QCOMPARE( scale * 1.5, ms.scale() ); +} + void TestQgsMapSettings::visiblePolygon() { QgsMapSettings ms;