Exemplo n.º 1
0
    def __init__(self, methodName):
        """Run once on class initialization."""
        unittest.TestCase.__init__(self, methodName)

        self.loaded = False

        self.app = QCoreApplication([])
Exemplo n.º 2
0
import sys
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (QgsApplication)
from qgis.testing import unittest
"""
Really important!! This test is designed to ensure that the members
which usually belong to a QgsApplication instance are still usable
when no QgsApplication instance is available (eg when using
custom editor widgets in QtDesigner). In this case QgsApplication
falls back to static members, which this test is designed to check.

So don't add start_app here or anything else which creates a
QgsApplication instance!
"""

app = QCoreApplication(sys.argv)


class TestQgsNoApplication(unittest.TestCase):
    def testMembers(self):
        self.assertTrue(QgsApplication.actionScopeRegistry())
        # self.assertTrue(QgsApplication.annotationRegistry()) NOT AVAILABLE IN BINDINGS
        self.assertTrue(QgsApplication.colorSchemeRegistry())
        self.assertTrue(QgsApplication.fieldFormatterRegistry())
        self.assertTrue(QgsApplication.gpsConnectionRegistry())
        self.assertTrue(QgsApplication.messageLog())
        self.assertTrue(QgsApplication.paintEffectRegistry())
        self.assertTrue(QgsApplication.pluginLayerRegistry())
        self.assertTrue(QgsApplication.processingRegistry())
        self.assertTrue(QgsApplication.profiler())
        # self.assertTrue(QgsApplication.rasterRendererRegistry()) NOT AVAILABLE IN BINDINGS