class TestGlueApplication(unittest.TestCase):
    def setUp(self):
        self.qapp = QApplication([""])
        self.app = GlueApplication()

    def tearDown(self):
        self.app.close()
        del self.app
        del self.qapp

    def test_new_tabs(self):
        t0 = tab_count(self.app)
        self.app._new_tab()
        self.assertEquals(t0 + 1, tab_count(self.app))
Exemple #2
0
    def test_viewer_size(self, tmpdir):

        # regression test for #781
        # viewers were not restored with the right size

        d1 = Data(x=np.random.random((2,) * self.ndim))
        d2 = Data(x=np.random.random((2,) * self.ndim))
        dc = DataCollection([d1, d2])
        app = GlueApplication(dc)
        w = app.new_data_viewer(self.widget_cls, data=d1)
        w.viewer_size = (300, 400)

        filename = tmpdir.join('session.glu').strpath
        app.save_session(filename, include_data=True)

        app2 = GlueApplication.restore_session(filename)

        for viewer in app2.viewers:
            assert viewer[0].viewer_size == (300, 400)

        app.close()
        app2.close()