[postgis-tickets] r15129 - Fix test for getFaceByPoint to not rely on invalid topology
Sandro Santilli
strk at kbt.io
Thu Sep 22 09:10:44 PDT 2016
Author: strk
Date: 2016-09-22 09:10:43 -0700 (Thu, 22 Sep 2016)
New Revision: 15129
Modified:
trunk/topology/test/regress/getfacebypoint.sql
trunk/topology/test/regress/getfacebypoint_expected
Log:
Fix test for getFaceByPoint to not rely on invalid topology
Closes #3632
Modified: trunk/topology/test/regress/getfacebypoint.sql
===================================================================
--- trunk/topology/test/regress/getfacebypoint.sql 2016-09-21 22:21:23 UTC (rev 15128)
+++ trunk/topology/test/regress/getfacebypoint.sql 2016-09-22 16:10:43 UTC (rev 15129)
@@ -23,32 +23,38 @@
select topology.AddEdge('schema_topo',ST_GeomFromText('LINESTRING(6 10, 6 7)'));
select topology.AddEdge('schema_topo',ST_GeomFromText('LINESTRING(6 7, 4 7)'));
-select topology.addFace('schema_topo', 'POLYGON((1 2, 1 5, 10 5, 10 2, 1 2 ))');
-select topology.addFace('schema_topo', 'POLYGON((10 2, 10 5, 10 12, 10 14, 10 15, 15 15, 15 2, 10 2))');
-select topology.addFace('schema_topo', 'POLYGON((7 12, 7 15, 10 15, 10 14, 8 14, 8 12, 7 12))');
-select topology.addFace('schema_topo', 'POLYGON((1 5, 1 12, 7 12, 8 12, 10 12, 10 5, 1 5),(4 7, 4 10, 6 10, 6 7, 4 7))');
+select 'F1',topology.addFace('schema_topo', 'POLYGON((1 2, 1 5, 10 5, 10 2, 1 2 ))');
+select 'F2',topology.addFace('schema_topo', 'POLYGON((10 2, 10 5, 10 12, 10 14, 10 15, 15 15, 15 2, 10 2))');
+select 'F3',topology.addFace('schema_topo', 'POLYGON((7 12, 7 15, 10 15, 10 14, 8 14, 8 12, 7 12))');
+select 'F4',topology.addFace('schema_topo', 'POLYGON((1 5, 1 12, 7 12, 8 12, 10 12, 10 5, 1 5),(4 7, 4 10, 6 10, 6 7, 4 7))');
+select 'F5',topology.addFace('schema_topo', 'POLYGON((4 7,6 7,6 10,4 10,4 7))');
+select 'F6',topology.addFace('schema_topo', 'POLYGON((8 12,8 14,10 14,10 12,8 12))');
-- ask for a Point with tolerance zero
select 't1', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(7 7)'), 0::float8)::int;
-select 't2', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(6 7)'), 0::float8)::int;
-select 't3', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(5 7)'), 0::float8)::int;
+select 't2', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(12 8)'), 0::float8)::int;
+select 't3', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(4 3)'), 0::float8)::int;
--- ask for a Point where there isn't a Face
+-- ask for a Point within an hole
select 't4', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(9 13)'), 0::float8)::int;
select 't5', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(5 8)'), 0::float8)::int;
-- Ask for a point outside from an face but with a tolerance sufficient to include one face
-select 't6', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(8.5 13)'), 0.5::float8)::int;
-select 't7', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(5 8)'), 1::float8)::int;
+select 't6', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(6.5 13)'), 0.5::float8)::int;
+select 't7', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(3 13)'), 1::float8)::int;
+-- ask for a Point where there isn't a Face
+select 't8', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(5 14)'), 0::float8)::int;
+
+
-- Failing cases (should all raise exceptions) -------
-- Ask for Point in a Node (2 or more faces)
select 'e1', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(1 5)'), 0::float8)::int;
-- Ask for a Point with a tollerance too high (2 or more faces)
-select 'e2', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(9 13)'), 1::float8)::int;
+select 'e2', topology.GetFaceByPoint('schema_topo',ST_GeomFromText('POINT(6 13)'), 1::float8)::int;
SELECT topology.DropTopology('schema_topo');
Modified: trunk/topology/test/regress/getfacebypoint_expected
===================================================================
--- trunk/topology/test/regress/getfacebypoint_expected 2016-09-21 22:21:23 UTC (rev 15128)
+++ trunk/topology/test/regress/getfacebypoint_expected 2016-09-22 16:10:43 UTC (rev 15129)
@@ -19,17 +19,20 @@
18
19
20
-1
-2
-3
-4
+F1|1
+F2|2
+F3|3
+F4|4
+F5|5
+F6|6
t1|4
-t2|4
-t3|4
-t4|0
-t5|0
+t2|2
+t3|1
+t4|6
+t5|5
t6|3
t7|4
+t8|0
ERROR: Two or more faces found
ERROR: Two or more faces found
Topology 'schema_topo' dropped
More information about the postgis-tickets
mailing list