Skip to content
Permalink
Browse files

add test for device pixel ratio in map settings

  • Loading branch information
3nids committed Oct 23, 2018
1 parent c868e62 commit 3ff8477c5296e8e13b857f063ea40dce4891105b
Showing with 14 additions and 0 deletions.
  1. +14 −0 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;

0 comments on commit 3ff8477

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