Skip to content
Permalink
Browse files

Indentation update

  • Loading branch information
m-kuhn committed Dec 10, 2015
1 parent c854d05 commit 8a9399095bce98ddba1e4840a4e2052cf20846c5
@@ -37,7 +37,7 @@ def testComposition(self, page=0, pixelDiff=0):
myMessage = "Composition not valid"
return False, myMessage

#load expected image
# load expected image
self.setControlName("expected_" + self.mTestName)

# get width/height, create image and render the composition to it
@@ -102,14 +102,14 @@ def __init__(self, methodName):
def testVectorBlending(self):
"""Test that blend modes work for vector layers."""

#Add vector layers to map
# Add vector layers to map
myLayers = []
myLayers.append(self.mLineLayer.id())
myLayers.append(self.mPolygonLayer.id())
self.mapSettings.setLayers(myLayers)
self.mapSettings.setExtent(self.extent)

#Set blending modes for both layers
# Set blending modes for both layers
self.mLineLayer.setBlendMode(QPainter.CompositionMode_Difference)
self.mPolygonLayer.setBlendMode(QPainter.CompositionMode_Difference)

@@ -122,21 +122,21 @@ def testVectorBlending(self):
myMessage = ('vector blending failed')
assert myResult, myMessage

#Reset layers
# Reset layers
self.mLineLayer.setBlendMode(QPainter.CompositionMode_SourceOver)
self.mPolygonLayer.setBlendMode(QPainter.CompositionMode_SourceOver)

def testVectorFeatureBlending(self):
"""Test that feature blend modes work for vector layers."""

#Add vector layers to map
# Add vector layers to map
myLayers = []
myLayers.append(self.mLineLayer.id())
myLayers.append(self.mPolygonLayer.id())
self.mapSettings.setLayers(myLayers)
self.mapSettings.setExtent(self.extent)

#Set feature blending for line layer
# Set feature blending for line layer
self.mLineLayer.setFeatureBlendMode(QPainter.CompositionMode_Plus)

checker = QgsMultiRenderChecker()
@@ -148,20 +148,20 @@ def testVectorFeatureBlending(self):
myMessage = ('vector feature blending failed')
assert myResult, myMessage

#Reset layers
# Reset layers
self.mLineLayer.setFeatureBlendMode(QPainter.CompositionMode_SourceOver)

def testVectorLayerTransparency(self):
"""Test that layer transparency works for vector layers."""

#Add vector layers to map
# Add vector layers to map
myLayers = []
myLayers.append(self.mLineLayer.id())
myLayers.append(self.mPolygonLayer.id())
self.mapSettings.setLayers(myLayers)
self.mapSettings.setExtent(self.extent)

#Set feature blending for line layer
# Set feature blending for line layer
self.mLineLayer.setLayerTransparency(50)

checker = QgsMultiRenderChecker()
@@ -175,14 +175,14 @@ def testVectorLayerTransparency(self):

def testRasterBlending(self):
"""Test that blend modes work for raster layers."""
#Add raster layers to map
# Add raster layers to map
myLayers = []
myLayers.append(self.mRasterLayer1.id())
myLayers.append(self.mRasterLayer2.id())
self.mapSettings.setLayers(myLayers)
self.mapSettings.setExtent(self.mRasterLayer1.extent())

#Set blending mode for top layer
# Set blending mode for top layer
self.mRasterLayer1.setBlendMode(QPainter.CompositionMode_Difference)
checker = QgsMultiRenderChecker()
checker.setControlName("expected_raster_blendmodes")
@@ -60,17 +60,17 @@ def testFilter(self):
renderer.addCategory(QgsRendererCategoryV2('', createMarkerSymbol(), 'default'))

self.assertEqual(renderer.filter(), '')
#remove categories, leaving default
# remove categories, leaving default
assert renderer.updateCategoryRenderState(0, False)
self.assertEqual(renderer.filter(), "(field) NOT IN ('a')")
assert renderer.updateCategoryRenderState(1, False)
self.assertEqual(renderer.filter(), "(field) NOT IN ('a','b')")
assert renderer.updateCategoryRenderState(2, False)
self.assertEqual(renderer.filter(), "(field) NOT IN ('a','b','c')")
#remove default category
# remove default category
assert renderer.updateCategoryRenderState(3, False)
self.assertEqual(renderer.filter(), "FALSE")
#add back other categories, leaving default disabled
# add back other categories, leaving default disabled
assert renderer.updateCategoryRenderState(0, True)
self.assertEqual(renderer.filter(), "(field) IN ('a')")
assert renderer.updateCategoryRenderState(1, True)
@@ -99,7 +99,7 @@ def testFilter(self):
self.assertEqual(renderer.filter(), "FALSE")

