Skip to content

Commit

Permalink
More endl fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 20, 2021
1 parent c2e1ea3 commit 196762f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gui/qgsexpressionbuilderwidget.cpp
Expand Up @@ -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();
}
}
Expand Down
28 changes: 28 additions & 0 deletions tests/src/geometry_checker/testqgsgeometrychecks.cpp
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 196762f

Please sign in to comment.