2 changes: 1 addition & 1 deletion cmake/UsePythonTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ MACRO(ADD_PYTHON_COMPILEALL_TEST DIRNAME)
GET_FILENAME_COMPONENT(temp_path "${PYTHON_LIBRARIES}" PATH)
# Find the python script:
GET_FILENAME_COMPONENT(PYTHON_COMPILE_ALL_PY "${temp_path}/../compileall.py" ABSOLUTE)
# add test, use DIRNAME to create uniq name for the test:
# add test, use DIRNAME to create unique name for the test:
ADD_TEST(COMPILE_ALL-${DIRNAME} ${PYTHON_EXECUTABLE} "${PYTHON_COMPILE_ALL_PY}" -q ${DIRNAME})
ENDMACRO(ADD_PYTHON_COMPILEALL_TEST)
2 changes: 1 addition & 1 deletion src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
/** Read property of QColor bgColor. */
virtual QColor canvasColor() const;

/** Emits signal scalChanged to update scale in main window */
/** Emits signal scaleChanged to update scale in main window */
void updateScale();

/** Updates the full extent */
Expand Down
5 changes: 5 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
IF (ENABLE_TESTS)

# Install any resoure files needed here...
INSTALL(FILES ${CMAKE_SOURCE_DIR}/resources/srs.db DESTINATION ${QGIS_OUTPUT_DIRECTORY}/share/qgis/resources/)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/resources/qgis.db DESTINATION ${QGIS_OUTPUT_DIRECTORY}/share/qgis/resources/)

IF (APPLE)
# override default data path, otherwise looks for Resources in app bundle
SET (QGIS_DATA_SUBDIR "${CMAKE_SOURCE_DIR}/resources")
Expand Down
1 change: 1 addition & 0 deletions tests/src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
34 changes: 34 additions & 0 deletions tests/src/python/test_qgscoordinatetransform.py
Original file line number Diff line number Diff line change
@@ -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):
"""Test that we can transform a rectangular bbox from utm56s to LonLat"""
myExtent = QgsRectangle(242270, 6043737, 246330, 6045897)
myGeoCrs = QgsCoordinateReferenceSystem()
myGeoCrs.createFromId(4326, QgsCoordinateReferenceSystem.EpsgCrsId)
myUtmCrs = QgsCoordinateReferenceSystem()
myUtmCrs.createFromId(32756, QgsCoordinateReferenceSystem.EpsgCrsId)
myXForm = QgsCoordinateTransform(myUtmCrs, myGeoCrs)
myProjectedExtent = myXForm.transformBoundingBox(myExtent)
myExpectedExtent = ('150.1509239873580270,-35.7176936443908772 : '
'150.1964384662953194,-35.6971885216629090')
myMessage = ('Expected:\n%s\nGot:\n%s\n' %
( myExpectedExtent,
myProjectedExtent.toString()))

self.assertEquals(myExpectedExtent, myProjectedExtent.toString(), myMessage)

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

15 changes: 2 additions & 13 deletions tests/src/python/test_qgsgeometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,9 @@ def testBuffer(self):
myMessage = ('Expected:\n%s\nGot:\n%s\n' %
(QGis.Polygon, bufferGeom.type()))
assert bufferGeom.wkbType() == QGis.WKBPolygon, myMessage
myTestPoint = QgsGeometry.fromPoint(QgsPoint(3, 3))
assert bufferGeom.intersects(myTestPoint)

layer = QgsVectorLayer("Polygon", "buffer", "memory")
assert layer.isValid(), "Failed to create valid polygon memory layer"

provider = layer.dataProvider()

ft = QgsFeature()
ft.setGeometry(bufferGeom)
provider.addFeatures([ft])

myMessage = ('Expected:\n%s\nGot:\n%s\n' %
(1, layer.featureCount()))
assert layer.featureCount() == 1, myMessage

def testContains(self):
myPoly = QgsGeometry.fromPolygon([[QgsPoint(0, 0),QgsPoint(2, 0),QgsPoint(2, 2),QgsPoint(0, 2), QgsPoint(0, 0)]])
myPoint = QgsGeometry.fromPoint(QgsPoint(1, 1))
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def getQgisTestApp():
if QGISAPP is None:
myGuiFlag = True # All test will run qgis in gui mode
QGISAPP = QgsApplication(sys.argv, myGuiFlag)
if 'QGISPATH' in os.environ:
myPath = os.environ['QGISPATH']
if 'QGIS_PREFIX_PATH' in os.environ:
myPath = os.environ['QGIS_PREFIX_PATH']
myUseDefaultPathFlag = True
QGISAPP.setPrefixPath(myPath, myUseDefaultPathFlag)

Expand Down