diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2017-11-24 22:30:53 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-12-27 19:26:14 -0500 |
| commit | aefe624c62639c189845803f0935fc29e20b5fb8 (patch) | |
| tree | 01c1dd7922645a1ac68f0eb3ca4f45dc9ec68834 /tests | |
| parent | 44908d4d9360f72b9511aa0a878458285ba326d4 (diff) | |
Fixed #28841 -- Added ForcePolygonCW GIS function and deprecated ForceRHR.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/geoapp/test_functions.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py index 33fe139fb0..2449650567 100644 --- a/tests/gis_tests/geoapp/test_functions.py +++ b/tests/gis_tests/geoapp/test_functions.py @@ -10,7 +10,8 @@ from django.contrib.gis.geos import ( from django.contrib.gis.measure import Area from django.db import NotSupportedError, connection from django.db.models import Sum -from django.test import TestCase, skipUnlessDBFeature +from django.test import TestCase, ignore_warnings, skipUnlessDBFeature +from django.utils.deprecation import RemovedInDjango30Warning from ..utils import FuncTestMixin, mysql, oracle, postgis, spatialite from .models import City, Country, CountryWebMercator, State, Track @@ -215,7 +216,22 @@ class GISFunctionsTests(FuncTestMixin, TestCase): for country in countries: self.assertIsInstance(country.envelope, Polygon) + @skipUnlessDBFeature("has_ForcePolygonCW_function") + def test_force_polygon_cw(self): + rings = ( + ((0, 0), (5, 0), (0, 5), (0, 0)), + ((1, 1), (1, 3), (3, 1), (1, 1)), + ) + rhr_rings = ( + ((0, 0), (0, 5), (5, 0), (0, 0)), + ((1, 1), (3, 1), (1, 3), (1, 1)), + ) + State.objects.create(name='Foo', poly=Polygon(*rings)) + st = State.objects.annotate(force_polygon_cw=functions.ForcePolygonCW('poly')).get(name='Foo') + self.assertEqual(rhr_rings, st.force_polygon_cw.coords) + @skipUnlessDBFeature("has_ForceRHR_function") + @ignore_warnings(category=RemovedInDjango30Warning) def test_force_rhr(self): rings = ( ((0, 0), (5, 0), (0, 5), (0, 0)), |
