Skip to content

Commit

Permalink
[virtuallayer] Fix GUI part missing from the virtual layuer provider (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Nov 23, 2021
1 parent 6eda6e4 commit 54ad83a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/providers/virtual/CMakeLists.txt
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions tests/src/python/CMakeLists.txt
Expand Up @@ -389,6 +389,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()
Expand Down
49 changes: 49 additions & 0 deletions tests/src/python/test_qgsproviderguiregistry.py
@@ -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 54ad83a

Please sign in to comment.