Skip to content

Commit

Permalink
Added new test for text as object feature
Browse files Browse the repository at this point in the history
  • Loading branch information
aashish24 committed May 28, 2016
1 parent 0b2065a commit 92d5053
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions testing/vcs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ cdat_add_test(test_vcs_geometry
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_geometry.py
)
cdat_add_test(test_vcs_text_object
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_text_object.py
)
##############################################################################
#
# These tests perform plotting and need sample data
Expand Down
41 changes: 41 additions & 0 deletions testing/vcs/test_vcs_text_object.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import cdms2, vcs, tempfile

x = vcs.init(bg=1, geometry=(800, 600))
txt = x.createtext()
txt.x = [.0000005,.00000005,.5,.99999,.999999]
txt.y = [0.05,.9,.5,.9,0.05]
txt.string = ["SAMPLE TEXT A","SAMPLE TEXT B","SAMPLE TEXT C","SAMPLE TEXT D","SAMPLE TEXT E"]
txt.halign = "center"
txt.valign = "base"
txt.height = 10
x.plot(txt)

tmpfile = tempfile.NamedTemporaryFile(suffix='.ps', \
prefix='tmpTextAsObjectFalse', delete=True)
x.postscript(tmpfile.name, textAsObject=False)
tmpfile.close()

tmpfile = tempfile.NamedTemporaryFile(suffix='.ps', \
prefix='tmpTextAsObjectTrue', delete=True)
x.postscript(tmpfile.name, textAsObject=True)
tmpfile.close()

tmpfile = tempfile.NamedTemporaryFile(suffix='.pdf', \
prefix='tmpTextAsObjectFalse', delete=True)
x.pdf(tmpfile.name, textAsObject=False)
tmpfile.close()

tmpfile = tempfile.NamedTemporaryFile(suffix='.pdf', \
prefix='tmpTextAsObjectTrue', delete=True )
x.pdf(tmpfile.name, textAsObject=True)
tmpfile.close()

tmpfile = tempfile.NamedTemporaryFile(suffix='.svg', \
prefix='tmpTextAsObjectFalse', delete=True)
x.pdf(tmpfile.name, textAsObject=False)
tmpfile.close()

tmpfile = tempfile.NamedTemporaryFile(suffix='.svg', \
prefix='tmpTextAsObjectTrue', delete=True)
x.pdf(tmpfile.name, textAsObject=True)
tmpfile.close()

0 comments on commit 92d5053

Please sign in to comment.