renderer.deleteAllCategories()
#numeric categories
# numeric categories
renderer.addCategory(QgsRendererCategoryV2(1, createMarkerSymbol(), 'a'))
renderer.addCategory(QgsRendererCategoryV2(2, createMarkerSymbol(), 'b'))
renderer.addCategory(QgsRendererCategoryV2(3, createMarkerSymbol(), 'c'))
@@ -113,4 +113,4 @@ def testFilter(self):


if __name__ == "__main__":
unittest.main()
unittest.main()
@@ -17,7 +17,7 @@
from qgis.core import QgsColorScheme
from PyQt4.QtGui import QColor

#Make a dummy color scheme for testing
# Make a dummy color scheme for testing


class DummyColorScheme(QgsColorScheme):
@@ -89,4 +89,4 @@ def testClone(self):


if __name__ == "__main__":
unittest.main()
unittest.main()
@@ -63,12 +63,12 @@ def testRemoveScheme(self):
recentScheme = QgsRecentColorScheme()
registry.addColorScheme(recentScheme)
self.assertTrue(len(registry.schemes()) == 1)
#remove the scheme
# remove the scheme
registry.removeColorScheme(recentScheme)
self.assertTrue(len(registry.schemes()) == 0)
#try removing a scheme not in the registry
# try removing a scheme not in the registry
self.assertFalse(registry.removeColorScheme(recentScheme))


if __name__ == "__main__":
unittest.main()
unittest.main()
@@ -144,7 +144,7 @@ def testuniqueId(self):
self.mComposition.writeXML(documentElement, doc)
self.mComposition.addItemsFromXML(documentElement, doc, 0, False)

#test if both composer maps have different ids
# test if both composer maps have different ids
newMap = QgsComposerMap()
mapList = self.mComposition.composerMapItems()

@@ -30,7 +30,7 @@
getQgisTestApp,
TestCase,
unittest
#expectedFailure
# expectedFailure
)

QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()
@@ -97,7 +97,7 @@ def testMeasurePolygonWithHole(self):
area = da.measure(polygon)
assert area == 8, "Expected:\n%f\nGot:\n%f\n" % (8, area)

#MH150729: Changed behaviour to consider inner rings for perimeter calculation. Therefore, expected result is 16.
# MH150729: Changed behaviour to consider inner rings for perimeter calculation. Therefore, expected result is 16.
perimeter = da.measurePerimeter(polygon)
assert perimeter == 16, "Expected:\n%f\nGot:\n%f\n" % (16, perimeter)

@@ -27,11 +27,11 @@ def testfun(values, feature, parent):

@qgsfunction(args="auto", group='testing', register=False)
def autocount(value1, value2, value3, feature, parent):
pass
pass

@qgsfunction(args="auto", group='testing', register=False)
def expandargs(value1, value2, value3, feature, parent):
return value1, value2, value3
return value1, value2, value3

@qgsfunction(args=0, group='testing', register=False)
def special(values, feature, parent):
@@ -34,48 +34,48 @@ def test_expections(self):
assert ml.isValid()
fields = ml.fields()

#check no error
# check no error
fields.remove(1)
#check exceptions raised
# check exceptions raised
with self.assertRaises(KeyError):
fields.remove(-1)
with self.assertRaises(KeyError):
fields.remove(111)

fields = ml.fields()
#check no error
# check no error
fields.at(1)
#check exceptions raised
# check exceptions raised
with self.assertRaises(KeyError):
fields.at(-1)
with self.assertRaises(KeyError):
fields.at(111)

#check no error
# check no error
fields.field(1)
#check exceptions raised
# check exceptions raised
with self.assertRaises(KeyError):
fields.field(-1)
with self.assertRaises(KeyError):
fields.field(111)

#check no error
# check no error
fields.field('value')
#check exceptions raised
# check exceptions raised
with self.assertRaises(KeyError):
fields.field('bad')

#check no error
# check no error
fields.fieldOrigin(1)
#check exceptions raised
# check exceptions raised
with self.assertRaises(KeyError):
fields.fieldOrigin(-1)
with self.assertRaises(KeyError):
fields.fieldOrigin(111)

#check no error
# check no error
fields.fieldOriginIndex(1)
#check exceptions raised
# check exceptions raised
with self.assertRaises(KeyError):
fields.fieldOriginIndex(-1)
with self.assertRaises(KeyError):

0 comments on commit 8a93990

Please sign in to comment.
You can’t perform that action at this time.