source: orange/Orange/OrangeCanvas/preview/tests/test_previewdialog.py @ 11114:16262014a6ea

Revision 11114:16262014a6ea, 726 bytes checked in by Ales Erjavec <ales.erjavec@…>, 18 months ago (diff)

Added preview browser widget and dialog.

Line 
1"""
2Unittests for PrewiewDialog widget.
3
4"""
5
6from ...gui import test
7
8from ..previewdialog import PreviewDialog
9from .test_previewbrowser import construct_test_preview_model
10
11
12class TestPreviewDialog(test.QAppTestCase):
13    def test_preview_dialog(self):
14        w = PreviewDialog()
15        model = construct_test_preview_model()
16        w.setModel(model)
17        w.show()
18
19        current = [None]
20        w.currentIndexChanged.connect(current.append)
21        status = w.exec_()
22
23        if status and len(current) > 1:
24            self.assertIs(current[-1], w.currentIndex())
25
26        w.setItems(["A", "B"])
27        w.show()
28        status = w.exec_()
29        if status:
30            self.assertTrue(w.currentIndex() != -1)
Note: See TracBrowser for help on using the repository browser.