Skip to content

Commit

Permalink
Merge remote-tracking branch 'rouault/fix_qt5_wfs_ogcutils_tests'
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed May 15, 2016
2 parents 63cab56 + 9a49c6a commit c4819ad
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 44 deletions.
2 changes: 0 additions & 2 deletions ci/travis/linux/qt5/blacklist.txt
Expand Up @@ -15,8 +15,6 @@ PyQgsSipCoverage
PyQgsSpatialiteProvider
PyQgsVirtualLayerDefinition
PyQgsVirtualLayerProvider
PyQgsWFSProvider
PyQgsWFSProviderGUI
qgis_composermapgridtest
qgis_composertabletest
qgis_composertablev2test
Expand Down
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfssourceselect.cpp
Expand Up @@ -277,7 +277,7 @@ void QgsWFSSourceSelect::capabilitiesReplyFinished()
treeView->setColumnWidth( MODEL_IDX_ABSTRACT, 150 );
}
btnChangeSpatialRefSys->setEnabled( true );
treeView->selectionModel()->select( mModel->index( 0, 0 ), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows );
treeView->selectionModel()->setCurrentIndex( mModelProxy->index( 0, 0 ), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows );
treeView->setFocus();
}
else
Expand Down
24 changes: 11 additions & 13 deletions tests/src/core/testqgsogcutils.cpp
Expand Up @@ -32,6 +32,9 @@ class TestQgsOgcUtils : public QObject

void initTestCase()
{
// Needed on Qt 5 so that the serialization of XML is consistant among all executions
qputenv( "QT_HASH_SEED", "1" );

//
// Runs once before any tests are run
//
Expand All @@ -57,10 +60,8 @@ class TestQgsOgcUtils : public QObject
void testExpressionToOgcFilterWFS11();
void testExpressionToOgcFilterWFS11_data();

#if QT_VERSION < 0x050000
void testExpressionToOgcFilterWFS20();
void testExpressionToOgcFilterWFS20_data();
#endif

void testSQLStatementToOgcFilter();
void testSQLStatementToOgcFilter_data();
Expand Down Expand Up @@ -428,8 +429,12 @@ void TestQgsOgcUtils::testExpressionToOgcFilterWFS11_data()
"</ogc:Filter>" );
}

// There's an issue with QT 5 that appears to reverse the order of multiple attributes
#if QT_VERSION < 0x050000
static QString normalizeXML( const QString& xmlText )
{
QDomDocument doc;
doc.setContent( xmlText, true );
return doc.toString( -1 );
}

void TestQgsOgcUtils::testExpressionToOgcFilterWFS20()
{
Expand All @@ -456,7 +461,7 @@ void TestQgsOgcUtils::testExpressionToOgcFilterWFS20()
qDebug( "SRSNAME: %s", srsName.toAscii().data() );
qDebug( "OGC : %s", doc.toString( -1 ).toAscii().data() );

QCOMPARE( xmlText, doc.toString( -1 ) );
QCOMPARE( normalizeXML( xmlText ), normalizeXML( doc.toString( -1 ) ) );
}

void TestQgsOgcUtils::testExpressionToOgcFilterWFS20_data()
Expand Down Expand Up @@ -504,8 +509,6 @@ void TestQgsOgcUtils::testExpressionToOgcFilterWFS20_data()
"</fes:Filter>" );
}

#endif

Q_DECLARE_METATYPE( QgsOgcUtils::GMLVersion )
Q_DECLARE_METATYPE( QgsOgcUtils::FilterVersion )
Q_DECLARE_METATYPE( QList<QgsOgcUtils::LayerProperties> )
Expand Down Expand Up @@ -558,7 +561,7 @@ void TestQgsOgcUtils::testSQLStatementToOgcFilter()
filterVersion == QgsOgcUtils::FILTER_FES_2_0 ? "FES 2.0" : "unknown" );
qDebug( "OGC : %s", doc.toString( -1 ).toAscii().data() );

QCOMPARE( doc.toString( -1 ), xmlText );
QCOMPARE( normalizeXML( xmlText ), normalizeXML( doc.toString( -1 ) ) );
}

void TestQgsOgcUtils::testSQLStatementToOgcFilter_data()
Expand Down Expand Up @@ -742,9 +745,6 @@ void TestQgsOgcUtils::testSQLStatementToOgcFilter_data()
"</ogc:BBOX>"
"</ogc:Filter>" );

// There's an issue with QT 5 that appears to reverse the order of multiple attributes
#if QT_VERSION < 0x050000

QTest::newRow( "intersects + wkt + explicit srs" ) << QString( "SELECT * FROM t WHERE ST_Intersects(geom, ST_GeometryFromText('POINT (5 6)', 'urn:ogc:def:crs:EPSG::4326'))" ) <<
QgsOgcUtils::GML_3_2_1 << QgsOgcUtils::FILTER_FES_2_0 << layerProperties << QString(
"<fes:Filter xmlns:fes=\"http://www.opengis.net/fes/2.0\" xmlns:gml=\"http://www.opengis.net/gml/3.2\">"
Expand Down Expand Up @@ -852,9 +852,7 @@ void TestQgsOgcUtils::testSQLStatementToOgcFilter_data()
"</fes:PropertyIsEqualTo>"
"</fes:And>"
"</fes:Filter>" );
#endif
}


QTEST_MAIN( TestQgsOgcUtils )
#include "testqgsogcutils.moc"

0 comments on commit c4819ad

Please sign in to comment.