Skip to content

Commit

Permalink
astyle
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Feb 20, 2020
1 parent 697bad9 commit 8115be4
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions tests/src/core/testqgsdxfexport.cpp
Expand Up @@ -401,44 +401,44 @@ void TestQgsDxfExport::testMTextEscapeSpaces()

void TestQgsDxfExport::testMTextEscapeLineBreaks()
{
int field = mPointLayerNoSymbols->addExpressionField( QStringLiteral("'A text with ' || char(13) || char(10) || 'line break'"), QgsField( QStringLiteral( "linebreaktest" ), QVariant::String ) );

QgsPalLayerSettings settings;
settings.fieldName = QStringLiteral( "linebreaktest" );
QgsTextFormat format;
format.setFont( QgsFontUtils::getStandardTestFont( QStringLiteral( "Bold" ) ).family() );
format.setSize( 12 );
format.setNamedStyle( QStringLiteral( "Bold" ) );
format.setColor( QColor( 200, 0, 200 ) );
settings.setFormat( format );
mPointLayerNoSymbols->setLabeling( new QgsVectorLayerSimpleLabeling( settings ) );
mPointLayerNoSymbols->setLabelsEnabled( true );

QgsDxfExport d;
d.addLayers( QList< QgsDxfExport::DxfLayer >() << QgsDxfExport::DxfLayer( mPointLayerNoSymbols ) );

QgsMapSettings mapSettings;
QSize size( 640, 480 );
mapSettings.setOutputSize( size );
mapSettings.setExtent( mPointLayerNoSymbols->extent() );
mapSettings.setLayers( QList<QgsMapLayer *>() << mPointLayerNoSymbols );
mapSettings.setOutputDpi( 96 );
mapSettings.setDestinationCrs( mPointLayerNoSymbols->crs() );

d.setMapSettings( mapSettings );
d.setSymbologyScale( 1000 );
d.setSymbologyExport( QgsDxfExport::FeatureSymbology );

QString file = getTempFileName( "mtext_escape_linebreaks" );
QFile dxfFile( file );
QCOMPARE( d.writeToFile( &dxfFile, QStringLiteral( "CP1252" ) ), QgsDxfExport::ExportResult::Success );
dxfFile.close();

dxfFile.open( QIODevice::ReadOnly );
QString fileContent = QTextStream( &dxfFile ).readAll();
dxfFile.close();
QVERIFY( fileContent.contains( "A\\~text\\~with\\~\\Pline\\~break" ) );
mPointLayerNoSymbols->removeExpressionField( field );
int field = mPointLayerNoSymbols->addExpressionField( QStringLiteral( "'A text with ' || char(13) || char(10) || 'line break'" ), QgsField( QStringLiteral( "linebreaktest" ), QVariant::String ) );

QgsPalLayerSettings settings;
settings.fieldName = QStringLiteral( "linebreaktest" );
QgsTextFormat format;
format.setFont( QgsFontUtils::getStandardTestFont( QStringLiteral( "Bold" ) ).family() );
format.setSize( 12 );
format.setNamedStyle( QStringLiteral( "Bold" ) );
format.setColor( QColor( 200, 0, 200 ) );
settings.setFormat( format );
mPointLayerNoSymbols->setLabeling( new QgsVectorLayerSimpleLabeling( settings ) );
mPointLayerNoSymbols->setLabelsEnabled( true );

QgsDxfExport d;
d.addLayers( QList< QgsDxfExport::DxfLayer >() << QgsDxfExport::DxfLayer( mPointLayerNoSymbols ) );

QgsMapSettings mapSettings;
QSize size( 640, 480 );
mapSettings.setOutputSize( size );
mapSettings.setExtent( mPointLayerNoSymbols->extent() );
mapSettings.setLayers( QList<QgsMapLayer *>() << mPointLayerNoSymbols );
mapSettings.setOutputDpi( 96 );
mapSettings.setDestinationCrs( mPointLayerNoSymbols->crs() );

d.setMapSettings( mapSettings );
d.setSymbologyScale( 1000 );
d.setSymbologyExport( QgsDxfExport::FeatureSymbology );

QString file = getTempFileName( "mtext_escape_linebreaks" );
QFile dxfFile( file );
QCOMPARE( d.writeToFile( &dxfFile, QStringLiteral( "CP1252" ) ), QgsDxfExport::ExportResult::Success );
dxfFile.close();

dxfFile.open( QIODevice::ReadOnly );
QString fileContent = QTextStream( &dxfFile ).readAll();
dxfFile.close();
QVERIFY( fileContent.contains( "A\\~text\\~with\\~\\Pline\\~break" ) );
mPointLayerNoSymbols->removeExpressionField( field );
}

void TestQgsDxfExport::testText()
Expand Down

0 comments on commit 8115be4

Please sign in to comment.