def test_window_title(self, mock_qappthread): mock_qappthread.return_value = mock_qappthread fig = MagicMock() fig.bbox.max = [1, 1] canvas = MantidFigureCanvas(fig) fig_mgr = FigureManagerWorkbench(canvas, 1) self.assertEqual(fig_mgr.get_window_title(), "Figure 1")
def test_construction(self, mock_qappthread): mock_qappthread.return_value = mock_qappthread fig = MagicMock() fig.bbox.max = [1, 1] canvas = MantidFigureCanvas(fig) fig_mgr = FigureManagerWorkbench(canvas, 1) self.assertNotEqual(fig_mgr, None)
def _is_button_enabled(cls, fig, button): """ Create the figure manager and check whether its toolbar is toggled on or off for the given figure. We have to explicitly call set_button_visibility() here, which would otherwise be called within the show() function. """ canvas = MantidFigureCanvas(fig) fig_manager = FigureManagerWorkbench(canvas, 1) # This is only called when show() is called on the figure manager, so we have to manually call it here. fig_manager.toolbar.set_buttons_visibility(fig) return fig_manager.toolbar._actions[button].isEnabled()