Navigation Menu

Skip to content

Commit

Permalink
Fix QgsXmlUtils reading list to variant and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 9, 2017
1 parent 0170580 commit fc92e2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/core/qgsxmlutils.cpp
Expand Up @@ -189,8 +189,7 @@ QVariant QgsXmlUtils::readVariant( const QDomElement &element )
for ( int i = 0; i < values.count(); ++i )
{
QDomElement elem = values.at( i ).toElement();
if ( elem.tagName() == QLatin1String( "e" ) )
list.append( readVariant( elem ) );
list.append( readVariant( elem ) );
}
return list;
}
Expand Down
12 changes: 12 additions & 0 deletions tests/src/python/test_qgsxmlutils.py
Expand Up @@ -77,6 +77,18 @@ def test_boolean(self):

self.assertEquals(my_properties, prop2)

def test_list(self):
"""
Test that lists are correctly loaded and written
"""
doc = QDomDocument("properties")
my_properties = [1, 4, 'a', 'test', 7.9]
elem = QgsXmlUtils.writeVariant(my_properties, doc)

prop2 = QgsXmlUtils.readVariant(elem)

self.assertEquals(my_properties, prop2)

def test_complex(self):
"""
Test that maps are correctly loaded and written
Expand Down

0 comments on commit fc92e2a

Please sign in to comment.