source: orange/Orange/OrangeCanvas/application/tests/test_settings.py @ 11250:3b499a088cfc

Revision 11250:3b499a088cfc, 1.1 KB checked in by Ales Erjavec <ales.erjavec@…>, 18 months ago (diff)

Added user settings/preferences dialog.

Line 
1import logging
2
3from PyQt4.QtGui import QTreeView
4from PyQt4.QtCore import QSettings
5
6from ...gui import test
7
8from ..settings import UserSettingsDialog, UserSettingsModel
9from ...utils.settings import Settings, config_slot
10
11
12class TestUserSettings(test.QAppTestCase):
13    def setUp(self):
14        logging.basicConfig()
15        test.QAppTestCase.setUp(self)
16
17    def test(self):
18        settings = UserSettingsDialog()
19        settings.show()
20
21        self.app.exec_()
22
23    def test_settings_model(self):
24        store = QSettings(QSettings.IniFormat, QSettings.UserScope,
25                          "biolab.si", "Orange Canvas UnitTests")
26
27        defaults = [config_slot("S1", bool, True, "Something"),
28                    config_slot("S2", unicode, "I an not a String",
29                                "Disregard the string.")]
30
31        settings = Settings(defaults=defaults, store=store)
32        model = UserSettingsModel(settings=settings)
33
34        self.assertEqual(model.rowCount(), len(settings))
35
36        view = QTreeView()
37        view.setHeaderHidden(False)
38
39        view.setModel(model)
40
41        view.show()
42        self.app.exec_()
Note: See TracBrowser for help on using the repository browser.