Skip to content
Permalink
Browse files

Fix tests

  • Loading branch information
nyalldawson committed Nov 26, 2017
1 parent f04587e commit a95aecafd6fefe701085a6259f7105147aca7438
@@ -32,6 +32,7 @@

from qgis.core import (QgsVectorFileWriter,
QgsMapLayer,
QgsDataProvider,
QgsRasterLayer,
QgsWkbTypes,
QgsVectorLayer,
@@ -309,7 +310,7 @@ def getRasterSublayer(path, param):
subLayer = subLayer[1:]
else:
# remove driver name and file name
subLayer.replace(subLayer.split(":")[0], "")
subLayer.replace(subLayer.split(QgsDataProvider.SUBLAYER_SEPARATOR)[0], "")
subLayer.replace(path, "")
# remove any : or " left over
if subLayer.startswith(":"):
@@ -138,12 +138,12 @@ void TestQgsRasterSubLayer::subLayersList()
Q_FOREACH ( const QString &s, mpRasterLayer->subLayers() )
{
qDebug() << "sublayer: " << s;
sublayers << s.split( QgsDataProvider::SUBLAYER_SEPARATOR ).last();
sublayers << s.split( ':' ).last();
}
qDebug() << "sublayers: " << sublayers.join( QStringLiteral( "," ) );
mReport += QStringLiteral( "sublayers:<br>%1<br>\n" ).arg( sublayers.join( QStringLiteral( "<br>" ) ) );
mReport += QStringLiteral( "expected:<br>%1<br>\n" ).arg( expected.join( QStringLiteral( "<br>" ) ) );
QVERIFY( sublayers == expected );
QCOMPARE( sublayers, expected );
mReport += QLatin1String( "<p>Passed</p>" );
}
}
@@ -18,7 +18,7 @@
import tempfile

from osgeo import gdal, ogr # NOQA
from qgis.core import (QgsFeature, QgsFeatureRequest, QgsSettings,
from qgis.core import (QgsFeature, QgsFeatureRequest, QgsSettings, QgsDataProvider,
QgsVectorDataProvider, QgsVectorLayer, QgsWkbTypes, QgsNetworkAccessManager)
from qgis.testing import start_app, unittest

@@ -111,7 +111,7 @@ def testMixOfPolygonCurvePolygon(self):
vl = QgsVectorLayer('{}|layerid=0'.format(datasource), 'test', 'ogr')
self.assertTrue(vl.isValid())
self.assertEqual(len(vl.dataProvider().subLayers()), 1)
self.assertEqual(vl.dataProvider().subLayers()[0], '0:testMixOfPolygonCurvePolygon:4:CurvePolygon:')
self.assertEqual(vl.dataProvider().subLayers()[0], QgsDataProvider.SUBLAYER_SEPARATOR.join(['0', 'testMixOfPolygonCurvePolygon', '4', 'CurvePolygon', '']))

def testMixOfLineStringCompoundCurve(self):

@@ -127,7 +127,7 @@ def testMixOfLineStringCompoundCurve(self):
vl = QgsVectorLayer('{}|layerid=0'.format(datasource), 'test', 'ogr')
self.assertTrue(vl.isValid())
self.assertEqual(len(vl.dataProvider().subLayers()), 1)
self.assertEqual(vl.dataProvider().subLayers()[0], '0:testMixOfLineStringCompoundCurve:5:CompoundCurve:')
self.assertEqual(vl.dataProvider().subLayers()[0], QgsDataProvider.SUBLAYER_SEPARATOR.join(['0', 'testMixOfLineStringCompoundCurve', '5', 'CompoundCurve', '']))

def testGpxElevation(self):
# GPX without elevation data

0 comments on commit a95aeca

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