Skip to content

Commit

Permalink
add test for device pixel ratio in map settings
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Oct 23, 2018
1 parent c868e62 commit 3ff8477
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/src/core/testqgsmapsettings.cpp
Expand Up @@ -37,6 +37,7 @@ class TestQgsMapSettings: public QObject
void testDefaults();
void visibleExtent();
void mapUnitsPerPixel();
void testDevicePixelRatio();
void visiblePolygon();
void testIsLayerVisible();
void testMapLayerListUtils();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3ff8477

Please sign in to comment.