Skip to content

Commit

Permalink
Fixes unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Feb 26, 2019
1 parent 58c38f2 commit 0a76d7c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions python/server/auto_generated/qgsserverparameters.sip.in
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/server/qgsserverparameters.cpp
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/server/qgsserverparameters.h
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wms/qgswmsparameters.cpp
Expand Up @@ -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 )
Expand Down

0 comments on commit 0a76d7c

Please sign in to comment.