Skip to content
Permalink
Browse files

Added test for QgsMapLayerRegistry

See: PR #2534
  • Loading branch information
elpaso authored and m-kuhn committed Dec 5, 2015
1 parent 0e82974 commit 5a7ee20fa9dc7854c51c554cade7a826cf6b7a4f
Showing with 33 additions and 0 deletions.
  1. +2 −0 tests/src/python/CMakeLists.txt
  2. +31 −0 tests/src/python/test_qgsmaplayerregistry.py
@@ -61,6 +61,8 @@ ADD_PYTHON_TEST(PyQgsVectorColorRamp test_qgsvectorcolorramp.py)
ADD_PYTHON_TEST(PyQgsVectorFileWriter test_qgsvectorfilewriter.py)
ADD_PYTHON_TEST(PyQgsVectorLayer test_qgsvectorlayer.py)
ADD_PYTHON_TEST(PyQgsZonalStatistics test_qgszonalstatistics.py)
ADD_PYTHON_TEST(PyQgsMapLayerRegistry test_qgsmaplayerregistry.py)


IF (NOT WIN32)
ADD_PYTHON_TEST(PyQgsLogger test_qgslogger.py)
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsServer.
.. 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__ = 'Alessandro Pasotti'
__date__ = '04/12/2015'
__copyright__ = 'Copyright 2015, The QGIS Project'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import unittest
from qgis.core import QgsMapLayerRegistry


class TestQgsMapLayerRegistry(unittest.TestCase):

def setUp(self):
pass

def test_removeMapLayer(self):

This comment has been minimized.

Copy link
@NathanW2

NathanW2 Dec 7, 2015

Member

Might want to give you test methods at a better name: test_RemoveLayerShouldNotSegFault I like descriptive test method name :) Don't feel bad using long names no one is going to type it out.

reg = QgsMapLayerRegistry.instance()
# Should not segfault
reg.removeMapLayers(['not_exists'])


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

0 comments on commit 5a7ee20

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