From aefe624c62639c189845803f0935fc29e20b5fb8 Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Fri, 24 Nov 2017 22:30:53 +0500 Subject: Fixed #28841 -- Added ForcePolygonCW GIS function and deprecated ForceRHR. --- tests/gis_tests/geoapp/test_functions.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'tests') 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)), -- cgit v1.3