Commit c2ada0ec authored by Yori 'AGy' Fournier's avatar Yori 'AGy' Fournier
Browse files

Tested WXAgg and GTKAgg, both worked! Modified myFig.print2file to take into...

Tested WXAgg and GTKAgg, both worked! Modified myFig.print2file to take into account the case when the user put the path into the filename. Make the test for these feature (test306).
parent 528fd2ee
......@@ -128,6 +128,6 @@ from .myFig4Test import MyFig4Test
from .myPlot4Test import somePlottingRoutine
from .test import myTest
from .test import test400, test300, test301, test302, test303, test304, test305, test401, test402, test403
from .test import test400, test300, test301, test302, test303, test304, test305, test306, test401, test402, test403
testList = [test400, test300, test301, test302, test303, test304, test305, test401, test402, test403]
testList = [test400, test300, test301, test302, test303, test304, test305, test306, test401, test402, test403]
......@@ -65,6 +65,7 @@
#
#
# IMPORT ---------------------------------------------------------------
from . import os
from . import D_FIGSIZE, D_INPUTARG, D_DEBUG, D_REFORMAT, D_FORMATTED
from . import D_OFORMAT, D_OPATH
from . import DBUG, SEVR, INFO, SPCE, WARN
......@@ -165,6 +166,7 @@ class MyFig(Figure):
# PRINT 2 FILE -------------------------------------------------------
def print2file(self, filename, *args, **kwargs):
debug = kwargs.get('debug', D_DEBUG)
oformat = kwargs.get('oformat', D_OFORMAT)
opath = kwargs.get('opath', D_OPATH)
......@@ -197,6 +199,14 @@ class MyFig(Figure):
elif '.eps' in str(filename):
oformat = 'eps'
filename = filename[:-4]
# check if the path is in the name
if '/' in str(filename):
if(debug):
print(WARN + "I detect that the path is in the name of the file, will ignore D_OPATH.")
arg = filename
filename = os.path.basename(arg)
opath = os.path.dirname(arg)
# take care of the . in the extention
if oformat[0] == '.':
......
......@@ -205,6 +205,32 @@ def test305(debug):
return(status)
# TEST 306: Test MyFig::print2file (EXPECTED: True)
def test306(debug):
if os.path.exists("./myplotlib/img/test306.png"):
os.remove("./myplotlib/img/test306.png")
status = True
data1 = readStupidData('data1')
fig = MyFig(inputarg=data1)
if debug:
print(DBUG + "Try to print MyFig with data1 in myplotlib/img/test306.png")
fig.print2file('myplotlib/img/test306.png') # create img/test306.png
if not os.path.exists("./myplotlib/img/test306.png"):
status = False
del fig
del data1
return(status)
# TEST 401: Verify the well behaving of MyWin::close (EXPECTED: TRUE)
def test401(debug):
......@@ -266,7 +292,7 @@ def test402(debug):
return(status)
# TEST 305: Test MyFig::print2file And MyWin::refresh (EXPECTED: True)
# TEST 403: Test MyFig::print2file And MyWin::refresh (EXPECTED: True)
def test403(debug):
status = True
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment