Skip to content

Commit e097904

Browse files
authored
Merge pull request #4233 from myarjunar/test-toMapPixel
add unit test for toMapPoint function
2 parents 5e6d540 + 7e546c0 commit e097904

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/src/core/testqgsmaptopixel.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class TestQgsMapToPixel: public QObject
2929
void rotation();
3030
void getters();
3131
void fromScale();
32+
void toMapPoint();
3233
};
3334

3435
void TestQgsMapToPixel::rotation()
@@ -106,6 +107,19 @@ void TestQgsMapToPixel::fromScale()
106107
QGSCOMPARENEAR( m2p.mapUnitsPerPixel(), 0.000265, 0.000001 );
107108
}
108109

110+
void TestQgsMapToPixel::toMapPoint()
111+
{
112+
QgsMapToPixel m2p( 1, 5, 5, 10, 10, 90 );
113+
QgsPoint p = m2p.toMapPoint( 5, 5 );
114+
QCOMPARE( p, QgsPoint( 5, 5 ) );
115+
116+
p = m2p.toMapPoint( 10, 10 );
117+
QCOMPARE( p, QgsPoint( 10, 10 ) );
118+
119+
p = m2p.toMapPoint( 20, 20 );
120+
QCOMPARE( p, QgsPoint( 20, 20 ) );
121+
}
122+
109123
QGSTEST_MAIN( TestQgsMapToPixel )
110124
#include "testqgsmaptopixel.moc"
111125

0 commit comments

Comments
 (0)