Skip to content

Commit 94bc415

Browse files
committedOct 5, 2012
Added simple point test used in demo at hackfest in Essen
1 parent 3da3fd6 commit 94bc415

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
 

‎tests/src/python/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ ADD_PYTHON_TEST(PyQgsComposition test_qgscomposition.py)
1414
ADD_PYTHON_TEST(PyQgsAnalysis test_qgsanalysis.py)
1515
#ADD_PYTHON_TEST(PyQgsComposerMap test_qgscomposermap.py)
1616
ADD_PYTHON_TEST(PyQgsSymbolLayerV2 test_qgssymbollayerv2.py)
17+
ADD_PYTHON_TEST(PyQgsPoint test_qgspoint.py)

‎tests/src/python/test_qgsgeometry.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
unittest)
2424
# Convenience instances in case you may need them
2525
# not used in this test
26+
2627
QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()
2728

2829
class TestQgsGeometry(TestCase):

‎tests/src/python/test_qgspoint.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -*- coding: utf-8 -*-
2+
"""QGIS Unit tests for QgsPoint.
3+
4+
.. note:: This program is free software; you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation; either version 2 of the License, or
7+
(at your option) any later version.
8+
"""
9+
__author__ = 'Tim Sutton'
10+
__date__ = '20/08/2012'
11+
__copyright__ = 'Copyright 2012, The Quantum GIS Project'
12+
# This will get replaced with a git SHA1 when you do a git archive
13+
__revision__ = '$Format:%H$'
14+
15+
import os
16+
17+
from qgis.core import QgsPoint
18+
19+
from utilities import (unitTestDataPath,
20+
getQgisTestApp,
21+
TestCase,
22+
unittest,
23+
expectedFailure
24+
)
25+
26+
QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()
27+
28+
class TestQgsPoint(TestCase):
29+
30+
def __init__(self, methodName):
31+
"""Run once on class initialisation."""
32+
unittest.TestCase.__init__(self, methodName)
33+
34+
35+
def setUp(self):
36+
self.mPoint = QgsPoint(10.0, 10.0)
37+
38+
def test_Point(self):
39+
myExpectedValue = 10.0
40+
myActualValue = self.mPoint.x()
41+
myMessage = 'Expected: %s Got: %s' % (myExpectedValue, myActualValue)
42+
assert myExpectedValue == myActualValue, myMessage
43+
44+
45+
def test_pointToString(self):
46+
myExpectedValue = '10, 10'
47+
myActualValue = self.mPoint.toString()
48+
myMessage = 'Expected: %s Got: %s' % (myExpectedValue, myActualValue)
49+
assert myExpectedValue == myActualValue, myMessage
50+
51+
52+
if __name__ == '__main__':
53+
unittest.main()

0 commit comments

Comments
 (0)
Please sign in to comment.