mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
prevent degenerate ways caused by deleting a corner of a triangle (#10003)
This commit is contained in:
@@ -278,10 +278,11 @@ describe('iD.actionCircularize', function () {
|
||||
var graph = iD.coreGraph([
|
||||
iD.osmNode({id: 'a', loc: [0, 0]}),
|
||||
iD.osmNode({id: 'b', loc: [0, 2]}),
|
||||
iD.osmWay({id: '-', nodes: ['a', 'b', 'a']})
|
||||
iD.osmNode({id: 'c', loc: [2, 0]}),
|
||||
iD.osmWay({id: '-', nodes: ['a', 'b', 'c', 'a']})
|
||||
]);
|
||||
|
||||
expect(area('-', graph)).to.eql(0);
|
||||
expect(area('-', graph)).to.eql(2);
|
||||
|
||||
graph = iD.actionCircularize('-', projection)(graph);
|
||||
|
||||
|
||||
@@ -473,6 +473,10 @@ describe('iD.osmWay', function() {
|
||||
expect(iD.osmWay({nodes: ['a', 'b']}).isDegenerate()).to.equal(false);
|
||||
});
|
||||
|
||||
it('returns true for a linear way that doubles back on itself', function () {
|
||||
expect(iD.osmWay({nodes: ['a', 'b', 'a']}).isDegenerate()).to.equal(true);
|
||||
});
|
||||
|
||||
it('returns true for an area with zero, one, or two unique nodes', function () {
|
||||
expect(iD.osmWay({tags: {area: 'yes'}, nodes: []}).isDegenerate()).to.equal(true);
|
||||
expect(iD.osmWay({tags: {area: 'yes'}, nodes: ['a', 'a']}).isDegenerate()).to.equal(true);
|
||||
|
||||
Reference in New Issue
Block a user