Skip to content
Permalink
Browse files
More endl fixes
  • Loading branch information
nyalldawson committed Jul 20, 2021
1 parent c2e1ea3 commit 196762ff8bca1f4318fc64b66b38f24f115ae101
Showing with 32 additions and 0 deletions.
  1. +4 −0 src/gui/qgsexpressionbuilderwidget.cpp
  2. +28 −0 tests/src/geometry_checker/testqgsgeometrychecks.cpp
@@ -370,7 +370,11 @@ void QgsExpressionBuilderWidget::saveFunctionFile( QString fileName )
if ( myFile.open( QIODevice::WriteOnly | QFile::Truncate ) )
{
QTextStream myFileStream( &myFile );
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
myFileStream << txtPython->text() << endl;
#else
myFileStream << txtPython->text() << Qt::endl;
#endif
myFile.close();
}
}
@@ -1351,14 +1351,26 @@ void TestQgsGeometryChecks::cleanupTestContext( QPair<QgsGeometryCheckContext *,

void TestQgsGeometryChecks::listErrors( const QList<QgsGeometryCheckError *> &checkErrors, const QStringList &messages ) const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QTextStream( stdout ) << " - Check result:" << endl;
#else
QTextStream( stdout ) << " - Check result:" << Qt::endl;
#endif
for ( const QgsGeometryCheckError *error : checkErrors )
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QTextStream( stdout ) << " * " << error->layerId() << ":" << error->featureId() << " @[" << error->vidx().part << ", " << error->vidx().ring << ", " << error->vidx().vertex << "](" << error->location().x() << ", " << error->location().y() << ") = " << error->value().toString() << endl;
#else
QTextStream( stdout ) << " * " << error->layerId() << ":" << error->featureId() << " @[" << error->vidx().part << ", " << error->vidx().ring << ", " << error->vidx().vertex << "](" << error->location().x() << ", " << error->location().y() << ") = " << error->value().toString() << Qt::endl;
#endif
}
if ( !messages.isEmpty() )
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QTextStream( stdout ) << " - Check messages:" << endl << " * " << messages.join( "\n * " ) << endl;
#else
QTextStream( stdout ) << " - Check messages:" << endl << " * " << messages.join( "\n * " ) << Qt::endl;
#endif
}
}

@@ -1404,10 +1416,18 @@ QList<QgsGeometryCheckError *> TestQgsGeometryChecks::searchCheckErrors( const Q

bool TestQgsGeometryChecks::fixCheckError( QMap<QString, QgsFeaturePool *> featurePools, QgsGeometryCheckError *error, int method, const QgsGeometryCheckError::Status &expectedStatus, const QVector<Change> &expectedChanges, const QMap<QString, int> &mergeAttrs )
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QTextStream( stdout ) << " - Fixing " << error->layerId() << ":" << error->featureId() << " @[" << error->vidx().part << ", " << error->vidx().ring << ", " << error->vidx().vertex << "](" << error->location().x() << ", " << error->location().y() << ") = " << error->value().toString() << endl;
#else
QTextStream( stdout ) << " - Fixing " << error->layerId() << ":" << error->featureId() << " @[" << error->vidx().part << ", " << error->vidx().ring << ", " << error->vidx().vertex << "](" << error->location().x() << ", " << error->location().y() << ") = " << error->value().toString() << Qt::endl;
#endif
QgsGeometryCheck::Changes changes;
error->check()->fixError( featurePools, error, method, mergeAttrs, changes );
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QTextStream( stdout ) << " * Fix status: " << error->status() << endl;
#else
QTextStream( stdout ) << " * Fix status: " << error->status() << Qt::endl;
#endif
if ( error->status() != expectedStatus )
{
return false;
@@ -1421,12 +1441,20 @@ bool TestQgsGeometryChecks::fixCheckError( QMap<QString, QgsFeaturePool *> featu
{
for ( const QgsGeometryCheck::Change &change : changes[layerId][fid] )
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QTextStream( stdout ) << " * Change: " << layerId << ":" << fid << " :: " << strChangeWhat[change.what] << ", " << strChangeType[change.type] << ", " << change.vidx.part << ":" << change.vidx.ring << ":" << change.vidx.vertex << endl;
#else
QTextStream( stdout ) << " * Change: " << layerId << ":" << fid << " :: " << strChangeWhat[change.what] << ", " << strChangeType[change.type] << ", " << change.vidx.part << ":" << change.vidx.ring << ":" << change.vidx.vertex << Qt::endl;
#endif
}
totChanges += changes[layerId][fid].size();
}
}
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QTextStream( stdout ) << " * Num changes: " << totChanges << ", expected num changes: " << expectedChanges.size() << endl;
#else
QTextStream( stdout ) << " * Num changes: " << totChanges << ", expected num changes: " << expectedChanges.size() << Qt::endl;
#endif
if ( expectedChanges.size() != totChanges )
{
return false;

0 comments on commit 196762f

Please sign in to comment.