Skip to content
Permalink
Browse files

indentation cleanup

  • Loading branch information
jef-n committed Oct 2, 2012
1 parent 7f20833 commit 8349d52015b7ede32206fd73c343de445e86389b
Showing with 75 additions and 75 deletions.
  1. +0 −2 python/core/core.sip
  2. +47 −45 python/core/symbology-ng/qgssymbollayerv2.sip
  3. +28 −28 tests/src/python/test_qgssymbollayerv2.py
@@ -8,8 +8,6 @@
%Include conversions.sip
%Include qgsexception.sip

// TODO: more files to wrap

%Include qgis.sip

%Include qgsapplication.sip
@@ -8,52 +8,54 @@ class QgsSymbolLayerV2
switch (sipCpp->type())
{
case QgsSymbolV2::Marker:
if (dynamic_cast<QgsEllipseSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsEllipseSymbolLayerV2;
else if (dynamic_cast<QgsFontMarkerSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsFontMarkerSymbolLayerV2;
else if (dynamic_cast<QgsSimpleMarkerSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSimpleMarkerSymbolLayerV2;
else if (dynamic_cast<QgsSvgMarkerSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSvgMarkerSymbolLayerV2;
else if (dynamic_cast<QgsVectorFieldSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsVectorFieldSymbolLayer;
else
sipClass = sipClass_QgsMarkerSymbolLayerV2;
if (dynamic_cast<QgsEllipseSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsEllipseSymbolLayerV2;
else if (dynamic_cast<QgsFontMarkerSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsFontMarkerSymbolLayerV2;
else if (dynamic_cast<QgsSimpleMarkerSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSimpleMarkerSymbolLayerV2;
else if (dynamic_cast<QgsSvgMarkerSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSvgMarkerSymbolLayerV2;
else if (dynamic_cast<QgsVectorFieldSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsVectorFieldSymbolLayer;
else
sipClass = sipClass_QgsMarkerSymbolLayerV2;
break;

case QgsSymbolV2::Line:
if (dynamic_cast<QgsLineDecorationSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsLineDecorationSymbolLayerV2;
else if (dynamic_cast<QgsMarkerLineSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsMarkerLineSymbolLayerV2;
else if (dynamic_cast<QgsSimpleLineSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSimpleLineSymbolLayerV2;
else
sipClass = sipClass_QgsLineSymbolLayerV2;
break;

case QgsSymbolV2::Fill:
if (dynamic_cast<QgsSimpleFillSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSimpleFillSymbolLayerV2;
else if (dynamic_cast<QgsImageFillSymbolLayer*>(sipCpp) != NULL)
{
if (dynamic_cast<QgsLinePatternFillSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsLinePatternFillSymbolLayer;
else if (dynamic_cast<QgsPointPatternFillSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsPointPatternFillSymbolLayer;
else if (dynamic_cast<QgsSVGFillSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsSVGFillSymbolLayer;
else
sipClass = sipClass_QgsImageFillSymbolLayer;
}
else if (dynamic_cast<QgsCentroidFillSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsCentroidFillSymbolLayerV2;
else
sipClass = sipClass_QgsFillSymbolLayerV2;
break;

default:
sipClass = 0;
break;

case QgsSymbolV2::Line:
if (dynamic_cast<QgsLineDecorationSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsLineDecorationSymbolLayerV2;
else if (dynamic_cast<QgsMarkerLineSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsMarkerLineSymbolLayerV2;
else if (dynamic_cast<QgsSimpleLineSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSimpleLineSymbolLayerV2;
else
sipClass = sipClass_QgsLineSymbolLayerV2;
break;

case QgsSymbolV2::Fill:
if (dynamic_cast<QgsSimpleFillSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSimpleFillSymbolLayerV2;
else if (dynamic_cast<QgsImageFillSymbolLayer*>(sipCpp) != NULL)
if (dynamic_cast<QgsLinePatternFillSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsLinePatternFillSymbolLayer;
else if (dynamic_cast<QgsPointPatternFillSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsPointPatternFillSymbolLayer;
else if (dynamic_cast<QgsSVGFillSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsSVGFillSymbolLayer;
else
sipClass = sipClass_QgsImageFillSymbolLayer;
else if (dynamic_cast<QgsCentroidFillSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsCentroidFillSymbolLayerV2;
else
sipClass = sipClass_QgsFillSymbolLayerV2;
break;

default:
sipClass = 0;
break;
}
%End

@@ -171,7 +171,7 @@ def testQgsSimpleFillSymbolLayerV2(self):
'''
mTestName = QString ('QgsSimpleFillSymbolLayerV2')
mFilePath = QDir.toNativeSeparators (QString ('%1/symbol_layer/%2.sld').arg (unitTestDataPath(), mTestName))

mDoc = QDomDocument(mTestName)
mFile = QFile (mFilePath)
mFile.open(QIODevice.ReadOnly)
@@ -183,7 +183,7 @@ def testQgsSimpleFillSymbolLayerV2(self):
mValue = type (mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = Qt.SolidPattern
mValue = mSymbolLayer.brushStyle()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -198,19 +198,19 @@ def testQgsSimpleFillSymbolLayerV2(self):
mValue = mSymbolLayer.borderStyle()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = 0.26
mValue = mSymbolLayer.borderWidth()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

def testQgsCentroidFillSymbolLayerV2(self):
'''
Create a new style from a .sld file and match test
'''
mTestName = QString ('QgsCentroidFillSymbolLayerV2')
mFilePath = QDir.toNativeSeparators (QString ('%1/symbol_layer/%2.sld').arg (unitTestDataPath(), mTestName))

mDoc = QDomDocument(mTestName)
mFile = QFile (mFilePath)
mFile.open(QIODevice.ReadOnly)
@@ -222,7 +222,7 @@ def testQgsCentroidFillSymbolLayerV2(self):
mValue = type (mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = QString(u'regular_star')
mValue = mSymbolLayer.subSymbol().symbolLayer(0).name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -244,7 +244,7 @@ def testQgsLinePatternFillSymbolLayer(self):
'''
mTestName = QString ('QgsLinePatternFillSymbolLayer')
mFilePath = QDir.toNativeSeparators (QString ('%1/symbol_layer/%2.sld').arg (unitTestDataPath(), mTestName))

mDoc = QDomDocument(mTestName)
mFile = QFile (mFilePath)
mFile.open(QIODevice.ReadOnly)
@@ -256,7 +256,7 @@ def testQgsLinePatternFillSymbolLayer(self):
mValue = type (mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = QString(u'#ff55ff')
mValue = mSymbolLayer.color().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -281,11 +281,11 @@ def testQgsPointPatternFillSymbolLayer(self):
'''
Create a new style from a .sld file and match test
'''
# at the moment there is an empty createFromSld implementation that return null
# at the moment there is an empty createFromSld implementation that return null
return
mTestName = QString ('QgsPointPatternFillSymbolLayer')
mFilePath = QDir.toNativeSeparators (QString ('%1/symbol_layer/%2.sld').arg (unitTestDataPath(), mTestName))

mDoc = QDomDocument(mTestName)
mFile = QFile (mFilePath)
mFile.open(QIODevice.ReadOnly)
@@ -297,7 +297,7 @@ def testQgsPointPatternFillSymbolLayer(self):
mValue = type (mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = QString(u'triangle')
mValue = mSymbolLayer.subSymbol().symbolLayer(0).name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -329,7 +329,7 @@ def testQgsSVGFillSymbolLayer(self):
'''
mTestName = QString ('QgsSVGFillSymbolLayer')
mFilePath = QDir.toNativeSeparators (QString ('%1/symbol_layer/%2.sld').arg (unitTestDataPath(), mTestName))

mDoc = QDomDocument(mTestName)
mFile = QFile (mFilePath)
mFile.open(QIODevice.ReadOnly)
@@ -341,7 +341,7 @@ def testQgsSVGFillSymbolLayer(self):
mValue = type (mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = 'accommodation_camping.svg'
mValue = os.path.basename (str (mSymbolLayer.svgFilePath()))
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -358,7 +358,7 @@ def testQgsMarkerLineSymbolLayerV2(self):
'''
mTestName = QString ('QgsMarkerLineSymbolLayerV2')
mFilePath = QDir.toNativeSeparators (QString ('%1/symbol_layer/%2.sld').arg (unitTestDataPath(), mTestName))

mDoc = QDomDocument(mTestName)
mFile = QFile (mFilePath)
mFile.open(QIODevice.ReadOnly)
@@ -370,7 +370,7 @@ def testQgsMarkerLineSymbolLayerV2(self):
mValue = type (mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = QgsMarkerLineSymbolLayerV2.CentralPoint
mValue = mSymbolLayer.placement()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -380,7 +380,7 @@ def testQgsMarkerLineSymbolLayerV2(self):
mValue = mSymbolLayer.subSymbol().symbolLayer(0).name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = QString(u'#000000')
mValue = mSymbolLayer.subSymbol().symbolLayer(0).borderColor().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -397,7 +397,7 @@ def testQgsSimpleLineSymbolLayerV2(self):
'''
mTestName = QString ('QgsSimpleLineSymbolLayerV2')
mFilePath = QDir.toNativeSeparators (QString ('%1/symbol_layer/%2.sld').arg (unitTestDataPath(), mTestName))

mDoc = QDomDocument(mTestName)
mFile = QFile (mFilePath)
mFile.open(QIODevice.ReadOnly)
@@ -409,7 +409,7 @@ def testQgsSimpleLineSymbolLayerV2(self):
mValue = type (mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = QString(u'#aa007f')
mValue = mSymbolLayer.color().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -419,7 +419,7 @@ def testQgsSimpleLineSymbolLayerV2(self):
mValue = mSymbolLayer.width()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = Qt.RoundCap
mValue = mSymbolLayer.penCapStyle()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -438,15 +438,15 @@ def testQgsSimpleLineSymbolLayerV2(self):
mExpectedValue = [5.0, 2.0]
mValue = mSymbolLayer.customDashVector()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage
assert mExpectedValue == mValue, mMessage

def testQgsEllipseSymbolLayerV2(self):
'''
Create a new style from a .sld file and match test
'''
mTestName = QString ('QgsEllipseSymbolLayerV2')
mFilePath = QDir.toNativeSeparators (QString ('%1/symbol_layer/%2.sld').arg (unitTestDataPath(), mTestName))

mDoc = QDomDocument(mTestName)
mFile = QFile (mFilePath)
mFile.open(QIODevice.ReadOnly)
@@ -458,7 +458,7 @@ def testQgsEllipseSymbolLayerV2(self):
mValue = type (mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = QString(u'circle')
mValue = mSymbolLayer.symbolName()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -483,14 +483,14 @@ def testQgsEllipseSymbolLayerV2(self):
mValue = mSymbolLayer.symbolHeight()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

def testQgsFontMarkerSymbolLayerV2(self):
'''
Create a new style from a .sld file and match test
'''
mTestName = QString ('QgsFontMarkerSymbolLayerV2')
mFilePath = QDir.toNativeSeparators (QString ('%1/symbol_layer/%2.sld').arg (unitTestDataPath(), mTestName))

mDoc = QDomDocument(mTestName)
mFile = QFile (mFilePath)
mFile.open(QIODevice.ReadOnly)
@@ -502,7 +502,7 @@ def testQgsFontMarkerSymbolLayerV2(self):
mValue = type (mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = QString(u'Arial')
mValue = mSymbolLayer.fontFamily()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -529,7 +529,7 @@ def testQgsSvgMarkerSymbolLayerV2(self):
'''
mTestName = QString ('QgsSvgMarkerSymbolLayerV2')
mFilePath = QDir.toNativeSeparators (QString ('%1/symbol_layer/%2.sld').arg (unitTestDataPath(), mTestName))

mDoc = QDomDocument(mTestName)
mFile = QFile (mFilePath)
mFile.open(QIODevice.ReadOnly)
@@ -541,7 +541,7 @@ def testQgsSvgMarkerSymbolLayerV2(self):
mValue = type (mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage

mExpectedValue = QString(u'skull.svg')
mValue = os.path.basename (str(mSymbolLayer.path()))
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
@@ -557,6 +557,6 @@ def testQgsSvgMarkerSymbolLayerV2(self):
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue,mValue)
assert mExpectedValue == mValue, mMessage


if __name__ == '__main__':
unittest.main()

0 comments on commit 8349d52

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