QgsRectangle,
                       QgsRasterLayer,
                       QgsComposition,
                       QgsMapRenderer,
                       QgsMapLayerRegistry,
                       QgsMultiBandColorRenderer
                     )
from utilities import (unitTestDataPath,
                       getQgisTestApp,
                       TestCase,
                       unittest,
                       expectedFailure
                      )
from qgscompositionchecker import QgsCompositionChecker

QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()
TEST_DATA_DIR = unitTestDataPath()


class TestQgsComposerMap(TestCase):

    def __init__(self, methodName):
        """Run once on class initialisation."""
        unittest.TestCase.__init__(self, methodName)
        myPath = os.path.join(TEST_DATA_DIR, 'landsat.tif')
        rasterFileInfo = QFileInfo(myPath)
        mRasterLayer = QgsRasterLayer(rasterFileInfo.filePath(),
                                      rasterFileInfo.completeBaseName())
        rasterRenderer = QgsMultiBandColorRenderer(
            mRasterLayer.dataProvider(), 2, 3, 4)
        mRasterLayer.setRenderer(rasterRenderer)
예제 #2
0
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author__ = 'Matthias Kuhn'
__date__ = '12.8.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 qgis

from utilities import (unittest, TestCase, getQgisTestApp)
from qgis.core import (edit, QgsFeature, QgsGeometry, QgsVectorLayer,
                       QgsEditError)

getQgisTestApp()


class TestSyntacticSugar(TestCase):
    def testEdit(self):
        """Test `with edit(layer):` code"""

        ml = QgsVectorLayer(
            "Point?crs=epsg:4236&field=id:integer&field=value:double",
            "test_data", "memory")
        # Data as list of x, y, id, value
        assert ml.isValid()
        fields = ml.fields()

        # Check insert
        with edit(ml):
예제 #3
0
from qgis.core import (QgsComposition,
                       QgsPoint,
                       QgsRasterLayer,
                       QgsMultiBandColorRenderer,
                       QgsMapLayerRegistry,
                       QgsMapRenderer
                       )

from utilities import (unitTestDataPath,
                       getQgisTestApp,
                       TestCase,
                       unittest
                       #expectedFailure
                       )

QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()
TEST_DATA_DIR = unitTestDataPath()


class TestQgsComposition(TestCase):

    def setUp(self):
        """Run before each test."""
        pass

    def tearDown(self):
        """Run after each test."""
        pass

    def testSubstitutionMap(self):
        """Test that we can use degree symbols in substitutions.
예제 #4
0
__revision__ = '$Format:%H$'

import qgis

from utilities import (unittest,
                       TestCase,
                       getQgisTestApp
                       )
from qgis.core import (edit,
                       QgsFeature,
                       QgsGeometry,
                       QgsVectorLayer,
                       QgsEditError
                       )

getQgisTestApp()


class TestSyntacticSugar(TestCase):

    def testEdit(self):
        """Test `with edit(layer):` code"""

        ml = QgsVectorLayer("Point?crs=epsg:4236&field=id:integer&field=value:double",
                            "test_data", "memory")
        # Data as list of x, y, id, value
        assert ml.isValid()
        fields = ml.fields()

        # Check insert
        with edit(ml):