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 29, 2020
1 parent 8dadfa4 commit ac4dc39
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/src/3d/testqgstessellator.cpp
Expand Up @@ -138,6 +138,7 @@ class TestQgsTessellator : public QObject
void testCrashEmptyPolygon();
void testBoundsScaling();
void testNoZ();
void testCrash2DTriangle();

private:
};
Expand Down Expand Up @@ -386,6 +387,14 @@ void TestQgsTessellator::testNoZ()
QVERIFY( checkTriangleOutput( t.data(), false, tc ) );
}

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 )
#include "testqgstessellator.moc"

0 comments on commit ac4dc39

Please sign in to comment.