Skip to content
Permalink
Browse files
[virtuallayer] Fix GUI part missing from the virtual layuer provider (#…
  • Loading branch information
qgis-bot committed Nov 24, 2021
1 parent 7101475 commit 448dcf318fd1d432c9c6fc9f96b3d2dc65405e9d
Showing with 54 additions and 1 deletion.
  1. +1 −1 src/providers/virtual/CMakeLists.txt
  2. +4 −0 tests/src/python/CMakeLists.txt
  3. +49 −0 tests/src/python/test_qgsproviderguiregistry.py
@@ -86,7 +86,7 @@ if (FORCE_STATIC_LIBS)
install (TARGETS provider_virtuallayer_gui_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
endif()
else()
add_library(provider_virtuallayer MODULE ${VLAYER_PROVIDER_SRCS} ${VLAYER_PROVIDER_HDRS} ${VLAYER_PROVIDER_UIS_H} ${VLAYER_SQL_FUNCTIONS_RCCS})
add_library(provider_virtuallayer MODULE ${VLAYER_PROVIDER_SRCS} ${VLAYER_PROVIDER_HDRS} ${VLAYER_PROVIDER_GUI_SRCS} ${VLAYER_PROVIDER_GUI_HDRS} ${VLAYER_PROVIDER_UIS_H} ${VLAYER_SQL_FUNCTIONS_RCCS})

# require c++17
target_compile_features(provider_virtuallayer PRIVATE cxx_std_17)
@@ -385,6 +385,10 @@ if (NOT WIN32)
endif()
endif()

if (WITH_GUI)
ADD_PYTHON_TEST(PyQgsProviderGuiRegistry test_qgsproviderguiregistry.py WITH_SPATIALITE=${WITH_SPATIALITE})
endif()

if (WITH_DESKTOP)
ADD_PYTHON_TEST(PyQgsAppStartup test_qgsappstartup.py)
endif()
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsProviderGuiRegistry.
.. 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__ = 'Mathieu Pellerin'
__date__ = '23/11/2021'
__copyright__ = 'Copyright 2021, The QGIS Project'

import sys
import qgis # NOQA

from qgis.gui import (
QgsGui,
QgsProviderGuiRegistry
)
from qgis.testing import start_app, unittest
from utilities import unitTestDataPath

# Convenience instances in case you may need them
# to find the srs.db
start_app()


class TestQgsProviderGuiRegistry(unittest.TestCase):

def testProviderList(self):
"""
Test provider list
"""
providers = QgsGui.providerGuiRegistry().providerList()
self.assertIn('ogr', providers)
self.assertIn('gdal', providers)
self.assertIn('wms', providers)
self.assertIn('wms', providers)
self.assertIn('wcs', providers)
self.assertIn('delimitedtext', providers)
self.assertIn('arcgisfeatureserver', providers)
if 'WITH_SPATIALITE=TRUE' in sys.argv:
self.assertIn('spatialite', providers)
self.assertIn('WFS', providers)
self.assertIn('virtual', providers)


if __name__ == '__main__':
unittest.main(argv=['WITH_SPATIALITE'], exit=False)

0 comments on commit 448dcf3

Please sign in to comment.