Skip to content

Commit

Permalink
Fix DependencySorter.sortedLayerIds. Fixes #14281
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Mercier committed Feb 12, 2016
1 parent 0c478d0 commit 6bbe3b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/core/qgslayerdefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ void QgsLayerDefinition::DependencySorter::init( const QDomDocument& doc )
{
sortedLayers << id;
mSortedLayerNodes << node;
mSortedLayerIds << id;
}
else
layersToSort << qMakePair( id, node );
Expand Down
5 changes: 3 additions & 2 deletions tests/src/python/test_qgslayerdefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand All @@ -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())

Expand All @@ -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):
Expand Down

0 comments on commit 6bbe3b9

Please sign in to comment.