Skip to content
Permalink
Browse files

Add test for style synchronisation in offline editing

  • Loading branch information
m-kuhn committed Jun 2, 2020
1 parent 3cd9a39 commit 6c5ac930016025c4024dea36a78ff5b89d89108a
Showing with 6 additions and 0 deletions.
  1. +6 −0 tests/src/core/testqgsofflineediting.cpp
@@ -26,6 +26,7 @@
#include "qgstest.h"
#include "qgsvectorlayerref.h"
#include "qgslayertree.h"
#include "qgsmaplayerstylemanager.h"

/**
* \ingroup UnitTests
@@ -164,6 +165,10 @@ void TestQgsOfflineEditing::createGeopackageAndSynchronizeBack()
QgsLayerTreeLayer *layerTreelayer = QgsProject::instance()->layerTreeRoot()->findLayer( mpLayer->id() );
layerTreelayer->setCustomProperty( QStringLiteral( "showFeatureCount" ), 1 );
layerTreelayer->setItemVisibilityChecked( false );
QgsMapLayerStyle style;
style.readFromLayer( mpLayer );

mpLayer->styleManager()->addStyle( QStringLiteral( "testStyle" ), style );

//convert
mOfflineEditing->convertToOfflineProject( offlineDataPath, offlineDbFile, layerIds, false, QgsOfflineEditing::GPKG );
@@ -177,6 +182,7 @@ void TestQgsOfflineEditing::createGeopackageAndSynchronizeBack()
layerTreelayer = QgsProject::instance()->layerTreeRoot()->findLayer( mpLayer->id() );
QCOMPARE( layerTreelayer->customProperty( QStringLiteral( "showFeatureCount" ), 0 ).toInt(), 1 );
QCOMPARE( layerTreelayer->isVisible(), false );
QVERIFY( mpLayer->styleManager()->styles().contains( QStringLiteral( "testStyle" ) ) );

QgsFeature firstFeatureInAction;
it = mpLayer->getFeatures();

0 comments on commit 6c5ac93

Please sign in to comment.
You can’t perform that action at this time.