Update entrances when entrance nodes are updated

This commit is contained in:
Emily Love Watson
2025-08-20 14:59:25 -05:00
parent 823ad5d279
commit e916d27b7c
10 changed files with 232 additions and 21 deletions

View File

@@ -0,0 +1,22 @@
Feature: Entrance nodes are recorded
Test that imported entrance nodes are saved
Scenario: A building with two entrances
Given the grid
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | geometry | extratags |
| W1 | building | yes | (1,2,3,4,1) | |
| N10 | entrance | main | 1 | 'wheelchair': 'yes' |
| N20 | entrance | yes | 3 | |
And the ways
| id | nodes |
| 1 | 10,20,30,40 |
When importing
Then placex contains exactly
| object | place_id |
| W1 | 1 |
Then place_entrance contains exactly
| place_id | entrances |
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 10, 'extratags': {'wheelchair': 'yes'}}, {'lat': 1e-05, 'lon': 1e-05, 'type': 'yes', 'osm_id': 20, 'extratags': {}}] |

View File

@@ -0,0 +1,82 @@
Feature: Entrance nodes are recorded
Test that updated entrance nodes are saved
Scenario: A building with a newly tagged entrance
Given the grid
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | geometry |
| W1 | building | yes | (1,2,3,4,1) |
And the ways
| id | nodes |
| 1 | 10,20,30,40 |
When importing
Then placex contains exactly
| object | place_id |
| W1 | 1 |
Then place_entrance contains exactly
| place_id | entrances |
When updating places
| osm | class | type | geometry |
| N10 | entrance | main | 1 |
Then placex contains exactly
| object | place_id |
| W1 | 1 |
And place_entrance contains exactly
| place_id | entrances |
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 10, 'extratags': None}] |
Scenario: A building with a updated entrance node
Given the grid
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | geometry |
| W1 | building | yes | (1,2,3,4,1) |
| N10 | barrier | gate | 1 |
And the ways
| id | nodes |
| 1 | 10,20,30,40 |
When importing
Then placex contains exactly
| object | place_id |
| W1 | 1 |
| N10 | 2 |
Then place_entrance contains exactly
| place_id | entrances |
When updating places
| osm | class | type | geometry |
| N10 | entrance | main | 1 |
Then placex contains exactly
| object | place_id |
| W1 | 1 |
| N10 | 2 |
And place_entrance contains exactly
| place_id | entrances |
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 10, 'extratags': None}] |
Scenario: A building with a removed entrance
Given the grid
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | geometry |
| W1 | building | yes | (1,2,3,4,1) |
| N10 | entrance | main | 1 |
And the ways
| id | nodes |
| 1 | 10,20,30,40 |
When importing
Then placex contains exactly
| object | place_id |
| W1 | 1 |
And place_entrance contains exactly
| place_id | entrances |
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 10, 'extratags': None}] |
When marking for delete N10
Then placex contains exactly
| object | place_id |
| W1 | 1 |
And place_entrance contains exactly
| place_id | entrances |