mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Fix QgsXmlUtils reading list to variant and add test
This commit is contained in:
parent
0170580019
commit
fc92e2a63e
@ -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 @@ class TestQgsXmlUtils(unittest.TestCase):
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user