Skip to content
Permalink
Browse files

Add polygon test for mssql provider

  • Loading branch information
nyalldawson committed Feb 2, 2016
1 parent c6c8277 commit 0a64c16e983922bab064c5edbce1b16453a92ddb
Showing with 18 additions and 3 deletions.
  1. +4 −1 tests/src/python/test_provider_mssql.py
  2. +14 −2 tests/testdata/provider/testdata_mssql.sql
@@ -38,10 +38,13 @@ def setUpClass(cls):
cls.dbconn = u"dbname='gis' host=localhost\sqlexpress"
if 'QGIS_MSSQLTEST_DB' in os.environ:
cls.dbconn = os.environ['QGIS_MSSQLTEST_DB']
# Create test layer
# Create test layers
cls.vl = QgsVectorLayer(cls.dbconn + ' sslmode=disable key=\'pk\' srid=4326 type=POINT table="qgis_test"."someData" (geom) sql=', 'test', 'mssql')
assert(cls.vl.isValid())
cls.provider = cls.vl.dataProvider()
cls.poly_vl = QgsVectorLayer(cls.dbconn + ' sslmode=disable key=\'pk\' srid=4326 type=POLYGON table="qgis_test"."some_poly_data" (geom) sql=', 'test', 'mssql')
assert(cls.poly_vl.isValid())
cls.poly_provider = cls.poly_vl.dataProvider()

@classmethod
def tearDownClass(cls):
@@ -6,7 +6,12 @@ CREATE TABLE qgis_test.[someData] (
name nvarchar(max) DEFAULT 'qgis',
name2 nvarchar(max) DEFAULT 'qgis',
geom geometry
)
);

CREATE TABLE qgis_test.[some_poly_data] (
pk integer PRIMARY KEY,
geom geometry
);

CREATE TABLE qgis_test.[date_times] (
id integer PRIMARY KEY,
@@ -15,7 +20,6 @@ CREATE TABLE qgis_test.[date_times] (
datetime_field datetime
);


INSERT INTO qgis_test.[someData] (pk, cnt, name, name2, geom) VALUES
(5, -200, NULL, 'NuLl', geometry::STGeomFromText( 'Point(-71.123 78.23)', 4326 )),
(3, 300, 'Pear', 'PEaR', NULL),
@@ -24,5 +28,13 @@ INSERT INTO qgis_test.[someData] (pk, cnt, name, name2, geom) VALUES
(4, 400, 'Honey', 'Honey', geometry::STGeomFromText( 'Point(-65.32 78.3)', 4326 ))
;

INSERT INTO qgis_test.[some_poly_data] (pk, geom) VALUES
(1, geometry::STGeomFromText('Polygon ((-69.0 81.4, -69.0 80.2, -73.7 80.2, -73.7 76.3, -74.9 76.3, -74.9 81.4, -69.0 81.4))', 4326 )),
(2, geometry::STGeomFromText('Polygon ((-67.6 81.2, -66.3 81.2, -66.3 76.9, -67.6 76.9, -67.6 81.2))', 4326 )),
(3, geometry::STGeomFromText('Polygon ((-68.4 75.8, -67.5 72.6, -68.6 73.7, -70.2 72.9, -68.4 75.8))', 4326 )),
(4, NULL)
;


INSERT INTO qgis_test.[date_times] (id, date_field, time_field, datetime_field ) VALUES
(1, '2004-03-04', '13:41:52', '2004-03-04 13:41:52' );

0 comments on commit 0a64c16

Please sign in to comment.
You can’t perform that action at this time.