Skip to content

Commit

Permalink
run PyQgsDistanceArea in C locale
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Feb 29, 2016
1 parent 796b8bd commit 143f3d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/src/python/test_qgsdistancearea.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
from qgis.testing import (start_app,
unittest)

from PyQt4.QtCore import QLocale

# Convenience instances in case you may need them
# not used in this test

Expand Down Expand Up @@ -302,6 +304,7 @@ def testAreaMeasureAndUnits(self):

def testFormatDistance(self):
"""Test formatting distances"""
QLocale.setDefault(QLocale.c())
self.assertEqual(QgsDistanceArea.formatDistance(45, 3, QGis.Meters), u'45.000 m')
self.assertEqual(QgsDistanceArea.formatDistance(1300, 1, QGis.Meters, False), u'1.3 km')
self.assertEqual(QgsDistanceArea.formatDistance(.005, 1, QGis.Meters, False), u'5.0 mm')
Expand Down Expand Up @@ -329,6 +332,7 @@ def testFormatDistance(self):
self.assertEqual(QgsDistanceArea.formatDistance(1.5, 1, QGis.Degrees, True), u'1.5 degrees')
self.assertEqual(QgsDistanceArea.formatDistance(1.0, 1, QGis.Degrees, False), u'1.0 degree')
self.assertEqual(QgsDistanceArea.formatDistance(1.0, 1, QGis.UnknownUnit, False), u'1.0')
QLocale.setDefault(QLocale.system())

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

0 comments on commit 143f3d6

Please sign in to comment.