Skip to content
Permalink
Browse files

Fix broken handle bad layers dialog

Partially revert af0bae6 and ea2cc36

Fixes #20265
  • Loading branch information
nyalldawson committed Oct 29, 2018
1 parent f6aecd1 commit 0d7f59865b072c29f853513eb183c674585981ba
@@ -1991,6 +1991,10 @@ QStringList QgsGdalProvider::subLayers() const
return mSubLayers;
}

QGISEXTERN int dataCapabilities()
{
return QgsDataProvider::File | QgsDataProvider::Dir | QgsDataProvider::Net;
}

QGISEXTERN QVariantMap decodeUri( const QString &uri )
{
@@ -3397,6 +3397,11 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
return true;
}

QGISEXTERN int dataCapabilities()
{
return QgsDataProvider::File | QgsDataProvider::Dir;
}

QGISEXTERN QList< QgsDataItemProvider * > *dataItemProviders()
{
QList< QgsDataItemProvider * > *providers = new QList< QgsDataItemProvider * >();
@@ -62,6 +62,7 @@ ADD_PYTHON_TEST(PyQgsFilterLineEdit test_qgsfilterlineedit.py)
ADD_PYTHON_TEST(PyQgsFloatingWidget test_qgsfloatingwidget.py)
ADD_PYTHON_TEST(PyQgsFontButton test_qgsfontbutton.py)
ADD_PYTHON_TEST(PyQgsFontUtils test_qgsfontutils.py)
ADD_PYTHON_TEST(PyQgsGdalProvider test_provider_gdal.py)
ADD_PYTHON_TEST(PyQgsGeoNodeConnection test_qgsgeonodeconnection.py)
ADD_PYTHON_TEST(PyQgsGeometryAvoidIntersections test_qgsgeometry_avoid_intersections.py)
ADD_PYTHON_TEST(PyQgsGeometryGeneratorSymbolLayer test_qgsgeometrygeneratorsymbollayer.py)
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
"""Generic Unit tests for the GDAL provider.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author__ = 'Nyall Dawson'
__date__ = '2018-30-10'
__copyright__ = 'Copyright 2018, Nyall Dawson'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from qgis.core import (QgsProviderRegistry,
QgsDataProvider)
from qgis.testing import start_app, unittest

from utilities import unitTestDataPath

start_app()
TEST_DATA_DIR = unitTestDataPath()


class PyQgsGdalProvider(unittest.TestCase):

def testCapabilities(self):
self.assertTrue(QgsProviderRegistry.instance().providerCapabilities("gdal") & QgsDataProvider.File)
self.assertTrue(QgsProviderRegistry.instance().providerCapabilities("gdal") & QgsDataProvider.Dir)
self.assertTrue(QgsProviderRegistry.instance().providerCapabilities("gdal") & QgsDataProvider.Net)


if __name__ == '__main__':
unittest.main()
@@ -21,6 +21,7 @@
from qgis.PyQt.QtCore import QVariant
from qgis.core import (QgsApplication,
QgsRectangle,
QgsProviderRegistry,
QgsFeature, QgsFeatureRequest, QgsField, QgsSettings, QgsDataProvider,
QgsVectorDataProvider, QgsVectorLayer, QgsWkbTypes, QgsNetworkAccessManager)
from qgis.testing import start_app, unittest
@@ -72,6 +73,10 @@ def tearDownClass(cls):
for dirname in cls.dirs_to_cleanup:
shutil.rmtree(dirname, True)

def testCapabilities(self):
self.assertTrue(QgsProviderRegistry.instance().providerCapabilities("ogr") & QgsDataProvider.File)
self.assertTrue(QgsProviderRegistry.instance().providerCapabilities("ogr") & QgsDataProvider.Dir)

def testUpdateMode(self):

vl = QgsVectorLayer('{}|layerid=0'.format(self.datasource), 'test', 'ogr')

0 comments on commit 0d7f598

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