Merge pull request #4233 from myarjunar/test-toMapPixel

add unit test for toMapPoint function
This commit is contained in:
Nyall Dawson 2017-03-08 20:11:24 +10:00 committed by GitHub
commit e0979046a4

View File

@ -29,6 +29,7 @@ class TestQgsMapToPixel: public QObject
void rotation();
void getters();
void fromScale();
void toMapPoint();
};
void TestQgsMapToPixel::rotation()
@ -106,6 +107,19 @@ void TestQgsMapToPixel::fromScale()
QGSCOMPARENEAR( m2p.mapUnitsPerPixel(), 0.000265, 0.000001 );
}
void TestQgsMapToPixel::toMapPoint()
{
QgsMapToPixel m2p( 1, 5, 5, 10, 10, 90 );
QgsPoint p = m2p.toMapPoint( 5, 5 );
QCOMPARE( p, QgsPoint( 5, 5 ) );
p = m2p.toMapPoint( 10, 10 );
QCOMPARE( p, QgsPoint( 10, 10 ) );
p = m2p.toMapPoint( 20, 20 );
QCOMPARE( p, QgsPoint( 20, 20 ) );
}
QGSTEST_MAIN( TestQgsMapToPixel )
#include "testqgsmaptopixel.moc"