Skip to content
Permalink
Browse files

Fixes unit tests

  • Loading branch information
pblottiere committed Feb 25, 2019
1 parent 58c38f2 commit 0a76d7c108831b28e491810a13fb40d82fcc160f
@@ -43,9 +43,10 @@ Returns the type of the parameter as a string.
Returns true if the parameter is valid, false otherwise.
%End

QString toString() const;
QString toString( bool defaultValue = false ) const;
%Docstring
Converts the parameter into a string.
Converts the parameter into a string. If ``defaultValue`` is true
and current value is empty, then the default value is returned.
%End

QStringList toStringList( char delimiter = ',' ) const;
@@ -62,11 +62,11 @@ QColor QgsServerParameterDefinition::toColor( bool &ok ) const
return color;
}

QString QgsServerParameterDefinition::toString() const
QString QgsServerParameterDefinition::toString( const bool defaultValue ) const
{
QString value = mValue.toString();

if ( value.isEmpty() )
if ( value.isEmpty() && defaultValue )
value = mDefaultValue.toString();

return value;
@@ -59,9 +59,10 @@ class SERVER_EXPORT QgsServerParameterDefinition
virtual bool isValid() const;

/**
* Converts the parameter into a string.
* Converts the parameter into a string. If \a defaultValue is true
* and current value is empty, then the default value is returned.
*/
QString toString() const;
QString toString( bool defaultValue = false ) const;

/**
* Converts the parameter into a list of strings.
@@ -715,7 +715,7 @@ namespace QgsWms

QString QgsWmsParameters::formatAsString() const
{
return mWmsParameters[ QgsWmsParameter::FORMAT ].toString();
return mWmsParameters[ QgsWmsParameter::FORMAT ].toString( true );
}

QString QgsWmsParameters::formatAsString( const QgsWmsParameters::Format format )

0 comments on commit 0a76d7c

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