Skip to content
Permalink
Browse files

Added python test for qgscoordinatetransform

  • Loading branch information
timlinux committed Aug 25, 2012
1 parent ca7fa30 commit 0df9e449285394be77bd01bea41ba9d33cc1c8ba
Showing with 35 additions and 0 deletions.
  1. +1 −0 tests/src/python/CMakeLists.txt
  2. +34 −0 tests/src/python/test_qgscoordinatetransform.py
@@ -5,3 +5,4 @@ ADD_PYTHON_TEST(PyQgsGeometry test_qgsgeometry.py)
ADD_PYTHON_TEST(PyQgsRasterLayer test_qgsrasterlayer.py)
ADD_PYTHON_TEST(PyQgsMemoryProvider test_qgsmemoryprovider.py)
ADD_PYTHON_TEST(PyQgsLogger test_qgslogger.py)
ADD_PYTHON_TEST(PyQgsCoordinateTransform test_qgscoordinatetransform.py)
@@ -0,0 +1,34 @@
import unittest

from qgis.core import (QgsRectangle,
QgsCoordinateReferenceSystem,
QgsCoordinateTransform,
QGis)

# Convenience instances in case you may need them
# not used in this test
#from utilities import getQgisTestApp
#QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()

class TestQgsCoordinateTransform(unittest.TestCase):

def testTransformBoundingBox(self):
myExtent = QgsRectangle(242270, 6043737, 246330, 6045897)
myGeoCrs = QgsCoordinateReferenceSystem()
myGeoCrs.createFromId(4326, QgsCoordinateReferenceSystem.EpsgCrsId)
myUtmCrs = QgsCoordinateReferenceSystem()
myUtmCrs.createFromId(32756, QgsCoordinateReferenceSystem.EpsgCrsId)
myXForm = QgsCoordinateTransform(myGeoCrs, myUtmCrs)
myProjectedExtent = myXForm.transformBoundingBox(myExtent)
#myProjectedExtent.xMinimum()
#myProjectedExtent.xMaximum()
myExpectedExtent = ''
myMessage = ('Expected:\n%s\nGot:\n%s\n' %
( myExpectedExtent,
myProjectedExtent.toString())

assert myExpectedExtent == myProjectedExtent, myMessage

if __name__ == '__main__':
unittest.main()

0 comments on commit 0df9e44

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