Skip to content

Commit

Permalink
Merge pull request #4233 from myarjunar/test-toMapPixel
Browse files Browse the repository at this point in the history
add unit test for toMapPoint function
  • Loading branch information
nyalldawson committed Mar 8, 2017
2 parents 5e6d540 + 7e546c0 commit e097904
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/src/core/testqgsmaptopixel.cpp
Expand Up @@ -29,6 +29,7 @@ class TestQgsMapToPixel: public QObject
void rotation();
void getters();
void fromScale();
void toMapPoint();
};

void TestQgsMapToPixel::rotation()
Expand Down Expand Up @@ -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"

Expand Down

0 comments on commit e097904

Please sign in to comment.