Opened 6 years ago
Last modified 6 years ago
#17129 new defect
Cannot add assertMatch/assertNoMatch declarations with :selected pseudoclass
Reported by: | taylor.smock | Owned by: | team |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Core validator | Version: | latest |
Keywords: | mapcss | Cc: |
Description (last modified by )
It is not currently possible to do the following:
way[highway][turn:lanes][oneway][count(split("|", tag("turn:lanes"))) != tag("lanes")]:selected, way[highway][turn:lanes][!oneway][2 * count(split("|", tag("turn:lanes"))) != tag("lanes")]:selected, way[highway][turn:lanes][!lanes]:selected { throwWarning: tr("turn:lanes do not match lanes"); fixAdd: concat("lanes=", count(split("|", tag("turn.lanes"))); assertMatch: "way highway=primary lanes=4 turn:lanes=left|through|through;right"; assertNoMatch: "way highway=primary lanes=4 turn:lanes=left;through|through;right"; }
Since I've got another test without the :selected psuedoclass, I can move the assertMatch/assertNoMatch to that test, e.g.
way[highway][turn:lanes][oneway][count(split("|", tag("turn:lanes"))) != tag("lanes")], way[highway][turn:lanes][!oneway][2 * count(split("|", tag("turn:lanes"))) != tag("lanes")], way[highway][turn:lanes][!lanes] { throwWarning: tr("turn:lanes do not match lanes"); assertMatch: "way highway=primary lanes=4 turn:lanes=left|through|through;right"; assertNoMatch: "way highway=primary lanes=4 turn:lanes=left;through|through;right"; }
instead of
way[highway][turn:lanes][oneway][count(split("|", tag("turn:lanes"))) != tag("lanes")], way[highway][turn:lanes][!oneway][2 * count(split("|", tag("turn:lanes"))) != tag("lanes")], way[highway][turn:lanes][!lanes] { throwWarning: tr("turn:lanes do not match lanes"); }
and this should be possible for the vast majority of cases.
#17058 is similar, in that fake primitives are probably not selected when they should be (in that bug, the fake primitives where not being created in the country the tests where inside).
Use cases:
1) There is a common issue where the fix is almost always the same, but should be verified using aerial imagery/street level imagery, and selection is one way to ensure that.
Possible alternative: way|z21-[JOSM_search("inview")] {...} -- this is probably a much better alternative than the initial :selected for this use case.