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")
Exemple #2
0
 def test_reverse_axes_lines(self):
     fig, ax = plt.subplots(subplot_kw={'projection': 'mantid'})
     spec2 = ax.plot(self.ws2d_histo, 'rs', specNum=2, linewidth=6)
     spec3 = ax.plot(self.ws2d_histo, 'rs', specNum=3, linewidth=6)
     spec1 = ax.plot(self.ws2d_histo, 'rs', specNum=1, linewidth=6)
     self.assertEqual(ax.get_lines()[0], spec2[0])
     self.assertEqual(ax.get_lines()[1], spec3[0])
     self.assertEqual(ax.get_lines()[2], spec1[0])
     FigureManagerWorkbench._reverse_axis_lines(ax)
     self.assertEqual(ax.get_lines()[0], spec1[0])
     self.assertEqual(ax.get_lines()[1], spec3[0])
     self.assertEqual(ax.get_lines()[2], spec2[0])
 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)
Exemple #4
0
 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()
Exemple #5
0
 def test_construction(self, mock_qappthread):
     mock_qappthread.return_value = mock_qappthread
     fig = MagicMock()
     canvas = FigureCanvasQTAgg(fig)
     fig_mgr = FigureManagerWorkbench(canvas, 1)
     self.assertNotEqual(fig_mgr, None)