def setUp(self): super().setUp() global CANVAS, IFACE QGIS_APP, IFACE, CANVAS = get_qgis_app() if isinstance(IFACE, QgisStubInterface): self.window = QMainWindow() self.window.resize(QSize(800, 400)) self.window.setCentralWidget(CANVAS) else: self.window = None # try to get the current instance of coordinator: try: self.coordinator = qgis.utils.plugins['coordinator'] except KeyError: self.coordinator = Coordinator(IFACE, self.window) self.pluginWasOpen = self.coordinator.pluginIsActive if not self.coordinator.pluginIsActive: self.coordinator.run() self.coordinator.reset() self.coordinator.captureCoordsButtonToggled(False) self.dw = self.coordinator.dockwidget if self.window: self.window.show() self.addEuropeLayer() QTest.qWait(50)
def setUpClass(cls): super(CoordinatorDockWidgetTest, cls).setUpClass() # some tests may have used objects and the C++ objects # might have been deleted. lets make sure we have a clean # slate. global IFACE QGIS_APP, IFACE, CANVAS = get_qgis_app()
def setUpClass(cls): super(CoordinatorTestCase, CoordinatorIntegrationTest).setUpClass() # some tests may have used objects and the C++ objects # might have been deleted. lets make sure we have a clean # slate. global CANVAS, IFACE QGIS_APP, IFACE, CANVAS = get_qgis_app()
the Free Software Foundation; either version 2 of the License, or (at your option) any later version. """ __author__ = '*****@*****.**' __date__ = '20/01/2011' __copyright__ = ('Copyright 2012, Australia Indonesia Facility for ' 'Disaster Reduction') import os import unittest from qgis.core import (QgsProviderRegistry, QgsCoordinateReferenceSystem, QgsRasterLayer) from coordinator.test.utilities import get_qgis_app QGIS_APP, IFACE, CANVAS = get_qgis_app() class QGISTest(unittest.TestCase): """Test the QGIS Environment""" def test_qgis_environment(self): """QGIS environment has the expected providers""" r = QgsProviderRegistry.instance() self.assertIn('gdal', r.providerList()) self.assertIn('ogr', r.providerList()) self.assertIn('postgres', r.providerList()) def test_projection(self): """Test that QGIS properly parses a wkt string. """