From 6388c57c6cc61301082676b3969be1d084200d0e Mon Sep 17 00:00:00 2001 From: Matija Nalis Date: Sat, 13 Apr 2024 22:34:29 +0000 Subject: [PATCH] Do not ask width in endless loop on segments of road tagged with traffic_calming=choker (#5578) * do not ask for width if it is choker which already has maxwidth * traffic_calming=choker related tests --- .../quests/width/AddRoadWidth.kt | 1 + .../quests/width/AddRoadWidthTest.kt | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/width/AddRoadWidth.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/width/AddRoadWidth.kt index 734085ac61..77ad5007bc 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/width/AddRoadWidth.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/width/AddRoadWidth.kt @@ -44,6 +44,7 @@ class AddRoadWidth( ) and area != yes and (!width or source:width ~ ".*estimat.*") + and (traffic_calming !~ ${ROAD_NARROWERS.joinToString("|")} or !maxwidth or source:maxwidth ~".*estimat.*") and (surface ~ ${ANYTHING_PAVED.joinToString("|")} or highway ~ ${ROADS_ASSUMED_TO_BE_PAVED.joinToString("|")}) and (access !~ private|no or (foot and foot !~ private|no)) and foot != no diff --git a/app/src/test/java/de/westnordost/streetcomplete/quests/width/AddRoadWidthTest.kt b/app/src/test/java/de/westnordost/streetcomplete/quests/width/AddRoadWidthTest.kt index a414d195bf..6e493835ce 100644 --- a/app/src/test/java/de/westnordost/streetcomplete/quests/width/AddRoadWidthTest.kt +++ b/app/src/test/java/de/westnordost/streetcomplete/quests/width/AddRoadWidthTest.kt @@ -77,6 +77,32 @@ class AddRoadWidthTest { )))) } + @Test fun `is applicable to road with choker`() { + assertTrue(quest.isApplicableTo(way(tags = mapOf( + "maxspeed" to "DE:zone30", + "highway" to "residential", + "surface" to "asphalt", + "traffic_calming" to "choker" + )))) + } + + @Test fun `is not applicable to road with choker and maxwidth`() { + assertFalse(quest.isApplicableTo(way(tags = mapOf( + "maxspeed" to "DE:zone30", + "highway" to "residential", + "surface" to "asphalt", + "traffic_calming" to "choker", + "maxwidth" to "3" + )))) + assertFalse(quest.isApplicableTo(way(tags = mapOf( + "maxspeed" to "DE:zone30", + "highway" to "residential", + "surface" to "asphalt", + "traffic_calming" to "choker", + "width" to "3" + )))) + } + @Test fun `apply to street`() { assertEquals( setOf(StringMapEntryAdd("width", "3")),