Skip to content

Commit

Permalink
Added test for tessellator fix
Browse files Browse the repository at this point in the history
(cherry picked from commit 7cc0d92)
  • Loading branch information
uclaros authored and nyalldawson committed Apr 30, 2020
1 parent f8cd238 commit 4e67318
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/src/3d/testqgstessellator.cpp
Expand Up @@ -139,6 +139,7 @@ class TestQgsTessellator : public QObject
void testBoundsScaling(); void testBoundsScaling();
void testNoZ(); void testNoZ();
void testTriangulationDoesNotCrash(); void testTriangulationDoesNotCrash();
void testCrash2DTriangle();


private: private:
}; };
Expand Down Expand Up @@ -397,6 +398,14 @@ void TestQgsTessellator::testTriangulationDoesNotCrash()
t.addPolygon( polygon, 0 ); t.addPolygon( polygon, 0 );
} }


void TestQgsTessellator::testCrash2DTriangle()
{
// test tessellation of a 2D triangle - https://github.com/qgis/QGIS/issues/36024
QgsPolygon polygon;
polygon.fromWkt( "Polygon((0 0, 42 0, 42 42, 0 0))" );
QgsTessellator t( 0, 0, true );
t.addPolygon( polygon, 0 ); // must not crash - that's all we test here
}


QGSTEST_MAIN( TestQgsTessellator ) QGSTEST_MAIN( TestQgsTessellator )
#include "testqgstessellator.moc" #include "testqgstessellator.moc"

0 comments on commit 4e67318

Please sign in to comment.