当前位置: 首页>>代码示例>>Python>>正文


Python utilities.getQgisTestApp函数代码示例

本文整理汇总了Python中utilities.getQgisTestApp函数的典型用法代码示例。如果您正苦于以下问题:Python getQgisTestApp函数的具体用法?Python getQgisTestApp怎么用?Python getQgisTestApp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getQgisTestApp函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: import

                       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)
开发者ID:Arctictern265,项目名称:Quantum-GIS,代码行数:31,代码来源:test_qgscomposermap.py

示例2: import

__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):
开发者ID:Geoneer,项目名称:QGIS,代码行数:31,代码来源:test_syntactic_sugar.py


注:本文中的utilities.getQgisTestApp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。