-
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
no segregate quest on some rare weird cases
still ask about segregation if segregated=* is not tagged and way has footway:surface or cycleway:surface this allows to finish tagging where it is segregated and flag weird cases for followup checks with proper editor fixes #5213
- Loading branch information
1 parent
ffb674d
commit a0db1b4
Showing
2 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
...c/test/java/de/westnordost/streetcomplete/quests/segregated/AddCyclewaySegregationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package de.westnordost.streetcomplete.quests.segregated | ||
|
||
import de.westnordost.streetcomplete.data.osm.edits.update_tags.StringMapEntryAdd | ||
import de.westnordost.streetcomplete.quests.TestMapDataWithGeometry | ||
import de.westnordost.streetcomplete.quests.verifyAnswer | ||
import de.westnordost.streetcomplete.testutils.way | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class AddCyclewaySegregationTest { | ||
private val questType = AddCyclewaySegregation() | ||
|
||
@Test | ||
fun `sets expected tags on yes answer`() { | ||
questType.verifyAnswer( | ||
mapOf(), | ||
CyclewaySegregation.YES, | ||
StringMapEntryAdd("segregated", "yes"), | ||
) | ||
} | ||
|
||
@Test | ||
fun `not applicable to greengrocer shops`() { | ||
val mapData = TestMapDataWithGeometry( | ||
listOf( | ||
way(1, tags = mapOf("shop" to "greengrocer", "name" to "Foobar")), | ||
), | ||
) | ||
assertEquals(0, questType.getApplicableElements(mapData).toList().size) | ||
} | ||
|
||
@Test | ||
fun `not applicable to unpaved ways`() { | ||
val mapData = TestMapDataWithGeometry( | ||
listOf( | ||
way(1, tags = mapOf( | ||
"highway" to "path", | ||
"foot" to "designated", | ||
"bicycle" to "designated", | ||
"surface" to "gravel", | ||
) | ||
), | ||
), | ||
) | ||
assertEquals(0, questType.getApplicableElements(mapData).toList().size) | ||
} | ||
|
||
@Test | ||
fun `applicable to matching paved ways`() { | ||
val mapData = TestMapDataWithGeometry( | ||
listOf( | ||
way(1, tags = mapOf( | ||
"highway" to "path", | ||
"foot" to "designated", | ||
"bicycle" to "designated", | ||
"surface" to "asphalt", | ||
) | ||
), | ||
), | ||
) | ||
assertEquals(1, questType.getApplicableElements(mapData).toList().size) | ||
} | ||
|
||
@Test | ||
fun `applicable to ways which suggest split cycling and walking`() { | ||
// ask about segregation if segregated=* is not tagged | ||
// and way has footway:surface or cycleway:surface | ||
// this allows to finish tagging where it is segregated (as it usual is) | ||
// and review weird cases for followup checks | ||
val mapData = TestMapDataWithGeometry( | ||
listOf( | ||
way(1, tags = mapOf( | ||
"highway" to "path", | ||
"footway:surface" to "asphalt", | ||
"surface" to "asphalt", | ||
) | ||
), | ||
), | ||
) | ||
assertEquals(1, questType.getApplicableElements(mapData).toList().size) | ||
} | ||
|
||
@Test | ||
fun `not applicable to ways which ban cycling or walking`() { | ||
val mapData = TestMapDataWithGeometry( | ||
listOf( | ||
way(1, tags = mapOf( | ||
"highway" to "path", | ||
"footway:surface" to "asphalt", | ||
"surface" to "asphalt", | ||
"foot" to "private", | ||
) | ||
), | ||
), | ||
) | ||
assertEquals(0, questType.getApplicableElements(mapData).toList().size) | ||
} | ||
} |