Skip to content

Commit

Permalink
Fix build, warnings on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 1, 2017
1 parent fcf718f commit e9dee40
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
16 changes: 15 additions & 1 deletion tests/src/core/testqgsexpression.cpp
Expand Up @@ -2674,21 +2674,35 @@ class TestQgsExpression: public QObject
{
QgsExpressionContext context;

#ifdef Q_OS_WIN
_putenv( "TESTENV_STRING=Hello World" );
#else
setenv( "TESTENV_STRING", "Hello World", 1 );
#endif

QgsExpression e( "env('TESTENV_STRING')" );

QVariant result = e.evaluate( &context );

QCOMPARE( result.toString(), QStringLiteral( "Hello World" ) );
#ifdef Q_OS_WIN
_putenv( "TESTENV_STRING=" );
_putenv( "TESTENV_INT=5" );
#else
unsetenv( "TESTENV_STRING" );

setenv( "TESTENV_INT", "5", 1 );
#endif

QgsExpression e2( "env('TESTENV_INT')" );

QVariant result2 = e2.evaluate( &context );

QCOMPARE( result2.toString(), QStringLiteral( "5" ) );
#ifdef Q_OS_WIN
_putenv( "TESTENV_INT=" );
#else
unsetenv( "TESTENV_INT" );
#endif

QgsExpression e3( "env('TESTENV_I_DO_NOT_EXIST')" );
QVariant result3 = e3.evaluate( &context );
Expand Down
14 changes: 7 additions & 7 deletions tests/src/core/testqgsproperty.cpp
Expand Up @@ -48,7 +48,7 @@ class TestTransformer : public QgsPropertyTransformer
{
return new TestTransformer( mMinValue, mMaxValue );
}
virtual QString toExpression( const QString& ) const override { return QStringLiteral(); }
virtual QString toExpression( const QString& ) const override { return QString(); }

private:

Expand Down Expand Up @@ -104,10 +104,10 @@ void TestQgsProperty::initTestCase()
{
QgsApplication::init();
QgsApplication::initQgis();
mDefinitions.insert( Property1, QgsPropertyDefinition( "p1", QgsPropertyDefinition::DataTypeString, QStringLiteral(), QStringLiteral() ) );
mDefinitions.insert( Property2, QgsPropertyDefinition( "p2", QgsPropertyDefinition::DataTypeString, QStringLiteral(), QStringLiteral() ) );
mDefinitions.insert( Property3, QgsPropertyDefinition( "p3", QgsPropertyDefinition::DataTypeString, QStringLiteral(), QStringLiteral() ) );
mDefinitions.insert( Property4, QgsPropertyDefinition( "p4", QgsPropertyDefinition::DataTypeString, QStringLiteral(), QStringLiteral() ) );
mDefinitions.insert( Property1, QgsPropertyDefinition( "p1", QgsPropertyDefinition::DataTypeString, QString(), QString() ) );
mDefinitions.insert( Property2, QgsPropertyDefinition( "p2", QgsPropertyDefinition::DataTypeString, QString(), QString() ) );
mDefinitions.insert( Property3, QgsPropertyDefinition( "p3", QgsPropertyDefinition::DataTypeString, QString(), QString() ) );
mDefinitions.insert( Property4, QgsPropertyDefinition( "p4", QgsPropertyDefinition::DataTypeString, QString(), QString() ) );
}

void TestQgsProperty::cleanupTestCase()
Expand Down Expand Up @@ -388,7 +388,7 @@ void TestQgsProperty::fieldBasedProperty()
property.setField( "bad_field" );
QCOMPARE( property.value( context, -1 ).toInt(), -1 );
// unset field name
QgsProperty defaultProperty = QgsProperty::fromField( QStringLiteral() );
QgsProperty defaultProperty = QgsProperty::fromField( QString() );
QCOMPARE( defaultProperty.value( context, -1 ).toInt(), -1 );
QVERIFY( defaultProperty.referencedFields( context ).isEmpty() );
defaultProperty.setActive( true );
Expand Down Expand Up @@ -493,7 +493,7 @@ void TestQgsProperty::expressionBasedProperty()
QCOMPARE( property.value( context, -1 ).toInt(), -1 );
QVERIFY( property.referencedFields( context ).isEmpty() );
// unset expression
QgsProperty defaultProperty = QgsProperty::fromExpression( QStringLiteral() );
QgsProperty defaultProperty = QgsProperty::fromExpression( QString() );
QCOMPARE( defaultProperty.value( context, -1 ).toInt(), -1 );
QVERIFY( defaultProperty.referencedFields( context ).isEmpty() );
defaultProperty.setActive( true );
Expand Down

0 comments on commit e9dee40

Please sign in to comment.