Skip to content
Permalink
Browse files

Correctly disable postgres reliant tests when pg test is disabled

  • Loading branch information
nyalldawson committed Jan 27, 2020
1 parent c01523c commit 31aaf05bcfdd4d6b28a4232dd18ba9cdb879aa35
@@ -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() )
@@ -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() )
@@ -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 )
@@ -412,6 +412,7 @@ void TestQgsValueRelationWidgetWrapper::testZeroIndexInRelatedTable()

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

// create pg layers
@@ -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()

0 comments on commit 31aaf05

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