Skip to content
Permalink
Browse files

Merge remote-tracking branch 'rouault/fix_qt5_wfs_ogcutils_tests'

  • Loading branch information
rouault committed May 15, 2016
2 parents 63cab56 + 9a49c6a commit c4819adea4c1778ab2bedd327132be9f5e8576ae
@@ -15,8 +15,6 @@ PyQgsSipCoverage
PyQgsSpatialiteProvider
PyQgsVirtualLayerDefinition
PyQgsVirtualLayerProvider
PyQgsWFSProvider
PyQgsWFSProviderGUI
qgis_composermapgridtest
qgis_composertabletest
qgis_composertablev2test
@@ -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
@@ -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
//
@@ -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();
@@ -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()
{
@@ -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()
@@ -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> )
@@ -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()
@@ -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\">"
@@ -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.
You can’t perform that action at this time.