Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to export text as object or path #1992

Merged
merged 9 commits into from
Jun 8, 2016
Prev Previous commit
Next Next commit
Added new test for text as object feature
aashish24 committed May 28, 2016

Verified

This commit was signed with the committer’s verified signature.
mdonnalley Mike Donnalley
commit 92d5053c014b8ef0f5ecf5ca136d1f8e5c039ce7
4 changes: 4 additions & 0 deletions testing/vcs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
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()