Skip to content
Permalink
Browse files

add unit test for toMapPoint function

  • Loading branch information
myarjunar committed Mar 8, 2017
1 parent 72cc2ee commit 7e546c0382017b4414ee2cdd40afeaaad77c04ae
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/src/core/testqgsmaptopixel.cpp
@@ -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"

0 comments on commit 7e546c0

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