Skip to content

Commit

Permalink
test method for qgssettings
Browse files Browse the repository at this point in the history
  • Loading branch information
vermeulendivan committed Nov 3, 2021
1 parent 5f336bd commit 998d0eb
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/test_qgis_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
from qgis.core import (
QgsProviderRegistry,
QgsCoordinateReferenceSystem,
QgsRasterLayer)
QgsRasterLayer,
QgsSettings)

from utilities_for_testing import get_qgis_app
QGIS_APP = get_qgis_app()
Expand Down Expand Up @@ -57,5 +58,21 @@ def test_projection(self):
auth_id = layer.crs().authid()
self.assertEqual(auth_id, expected_auth_id)

def test_qgs_settings(self):
"""Test that QGIS QgsSettings can correctly read existing settings or use default values correctly.
"""
settings = QgsSettings()

search_dis = settings.value("stream-feature-extractor/search-distance", 0, type=float)
intermediate_layer = settings.value("stream-feature-extractor/load-intermediate-layer", False, type=bool)
error_logging = settings.value("stream-feature-extractor/sentry-logging", False, type=bool)

self.assertTrue(0 <= search_dis <= 1)

self.assertIsInstance(intermediate_layer, bool)

self.assertIsInstance(error_logging, bool)


if __name__ == '__main__':
unittest.main()

0 comments on commit 998d0eb

Please sign in to comment.