Navigation Menu

Skip to content

Commit

Permalink
Correctly disable postgres reliant tests when pg test is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 27, 2020
1 parent c01523c commit 31aaf05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tests/src/gui/testqgstexteditwrapper.cpp
Expand Up @@ -71,6 +71,7 @@ void TestQgsTextEditWrapper::cleanup()

void TestQgsTextEditWrapper::testWithJsonInPostgres()
{
#ifdef ENABLE_PGTEST
// create pg layers
QString dbConn = getenv( "QGIS_PGTEST_DB" );
if ( dbConn.isEmpty() )
Expand Down Expand Up @@ -169,10 +170,12 @@ void TestQgsTextEditWrapper::testWithJsonInPostgres()
QVERIFY( QgsJsonUtils::jsonFromVariant( w_json.value() ).is_string() );
// avoid dumping as strings are quoted, so would be double quoted
QCOMPARE( QString::fromStdString( QgsJsonUtils::jsonFromVariant( w_json.value() ).front( ) ), QStringLiteral( "abc" ) );
#endif
}

void TestQgsTextEditWrapper::testWithJsonBInPostgres()
{
#ifdef ENABLE_PGTEST
//create pg layers
QString dbConn = getenv( "QGIS_PGTEST_DB" );
if ( dbConn.isEmpty() )
Expand Down Expand Up @@ -273,6 +276,7 @@ void TestQgsTextEditWrapper::testWithJsonBInPostgres()
QVERIFY( QgsJsonUtils::jsonFromVariant( w_json.value() ).is_string() );
// avoid dumping as strings are quoted, so would be double quoted
QCOMPARE( QString::fromStdString( QgsJsonUtils::jsonFromVariant( w_json.value() ).front( ) ), QStringLiteral( "abc" ) );
#endif
}

QGSTEST_MAIN( TestQgsTextEditWrapper )
Expand Down
3 changes: 2 additions & 1 deletion tests/src/gui/testqgsvaluerelationwidgetwrapper.cpp
Expand Up @@ -412,6 +412,7 @@ void TestQgsValueRelationWidgetWrapper::testZeroIndexInRelatedTable()

void TestQgsValueRelationWidgetWrapper::testWithJsonInPostgres()
{
#ifdef ENABLE_PGTEST
//this is only reading

// create pg layers
Expand Down Expand Up @@ -522,7 +523,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInPostgres()

// check value from widget wrapper
QCOMPARE( w_favoriteauthors_b.value().toStringList(), QStringList() << "4" << "5" << "6" );

#endif
}

void TestQgsValueRelationWidgetWrapper::testWithJsonInGPKG()
Expand Down

0 comments on commit 31aaf05

Please sign in to comment.