Skip to content
Permalink
Browse files

Fix QgsXmlUtils reading list to variant and add test

  • Loading branch information
m-kuhn committed Mar 9, 2017
1 parent 0170580 commit fc92e2a63e46736dcab3ff139f1872e73dee2227
Showing with 13 additions and 2 deletions.
  1. +1 −2 src/core/qgsxmlutils.cpp
  2. +12 −0 tests/src/python/test_qgsxmlutils.py
@@ -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;
}
@@ -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

0 comments on commit fc92e2a

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