Skip to content
Permalink
Browse files

Fix DependencySorter.sortedLayerIds. Fixes #14281

  • Loading branch information
Hugo Mercier
Hugo Mercier committed Feb 12, 2016
1 parent 0c478d0 commit 6bbe3b93a22a310754f55f739c6cef8b1043a902
Showing with 4 additions and 2 deletions.
  1. +1 −0 src/core/qgslayerdefinition.cpp
  2. +3 −2 tests/src/python/test_qgslayerdefinition.py
@@ -230,6 +230,7 @@ void QgsLayerDefinition::DependencySorter::init( const QDomDocument& doc )
{
sortedLayers << id;
mSortedLayerNodes << node;
mSortedLayerIds << id;
}
else
layersToSort << qMakePair( id, node );
@@ -52,10 +52,13 @@ def testDependency(self):
doc.setContent(inDoc)
dep = QgsLayerDefinition.DependencySorter(doc)
nodes = dep.sortedLayerNodes()
nodeIds = dep.sortedLayerIds()
self.assertTrue(not dep.hasCycle())
self.assertTrue(not dep.hasMissingDependency())
self.assertEqual(nodes[0].firstChildElement("id").text(), "layerA")
self.assertEqual(nodes[1].firstChildElement("id").text(), "layerB")
self.assertEqual(nodeIds[0], "layerA")
self.assertEqual(nodeIds[1], "layerB")

def testMissingDependency(self):
inDoc = """
@@ -76,7 +79,6 @@ def testMissingDependency(self):
doc = QDomDocument("testdoc")
doc.setContent(inDoc)
dep = QgsLayerDefinition.DependencySorter(doc)
nodes = dep.sortedLayerNodes()
self.assertTrue(not dep.hasCycle())
self.assertTrue(dep.hasMissingDependency())

@@ -99,7 +101,6 @@ def testCyclicDependency(self):
doc = QDomDocument("testdoc")
doc.setContent(inDoc)
dep = QgsLayerDefinition.DependencySorter(doc)
nodes = dep.sortedLayerNodes()
self.assertTrue(dep.hasCycle())

def testVectorAndRaster(self):

0 comments on commit 6bbe3b9

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