Skip to content

Commit e9dee40

Browse files
committedMar 1, 2017
Fix build, warnings on windows
1 parent fcf718f commit e9dee40

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed
 

‎tests/src/core/testqgsexpression.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2674,21 +2674,35 @@ class TestQgsExpression: public QObject
26742674
{
26752675
QgsExpressionContext context;
26762676

2677+
#ifdef Q_OS_WIN
2678+
_putenv( "TESTENV_STRING=Hello World" );
2679+
#else
26772680
setenv( "TESTENV_STRING", "Hello World", 1 );
2681+
#endif
2682+
26782683
QgsExpression e( "env('TESTENV_STRING')" );
26792684

26802685
QVariant result = e.evaluate( &context );
26812686

26822687
QCOMPARE( result.toString(), QStringLiteral( "Hello World" ) );
2688+
#ifdef Q_OS_WIN
2689+
_putenv( "TESTENV_STRING=" );
2690+
_putenv( "TESTENV_INT=5" );
2691+
#else
26832692
unsetenv( "TESTENV_STRING" );
2684-
26852693
setenv( "TESTENV_INT", "5", 1 );
2694+
#endif
2695+
26862696
QgsExpression e2( "env('TESTENV_INT')" );
26872697

26882698
QVariant result2 = e2.evaluate( &context );
26892699

26902700
QCOMPARE( result2.toString(), QStringLiteral( "5" ) );
2701+
#ifdef Q_OS_WIN
2702+
_putenv( "TESTENV_INT=" );
2703+
#else
26912704
unsetenv( "TESTENV_INT" );
2705+
#endif
26922706

26932707
QgsExpression e3( "env('TESTENV_I_DO_NOT_EXIST')" );
26942708
QVariant result3 = e3.evaluate( &context );

‎tests/src/core/testqgsproperty.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class TestTransformer : public QgsPropertyTransformer
4848
{
4949
return new TestTransformer( mMinValue, mMaxValue );
5050
}
51-
virtual QString toExpression( const QString& ) const override { return QStringLiteral(); }
51+
virtual QString toExpression( const QString& ) const override { return QString(); }
5252

5353
private:
5454

@@ -104,10 +104,10 @@ void TestQgsProperty::initTestCase()
104104
{
105105
QgsApplication::init();
106106
QgsApplication::initQgis();
107-
mDefinitions.insert( Property1, QgsPropertyDefinition( "p1", QgsPropertyDefinition::DataTypeString, QStringLiteral(), QStringLiteral() ) );
108-
mDefinitions.insert( Property2, QgsPropertyDefinition( "p2", QgsPropertyDefinition::DataTypeString, QStringLiteral(), QStringLiteral() ) );
109-
mDefinitions.insert( Property3, QgsPropertyDefinition( "p3", QgsPropertyDefinition::DataTypeString, QStringLiteral(), QStringLiteral() ) );
110-
mDefinitions.insert( Property4, QgsPropertyDefinition( "p4", QgsPropertyDefinition::DataTypeString, QStringLiteral(), QStringLiteral() ) );
107+
mDefinitions.insert( Property1, QgsPropertyDefinition( "p1", QgsPropertyDefinition::DataTypeString, QString(), QString() ) );
108+
mDefinitions.insert( Property2, QgsPropertyDefinition( "p2", QgsPropertyDefinition::DataTypeString, QString(), QString() ) );
109+
mDefinitions.insert( Property3, QgsPropertyDefinition( "p3", QgsPropertyDefinition::DataTypeString, QString(), QString() ) );
110+
mDefinitions.insert( Property4, QgsPropertyDefinition( "p4", QgsPropertyDefinition::DataTypeString, QString(), QString() ) );
111111
}
112112

113113
void TestQgsProperty::cleanupTestCase()
@@ -388,7 +388,7 @@ void TestQgsProperty::fieldBasedProperty()
388388
property.setField( "bad_field" );
389389
QCOMPARE( property.value( context, -1 ).toInt(), -1 );
390390
// unset field name
391-
QgsProperty defaultProperty = QgsProperty::fromField( QStringLiteral() );
391+
QgsProperty defaultProperty = QgsProperty::fromField( QString() );
392392
QCOMPARE( defaultProperty.value( context, -1 ).toInt(), -1 );
393393
QVERIFY( defaultProperty.referencedFields( context ).isEmpty() );
394394
defaultProperty.setActive( true );
@@ -493,7 +493,7 @@ void TestQgsProperty::expressionBasedProperty()
493493
QCOMPARE( property.value( context, -1 ).toInt(), -1 );
494494
QVERIFY( property.referencedFields( context ).isEmpty() );
495495
// unset expression
496-
QgsProperty defaultProperty = QgsProperty::fromExpression( QStringLiteral() );
496+
QgsProperty defaultProperty = QgsProperty::fromExpression( QString() );
497497
QCOMPARE( defaultProperty.value( context, -1 ).toInt(), -1 );
498498
QVERIFY( defaultProperty.referencedFields( context ).isEmpty() );
499499
defaultProperty.setActive( true );

0 commit comments

Comments
 (0)
Please sign in to comment.