Skip to content

Commit

Permalink
Refs #4375 close the plots to help test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Janik Zikovsky committed Dec 29, 2011
1 parent aeb0adb commit 12ad9ed
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Code/Mantid/MantidPlot/test/MantidPlot1DPlotTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from mantidplottests import *
import time
import numpy as np
from PyQt4 import QtGui
from PyQt4 import QtGui, QtCore

# =============== Create a fake workspace to plot =======================
X1 = np.linspace(0,10, 100)
Expand All @@ -20,25 +20,34 @@
Y = np.append(Y1, Y2)
E = np.sqrt(Y)

CreateWorkspace("fake", X, Y, E, NSpec=2, UnitX="TOF", YUnitLabel="Counts", WorkspaceTitle="Faked data Workspace")
CreateWorkspace("fake", list(X), list(Y), list(E), NSpec=2, UnitX="TOF", YUnitLabel="Counts", WorkspaceTitle="Faked data Workspace")
#CreateWorkspace("fake2", X, Y, E, NSpec=2, UnitX="TOF", YUnitLabel="Counts", WorkspaceTitle="Faked data Workspace")

class MantidPlot1DPlotTest(unittest.TestCase):

def setUp(self):
pass

def tearDown(self):
"""Clean up by closing the created window """
self.g.confirmClose(False)
self.g.close()
QtCore.QCoreApplication.processEvents()

def test_plotSpectrum_errorBars(self):
g = plotSpectrum("fake", 0, error_bars=True)
screenshot(g, "plotSpectrum_errorBars", "Call to plotSpectrum() of 1 spectrum, with error bars.")
self.g = g

def test_plotSpectrum_fromWorkspaceProxy(self):
ws = mtd["fake"]
plotSpectrum(ws, 0, error_bars=True)
g = plotSpectrum(ws, 0, error_bars=True)
self.g = g

def test_plotSpectrum_severalSpectra(self):
g = plotSpectrum("fake", [0, 1])
screenshot(g, "plotSpectrum_severalSpectra", "Call to plotSpectrum() of 2 spectra, no error bars.")
self.g = g

def test_Customized1DPlot(self):
g = plotSpectrum("fake", 0, error_bars=True)
Expand All @@ -52,7 +61,7 @@ def test_Customized1DPlot(self):
l.setScale(2, 0, 3.0)
l.setAntialiasing(True)
screenshot(g, "Customized1DPlot", "1D plot of a spectrum, with error bars, an orange line of width 2, a custom title in red Arial font, with X from 0 to 3")

self.g = g


# Run the unit tests
Expand Down

0 comments on commit 12ad9ed

Please sign in to comment.