1 change: 0 additions & 1 deletion python/plugins/sextante/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<file>images/grass.png</file>
<file>images/help.png</file>
<file>images/history.gif</file>
<file>images/info.png</file>
<file>images/input.png</file>
<file>images/iterate.png</file>
<file>images/model.png</file>
Expand Down
3 changes: 2 additions & 1 deletion src/core/qgsapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ void QgsApplication::init( QString customConfigPath )

// check if QGIS is run from build directory (not the install directory)
QFile f;
foreach ( QString path, QStringList() << "" << "/.." << "/bin" )
// "/../../.." is for Mac bundled app in build directory
foreach ( QString path, QStringList() << "" << "/.." << "/bin" << "/../../.." )
{
f.setFileName( prefixPath + path + "/path.txt" );
if ( f.exists() )
Expand Down
6 changes: 6 additions & 0 deletions src/mapserver/qgsprojectparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1723,13 +1723,19 @@ void QgsProjectParser::serviceCapabilities( QDomElement& parentElement, QDomDocu
QDomElement keywordListElem = propertiesElem.firstChildElement( "WMSKeywordList" );
if ( !keywordListElem.isNull() )
{
bool siaFormat = featureInfoFormatSIA2045();

QDomElement wmsKeywordElem = doc.createElement( "KeywordList" );
QDomNodeList keywordList = keywordListElem.elementsByTagName( "value" );
for ( int i = 0; i < keywordList.size(); ++i )
{
QDomElement keywordElem = doc.createElement( "Keyword" );
QDomText keywordText = doc.createTextNode( keywordList.at( i ).toElement().text() );
keywordElem.appendChild( keywordText );
if ( siaFormat )
{
keywordElem.setAttribute( "vocabulary", "SIA_Geo405" );
}
wmsKeywordElem.appendChild( keywordElem );
}

Expand Down
43 changes: 27 additions & 16 deletions src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void QgsDelimitedTextSourceSelect::on_buttonBox_accepted()
settings.setValue( key + "/delimiterType", "plain" );
else
settings.setValue( key + "/delimiterType", "regexp" );
settings.setValue( key + "/delimiterChars", selectedChars() );
settings.setValue( key + "/delimiterChars", selectedChars().join( "" ) );

accept();
}
Expand All @@ -181,37 +181,50 @@ void QgsDelimitedTextSourceSelect::on_buttonBox_rejected()
reject();
}

QString QgsDelimitedTextSourceSelect::selectedChars()
QStringList QgsDelimitedTextSourceSelect::selectedChars()
{
QString chars = "";
QStringList chars;
if ( cbxDelimSpace->isChecked() )
chars += " ";
chars << " ";
if ( cbxDelimTab->isChecked() )
chars += "\\t";
chars << "\\t";
if ( cbxDelimSemicolon->isChecked() )
chars += ";";
chars << ";";
if ( cbxDelimComma->isChecked() )
chars += ",";
chars << ",";
if ( cbxDelimColon->isChecked() )
chars += ":";
chars << ":";
return chars;
}

QStringList QgsDelimitedTextSourceSelect::splitLine( QString line )
{
QString delimiter = txtDelimiter->text();
QString delimiter;
if ( delimiterSelection->isChecked() )
{
if ( selectedChars().size() > 1 )
{
delimiter = "[" + selectedChars().join( "" ) + "]";
}
else
{
delimiter = selectedChars().join( "" );
}
txtDelimiter->setText( delimiter );
}
else
{
delimiter = txtDelimiter->text();
}

if ( delimiterPlain->isChecked() )
{
return QgsDelimitedTextProvider::splitLine( line, "plain", delimiter );
}

if ( delimiterSelection->isChecked() )
if ( delimiterSelection->isChecked() && selectedChars().size() <= 1 )
{
delimiter = "[";
delimiter += selectedChars();
delimiter += "]";
txtDelimiter->setText( delimiter );
return QgsDelimitedTextProvider::splitLine( line, "plain", delimiter );
}

return QgsDelimitedTextProvider::splitLine( line, "regexp", delimiter );
Expand Down Expand Up @@ -291,8 +304,6 @@ void QgsDelimitedTextSourceSelect::updateFieldLists()

QgsDebugMsg( QString( "Attempting to split the input line: %1 using delimiter %2" ).arg( line ).arg( txtDelimiter->text() ) );

QString delimiter = txtDelimiter->text();

QStringList fieldList = splitLine( line );

QgsDebugMsg( QString( "Split line into %1 parts" ).arg( fieldList.size() ) );
Expand Down
2 changes: 1 addition & 1 deletion src/providers/delimitedtext/qgsdelimitedtextsourceselect.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class QgsDelimitedTextSourceSelect : public QDialog, private Ui::QgsDelimitedTex
bool haveValidFileAndDelimiters();
void updateFieldLists();
void getOpenFileName();
QString selectedChars();
QStringList selectedChars();

private slots:
void on_buttonBox_accepted();
Expand Down
23 changes: 19 additions & 4 deletions src/ui/qgsabout.ui
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ p, li { white-space: pre-wrap; }
<attribute name="title">
<string>Developers</string>
</attribute>
<layout class="QGridLayout">
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2">
<widget class="QListWidget" name="lstDevelopers">
<property name="alternatingRowColors">
<bool>true</bool>
Expand All @@ -190,13 +190,13 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="0" column="0">
<item row="0" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../images/images.qrc">:/images/developers/lyon-2012.jpg</pixmap>
<pixmap resource="../../images/images.qrc">:/images/last-hackfest.jpg</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
Expand All @@ -206,6 +206,21 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>17</pointsize>
</font>
</property>
<property name="text">
<string>Essen (Germany), Developer meeting 2012</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
Expand Down
128 changes: 64 additions & 64 deletions src/ui/qgsrasterlayerpropertiesbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<item row="0" column="0" colspan="4">
<widget class="QTabWidget" name="tabBar">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<property name="iconSize">
<size>
Expand Down Expand Up @@ -251,69 +251,6 @@
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QGroupBox" name="gboxNoDataValue">
<property name="title">
<string>No data value</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="leftMargin">
<number>1</number>
</property>
<item>
<widget class="QCheckBox" name="mSrcNoDataValueCheckBox">
<property name="toolTip">
<string>Use original source no data value.</string>
</property>
<property name="text">
<string>No data value:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblSrcNoDataValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Original data source no data value, if exists.</string>
</property>
<property name="text">
<string>&lt;src no data value&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="lblUserNoDataValueLabel">
<property name="toolTip">
<string>Additional user defined no data value.</string>
</property>
<property name="text">
<string>Additional no data value</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leNoDataValue">
<property name="toolTip">
<string>Additional user defined no data value.</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
Expand Down Expand Up @@ -395,6 +332,69 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gboxNoDataValue">
<property name="title">
<string>No data value</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="leftMargin">
<number>1</number>
</property>
<item>
<widget class="QCheckBox" name="mSrcNoDataValueCheckBox">
<property name="toolTip">
<string>Use original source no data value.</string>
</property>
<property name="text">
<string>No data value:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblSrcNoDataValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Original data source no data value, if exists.</string>
</property>
<property name="text">
<string>&lt;src no data value&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="lblUserNoDataValueLabel">
<property name="toolTip">
<string>Additional user defined no data value.</string>
</property>
<property name="text">
<string>Additional no data value</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leNoDataValue">
<property name="toolTip">
<string>Additional user defined no data value.</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
Expand Down
2 changes: 1 addition & 1 deletion tests/src/analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ENDIF (WIN32)
# ensure the qgis libs can be found.
IF (APPLE)
# For Mac OS X, the executable must be at the root of the bundle's executable folder
SET (CMAKE_INSTALL_NAME_DIR @executable_path/../../../src/core)
# SET (CMAKE_INSTALL_NAME_DIR @executable_path/../../../src/core)
ENDIF (APPLE)

#note for tests we should not include the moc of our
Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ENDIF (WIN32)
# ensure the qgis libs can be found.
IF (APPLE)
# For Mac OS X, the executable must be at the root of the bundle's executable folder
SET (CMAKE_INSTALL_NAME_DIR @executable_path/../../../src/core)
# SET (CMAKE_INSTALL_NAME_DIR @executable_path/../../../src/core)
ENDIF (APPLE)

#note for tests we should not include the moc of our
Expand Down
2 changes: 1 addition & 1 deletion tests/src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ENDIF(WIN32)
# ensure the omg libs can be found.
IF (APPLE)
# For Mac OS X, the executable must be at the root of the bundle's executable folder
SET (CMAKE_INSTALL_NAME_DIR @executable_path/../../../src/gui)
# SET (CMAKE_INSTALL_NAME_DIR @executable_path/../../../src/gui)
ENDIF (APPLE)

#note for tests we should not include the moc of our
Expand Down
2 changes: 1 addition & 1 deletion tests/src/providers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ENDIF (WIN32)
# ensure the qgis libs can be found.
IF (APPLE)
# For Mac OS X, the executable must be at the root of the bundle's executable folder
SET (CMAKE_INSTALL_NAME_DIR @executable_path/../../../src/core)
# SET (CMAKE_INSTALL_NAME_DIR @executable_path/../../../src/core)
ENDIF (APPLE)

#note for tests we should not include the moc of our
Expand Down
1 change: 1 addition & 0 deletions tests/src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
INCLUDE(UsePythonTest)
ADD_PYTHON_TEST(PyQgsApplication test_qgsapplication.py)
ADD_PYTHON_TEST(PyQgsFeature test_qgsfeature.py)
ADD_PYTHON_TEST(PyQgsGeometry test_qgsgeometry.py)
ADD_PYTHON_TEST(PyQgsVectorLayer test_qgsvectorlayer.py)
ADD_PYTHON_TEST(PyQgsRasterLayer test_qgsrasterlayer.py)
Expand Down
125 changes: 125 additions & 0 deletions tests/src/python/test_qgsfeature.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsFeature.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author__ = 'Germán Carrillo'
__date__ = '06/10/2012'
__copyright__ = 'Copyright 2012, The Quantum GIS Project'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os

from PyQt4.QtCore import QVariant
from qgis.core import QgsFeature, QgsGeometry, QgsPoint, QgsVectorLayer
from utilities import (unitTestDataPath,
getQgisTestApp,
TestCase,
unittest,
#expectedFailure
)
QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()


class TestQgsFeature(TestCase):

def test_CreateFeature(self):
feat = QgsFeature()
feat.addAttribute(1, "text")
feat.setGeometry(QgsGeometry.fromPoint(QgsPoint(123,456)))
myId = feat.id()
myExpectedId = 0
myMessage = '\nExpected: %s\nGot: %s' % (myExpectedId, myId)
assert myId == myExpectedId, myMessage

def test_ValidFeature(self):
myPath = os.path.join(unitTestDataPath(), 'points.shp')
myLayer = QgsVectorLayer(myPath, 'Points', 'ogr')
provider = myLayer.dataProvider()
allAttrs = provider.attributeIndexes()
provider.select(allAttrs)

feat = QgsFeature()
provider.nextFeature(feat)
myValidValue = feat.isValid()
myMessage = '\nExpected: %s\nGot: %s' % ("True", myValidValue)
assert myValidValue == True, myMessage

def test_TypeName(self):
myPath = os.path.join(unitTestDataPath(), 'lines.shp')
myLayer = QgsVectorLayer(myPath, 'Lines', 'ogr')
provider = myLayer.dataProvider()
allAttrs = provider.attributeIndexes()
provider.select(allAttrs)

feat = QgsFeature()
provider.nextFeature(feat)
myTypeName = feat.typeName()
myExpectedTypeName = "lines"
myMessage = '\nExpected: %s\nGot: %s' % (myExpectedTypeName, myTypeName)
assert myTypeName == myExpectedTypeName, myMessage

def test_AttributeMap(self):
myPath = os.path.join(unitTestDataPath(), 'lines.shp')
myLayer = QgsVectorLayer(myPath, 'Lines', 'ogr')
provider = myLayer.dataProvider()
allAttrs = provider.attributeIndexes()
provider.select(allAttrs)
feat = QgsFeature()
provider.nextFeature(feat)

myAttributeMap = feat.attributeMap()
myExpectedAttributeMap = {0: QVariant("Highway"), 1: QVariant(1)}

# Only for printing purposes
myAttributeDict = {
0:str(myAttributeMap[0].toString()),
1:int(myAttributeMap[1].toString())}
myExpectedAttributeDict = {0: "Highway", 1: 1}
myMessage = '\nExpected: %s\nGot: %s' % (myExpectedAttributeDict,
myAttributeDict)

assert myAttributeMap == myExpectedAttributeMap, myMessage

def test_AddAttribute(self):
feat = QgsFeature()
feat.addAttribute(1, "text")
myCount = len(feat.attributeMap())
myExpectedCount = 1
myMessage = '\nExpected: %s\nGot: %s' % (myExpectedCount, myCount)
assert myCount == myExpectedCount, myMessage

def test_ChangeAttribute(self):
feat = QgsFeature()
feat.addAttribute(1, "text")
feat.changeAttribute(1, "changed")
myChangedAttribute = feat.attributeMap()[1].toString()
myExpectedAttribute = "changed"
myMessage = '\nExpected: %s\nGot: %s' % (myExpectedAttribute,
myChangedAttribute)
assert myChangedAttribute == myExpectedAttribute, myMessage

def test_DeleteAttribute(self):
feat = QgsFeature()
feat.addAttribute(1, "text")
feat.deleteAttribute(1)
myCount = len(feat.attributeMap())
myExpectedCount = 0
myMessage = '\nExpected: %s\nGot: %s' % (myExpectedCount, myCount)
assert myCount == myExpectedCount, myMessage

def test_SetGeometry(self):
feat = QgsFeature()
feat.setGeometry(QgsGeometry.fromPoint(QgsPoint(123,456)))
myGeometry = feat.geometry()
myExpectedGeometry = "!None"
myMessage = '\nExpected: %s\nGot: %s' % (myExpectedGeometry, myGeometry)
assert myGeometry != None, myMessage

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

36 changes: 24 additions & 12 deletions tests/src/python/test_qgssymbollayerv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,39 @@
Qt)
from PyQt4.QtXml import QDomDocument

from qgis.core import (QgsSymbolLayerV2,
QgsSimpleFillSymbolLayerV2,
QgsVectorFieldSymbolLayer,
QgsMarkerSymbolLayerV2,
from qgis.core import (QgsCentroidFillSymbolLayerV2,
QgsEllipseSymbolLayerV2,
QgsFontMarkerSymbolLayerV2,
QgsCentroidFillSymbolLayerV2,
QgsPointPatternFillSymbolLayer,
QgsSVGFillSymbolLayer,
QgsLineDecorationSymbolLayerV2,
QgsLinePatternFillSymbolLayer,
QgsMarkerLineSymbolLayerV2,
QgsEllipseSymbolLayerV2,
QgsMarkerSymbolLayerV2,
QgsPointPatternFillSymbolLayer,
QgsSimpleFillSymbolLayerV2,
QgsSimpleLineSymbolLayerV2,
QgsSimpleMarkerSymbolLayerV2,
QgsSVGFillSymbolLayer,
QgsSvgMarkerSymbolLayerV2,
QgsSymbolLayerV2,
QgsVectorFieldSymbolLayer,
QgsCentroidFillSymbolLayerV2,
QgsEllipseSymbolLayerV2,
QgsFillSymbolLayerV2,
QgsFontMarkerSymbolLayerV2,
QgsImageFillSymbolLayer,
QgsLineDecorationSymbolLayerV2,
QgsLinePatternFillSymbolLayer,
QgsCentroidFillSymbolLayerV2,
QgsLineSymbolLayerV2,
QgsMarkerLineSymbolLayerV2,
QgsSimpleMarkerSymbolLayerV2,
QgsMarkerSymbolLayerV2,
QgsPointPatternFillSymbolLayer,
QgsSimpleFillSymbolLayerV2,
QgsSimpleLineSymbolLayerV2,
QgsLineDecorationSymbolLayerV2
)
QgsSimpleMarkerSymbolLayerV2,
QgsSVGFillSymbolLayer,
QgsSvgMarkerSymbolLayerV2,
QgsVectorFieldSymbolLayer,
)
from utilities import (unitTestDataPath,
getQgisTestApp,
TestCase,
Expand Down