Changeset 17098 in josm


Ignore:
Timestamp:
2020-10-07T19:51:38+02:00 (4 years ago)
Author:
GerdP
Message:

fix #19871: TurnrestrictionTest cannot cope with read-only datasets.
Don't add temporary way for test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TurnrestrictionTest.java

    r15071 r17098  
    257257                return;
    258258            }
    259             final Way viaPseudoWay = new Way();
    260             viaPseudoWay.addNode(viaNode);
    261             checkIfConnected(r, fromWay, viaPseudoWay,
    262                     tr("The \"from\" way does not start or end at a \"via\" node."), FROM_VIA_NODE);
    263             checkIfConnected(r, viaPseudoWay, toWay,
    264                     tr("The \"to\" way does not start or end at a \"via\" node."), TO_VIA_NODE);
     259            if (!fromWay.isFirstLastNode(viaNode)) {
     260                errors.add(TestError.builder(this, Severity.WARNING, FROM_VIA_NODE)
     261                        .message(tr("The \"from\" way does not start or end at a \"via\" node."))
     262                        .primitives(r, fromWay, viaNode)
     263                        .highlight(fromWay, viaNode)
     264                        .build());
     265            }
     266            if (!toWay.isFirstLastNode(viaNode)) {
     267                errors.add(TestError.builder(this, Severity.WARNING, TO_VIA_NODE)
     268                        .message(tr("The \"to\" way does not start or end at a \"via\" node."))
     269                        .primitives(r, toWay, viaNode)
     270                        .highlight(toWay, viaNode)
     271                        .build());
     272            }
    265273        } else {
    266274            if (isFullOneway(toWay) && ((Way) via.get(via.size() - 1)).isFirstLastNode(toWay.lastNode(true))) {
     
    316324        }
    317325        if (!c) {
    318             List<OsmPrimitive> hilite = new ArrayList<>();
    319             if (previous.getNodesCount() == 1 && previous.isNew())
    320                 hilite.add(previous.firstNode());
    321             else
    322                 hilite.add(previous);
    323             if (current.getNodesCount() == 1 && current.isNew())
    324                 hilite.add(current.firstNode());
    325             else
    326                 hilite.add(current);
    327             List<OsmPrimitive> primitives = new ArrayList<>();
    328             primitives.add(r);
    329             primitives.addAll(hilite);
    330326            errors.add(TestError.builder(this, Severity.ERROR, code)
    331327                    .message(msg)
    332                     .primitives(primitives)
    333                     .highlight(hilite)
     328                    .primitives(r, previous, current)
     329                    .highlight(previous, current)
    334330                    .build());
    335331        }
Note: See TracChangeset for help on using the changeset viewer.