mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Fixed #28841 -- Added ForcePolygonCW GIS function and deprecated ForceRHR.
This commit is contained in:
parent
44908d4d93
commit
aefe624c62
9 changed files with 73 additions and 20 deletions
|
@ -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)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue