mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-31 00:04:24 -05:00
only remove suffix when it's on the end
This commit is contained in:
parent
1cc9029b1f
commit
da8c41a57d
@ -251,7 +251,8 @@ void QgsOfflineEditing::synchronize()
|
||||
QString remoteProvider = layer->customProperty( CUSTOM_PROPERTY_REMOTE_PROVIDER, "" ).toString();
|
||||
QString remoteName = layer->name();
|
||||
QString remoteNameSuffix = layer->customProperty( CUSTOM_PROPERTY_LAYERNAME_SUFFIX, " (offline)" ).toString();
|
||||
remoteName.remove( remoteNameSuffix );
|
||||
if ( remoteName.endsWith( remoteNameSuffix ) )
|
||||
remoteName.chop( remoteNameSuffix.size() );
|
||||
const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
|
||||
QgsVectorLayer *remoteLayer = new QgsVectorLayer( remoteSource, remoteName, remoteProvider, options );
|
||||
if ( remoteLayer->isValid() )
|
||||
|
||||
@ -121,9 +121,10 @@ void TestQgsOfflineEditing::createSpatialiteAndSynchronizeBack_data()
|
||||
QTest::addColumn<QString>( "suffix_input" );
|
||||
QTest::addColumn<QString>( "suffix_result" );
|
||||
|
||||
QTest::newRow( "no suffix" ) << QString( "no suffix" ) << QStringLiteral( " (offline)" );
|
||||
QTest::newRow( "no suffix" ) << QString( "no suffix" ) << QStringLiteral( " (offline)" ); //default value expected
|
||||
QTest::newRow( "null suffix" ) << QString() << QString();
|
||||
QTest::newRow( "empty suffix" ) << QStringLiteral( "" ) << QStringLiteral( "" );
|
||||
QTest::newRow( "part of name suffix" ) << QStringLiteral( "point" ) << QStringLiteral( "point" );
|
||||
QTest::newRow( "another suffix" ) << QStringLiteral( "another suffix" ) << QStringLiteral( "another suffix" );
|
||||
}
|
||||
|
||||
@ -132,9 +133,10 @@ void TestQgsOfflineEditing::createGeopackageAndSynchronizeBack_data()
|
||||
QTest::addColumn<QString>( "suffix_input" );
|
||||
QTest::addColumn<QString>( "suffix_result" );
|
||||
|
||||
QTest::newRow( "no suffix" ) << QStringLiteral( "no suffix" ) << QStringLiteral( " (offline)" );
|
||||
QTest::newRow( "no suffix" ) << QStringLiteral( "no suffix" ) << QStringLiteral( " (offline)" ); //default value expected
|
||||
QTest::newRow( "null suffix" ) << QString() << QString();
|
||||
QTest::newRow( "empty suffix" ) << QStringLiteral( "" ) << QStringLiteral( "" );
|
||||
QTest::newRow( "part of name suffix" ) << QStringLiteral( "point" ) << QStringLiteral( "point" );
|
||||
QTest::newRow( "another suffix" ) << QStringLiteral( "another suffix" ) << QStringLiteral( "another suffix" );
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user