Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vectortile] Fix missing cloning of labeling #57517

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/core/vectortile/qgsvectortilelayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ QgsVectorTileLayer *QgsVectorTileLayer::clone() const
const QgsVectorTileLayer::LayerOptions options( mTransformContext );
QgsVectorTileLayer *layer = new QgsVectorTileLayer( source(), name(), options );
layer->setRenderer( renderer() ? renderer()->clone() : nullptr );
layer->setLabeling( labeling() ? labeling()->clone() : nullptr );
return layer;
}

Expand Down
12 changes: 12 additions & 0 deletions tests/src/core/testqgsvectortilelayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class TestQgsVectorTileLayer : public QgsTest
void test_render();
void test_render_withClip();
void test_labeling();
void test_labeling_clone();

void testMbtilesProviderMetadata();
void test_relativePathsMbTiles();
Expand Down Expand Up @@ -220,6 +221,17 @@ void TestQgsVectorTileLayer::test_labeling()
QVERIFY( res2 );
}

void TestQgsVectorTileLayer::test_labeling_clone()
{
QgsVectorTileBasicLabeling *labeling = new QgsVectorTileBasicLabeling;
mLayer->setLabeling( labeling );

std::unique_ptr<QgsVectorTileLayer> vtlClone;
vtlClone.reset( mLayer->clone() );
QVERIFY( vtlClone->isValid() );
QVERIFY( vtlClone->labeling() != nullptr );
}

void TestQgsVectorTileLayer::testMbtilesProviderMetadata()
{
QgsProviderMetadata *vectorTileMetadata = QgsProviderRegistry::instance()->providerMetadata( "mbtilesvectortiles" );
Expand Down
Loading