本文整理汇总了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)
示例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):