Skip to content

Commit

Permalink
settings.globalChildGroups() test moved to test_qgssettings.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrocha committed Sep 2, 2017
1 parent 7af72f7 commit 390a34f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/src/python/test_qgssettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,33 @@ def test_groups(self):
self.assertEqual('qgisrocks-1', self.settings.value('testqgissettings/names/name1'))
self.assertEqual('qgisrocks-4', self.settings.value('testqgissettings/names/name4'))

def test_global_groups(self):
self.assertEqual(self.settings.allKeys(), [])
self.assertEqual(self.globalsettings.allKeys(), [])

self.addToDefaults('testqgissettings/foo/first', 'qgis')
self.addToDefaults('testqgissettings/foo/last', 'rocks')

self.settings.beginGroup('testqgissettings')
self.assertEqual(['foo'], self.settings.childGroups())
self.assertEqual(['foo'], self.settings.globalChildGroups())
self.settings.endGroup()

self.settings.setValue('testqgissettings/bar/first', 'qgis')
self.settings.setValue('testqgissettings/bar/last', 'rocks')

self.settings.beginGroup('testqgissettings')
self.assertEqual(sorted(['bar', 'foo']), sorted(self.settings.childGroups()))
self.assertEqual(['foo'], self.settings.globalChildGroups())
self.settings.endGroup()

self.globalsettings.remove('testqgissettings/foo')

self.settings.beginGroup('testqgissettings')
self.assertEqual(['bar'], self.settings.childGroups())
self.assertEqual([], self.settings.globalChildGroups())
self.settings.endGroup()

def test_array(self):
self.assertEqual(self.settings.allKeys(), [])
self.addArrayToDefaults('testqgissettings', 'key', ['qgisrocks1', 'qgisrocks2', 'qgisrocks3'])
Expand Down

0 comments on commit 390a34f

Please sign in to comment.