From 574772c0871617a9cfb69d46465bb9db7f06b9e6 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 16 Feb 2011 08:54:03 +0000 Subject: [PATCH] Regression test for ST_isValidDetail (including "ESRI" flag) [RT-SIGTA] git-svn-id: http://svn.osgeo.org/postgis/trunk@6826 b70326c6-7e19-0410-871a-916f4a2858ee --- regress/Makefile.in | 3 ++- regress/isvaliddetail.sql | 41 ++++++++++++++++++++++++++++++++++ regress/isvaliddetail_expected | 6 +++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 regress/isvaliddetail.sql create mode 100644 regress/isvaliddetail_expected diff --git a/regress/Makefile.in b/regress/Makefile.in index 3d293a4ee..1f4071d63 100644 --- a/regress/Makefile.in +++ b/regress/Makefile.in @@ -73,7 +73,8 @@ TESTS = \ wmsservers_new \ tickets \ remove_repeated_points \ - split + split \ + isvaliddetail # TESTS += wmsservers_old # Styled buffer only if GEOS >= 3.2 diff --git a/regress/isvaliddetail.sql b/regress/isvaliddetail.sql new file mode 100644 index 000000000..552ae1c2e --- /dev/null +++ b/regress/isvaliddetail.sql @@ -0,0 +1,41 @@ +select 1, valid, reason, st_astext(location) FROM ( + SELECT (ST_IsValidDetail('LINESTRING (70 250, 190 340)')).* +) foo; + +select 2, valid, reason, st_astext(location) FROM ( + SELECT (ST_IsValidDetail('LINESTRING (70 250, 70 250)')).* +) foo; + +-- Twisted polygon +select 3, valid, reason, st_astext(location) FROM ( + SELECT (ST_IsValidDetail( +'POLYGON ((70 250, 70 500, 80 400, 40 400, 70 250))' + )).* +) foo; + +-- Twisted polygon is also invalid for ESRI +select 4, valid, reason, st_astext(location) FROM ( + SELECT (ST_IsValidDetail( +'POLYGON ((70 250, 70 500, 80 400, 40 400, 70 250))' + , + 1 -- ESRI flag + )).* +) foo; + +-- Self-touching ring forming hole +select 5, valid, reason, st_astext(location) FROM ( + SELECT (ST_IsValidDetail( +'POLYGON ((70 250, 40 500, 100 400, 70 250, 80 350, 60 350, 70 250))' + , + 0 -- No flags + )).* +) foo; + +-- Self-touching ring forming hole with ESRI flag +select 6, valid, reason, st_astext(location) FROM ( + SELECT (ST_IsValidDetail( +'POLYGON ((70 250, 40 500, 100 400, 70 250, 80 350, 60 350, 70 250))' + , + 1 -- ESRI flag + )).* +) foo; diff --git a/regress/isvaliddetail_expected b/regress/isvaliddetail_expected new file mode 100644 index 000000000..50a057ca5 --- /dev/null +++ b/regress/isvaliddetail_expected @@ -0,0 +1,6 @@ +1|t|| +2|f|Too few points in geometry component|POINT(70 250) +3|f|Self-intersection|POINT(70 400) +4|f|Self-intersection|POINT(70 400) +5|f|Ring Self-intersection|POINT(70 250) +6|t|| -- 2.50.1