Changeset 19175 in josm for trunk/test/unit


Ignore:
Timestamp:
2024-08-08T16:48:41+02:00 (4 months ago)
Author:
taylor.smock
Message:

Fix #23846: Setting all referrers downloaded doesn't happen if the target object has been modified

This may also fix (or partially fix) #23808 and #23810.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java

    r18853 r19175  
    1414import java.time.Instant;
    1515import java.util.Arrays;
     16import java.util.function.BiConsumer;
     17import java.util.stream.Stream;
    1618
    1719import org.junit.jupiter.api.AfterEach;
    1820import org.junit.jupiter.api.BeforeEach;
    1921import org.junit.jupiter.api.Test;
     22import org.junit.jupiter.params.ParameterizedTest;
     23import org.junit.jupiter.params.provider.MethodSource;
    2024import org.openstreetmap.josm.data.coor.LatLon;
    2125import org.openstreetmap.josm.data.projection.ProjectionRegistry;
     
    13571361    }
    13581362
     1363    static Stream<BiConsumer<Node, Node>> testNonRegression23846() {
     1364        return Stream.of(
     1365                (firstNode, secondNode) -> firstNode.setModified(true),
     1366                (firstNode, secondNode) -> { /* No modifications */ }
     1367        );
     1368    }
     1369
     1370    @ParameterizedTest
     1371    @MethodSource
     1372    void testNonRegression23846(BiConsumer<Node, Node> nodeSetup) {
     1373        final Node firstNode = new Node(1234, 1);
     1374        final Node secondNode = new Node(1234, 1);
     1375        final DataSetMerger merge = new DataSetMerger(my, their);
     1376        firstNode.setCoor(LatLon.ZERO);
     1377        secondNode.setCoor(LatLon.ZERO);
     1378        nodeSetup.accept(firstNode, secondNode);
     1379        my.addPrimitive(firstNode);
     1380        their.addPrimitive(secondNode);
     1381        secondNode.setReferrersDownloaded(true);
     1382        assertFalse(firstNode.isReferrersDownloaded());
     1383        assertTrue(secondNode.isReferrersDownloaded());
     1384        merge.merge();
     1385        assertTrue(firstNode.isReferrersDownloaded());
     1386        assertTrue(secondNode.isReferrersDownloaded());
     1387    }
    13591388}
Note: See TracChangeset for help on using the changeset viewer.