# -*- encoding: utf-8 -*-
from . import FixtureTest


class AerodromeTest(FixtureTest):

    def test_sfo(self):
        # SFO should be "international": both the polygon _and_ the POI.
        import dsl

        z, x, y = (13, 1311, 3170)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/545819287
            dsl.way(545819287, dsl.box_area(z, x, y, 12545795), {
                'aerodrome': 'international',
                'aerodrome:type': 'public',
                'aeroway': 'aerodrome',
                'city_served': 'San Francisco, California',
                'ele': '4',
                'iata': 'SFO',
                'icao': 'KSFO',
                'name': 'San Francisco International Airport',
                'source': 'openstreetmap.org',
                'wikidata': 'Q8688',
                'wikipedia': 'en:San Francisco International Airport',
            }),
        )

        # POI
        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 545819287,
                'kind': 'aerodrome',
                'kind_detail': 'international',
            })

        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 545819287,
                'kind': 'aerodrome',
                'kind_detail': 'international',
            })

@@ -364,34 +364,24 @@
 dsl.
-box_area(z, x, y, 12545795
+tile_box(z, x, y
 ), %7B
@@ -896,16 +896,370 @@
     %7D),%0A
+            # https://www.openstreetmap.org/way/22567191%0A            dsl.way(22567191, dsl.tile_diagonal(z, x, y), %7B%0A                'aeroway': 'runway',%0A                'length': '3618',%0A                'ref': '10L/28R',%0A                'surface': 'asphalt',%0A                'width': '61',%0A                'source': 'openstreetmap.org',%0A            %7D),%0A
         
@@ -1602,32 +1602,32 @@
 ': 'aerodrome',%0A
-
                 
@@ -1653,28 +1653,307 @@
 ernational',%0A            %7D)%0A
+%0A        # runway inside polygon%0A        self.assert_has_feature(%0A            z, x, y, 'roads', %7B%0A                'id': 22567191,%0A                'kind': 'aeroway',%0A                'kind_detail': 'runway',%0A                'aerodrome_kind_detail': 'international',%0A            %7D)%0A

Add test for runway inside of an aerodrome polygon where the polygon has a back-filled kind_detail.