Skip to content

Commit fc92e2a

Browse files
committed
Fix QgsXmlUtils reading list to variant and add test
1 parent 0170580 commit fc92e2a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/core/qgsxmlutils.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ QVariant QgsXmlUtils::readVariant( const QDomElement &element )
189189
for ( int i = 0; i < values.count(); ++i )
190190
{
191191
QDomElement elem = values.at( i ).toElement();
192-
if ( elem.tagName() == QLatin1String( "e" ) )
193-
list.append( readVariant( elem ) );
192+
list.append( readVariant( elem ) );
194193
}
195194
return list;
196195
}

tests/src/python/test_qgsxmlutils.py

+12
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ def test_boolean(self):
7777

7878
self.assertEquals(my_properties, prop2)
7979

80+
def test_list(self):
81+
"""
82+
Test that lists are correctly loaded and written
83+
"""
84+
doc = QDomDocument("properties")
85+
my_properties = [1, 4, 'a', 'test', 7.9]
86+
elem = QgsXmlUtils.writeVariant(my_properties, doc)
87+
88+
prop2 = QgsXmlUtils.readVariant(elem)
89+
90+
self.assertEquals(my_properties, prop2)
91+
8092
def test_complex(self):
8193
"""
8294
Test that maps are correctly loaded and written

0 commit comments

Comments
 (0)