Skip to content

Commit 6ad67a3

Browse files
author
Sam Fries
committed
Added test
1 parent 995fa79 commit 6ad67a3

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

testing/vcs/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,13 +1016,19 @@ cdat_add_test(test_vcs_init_open_sizing
10161016
"${PYTHON_EXECUTABLE}"
10171017
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_init_open_sizing.py
10181018
)
1019-
# Rename baseline
1019+
## Rename baseline
10201020
cdat_add_test(test_vcs_matplotlib_colormap
10211021
"${PYTHON_EXECUTABLE}"
10221022
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_matplotlib_colormap.py
10231023
${BASELINE_DIR}/test_vcs_matplotlib_colormap.png
10241024
)
10251025

1026+
cdat_add_test(test_vcs_no_continents
1027+
"${PYTHON_EXECUTABLE}"
1028+
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_no_continents.py
1029+
${BASELINE_DIR}/test_vcs_no_continents.png
1030+
)
1031+
10261032

10271033
add_subdirectory(vtk_ui)
10281034
add_subdirectory(editors)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import cdms2
2+
import os
3+
import sys
4+
import vcs
5+
6+
# Load the clt data:
7+
dataFile = cdms2.open(os.path.join(vcs.sample_data, "clt.nc"))
8+
clt = dataFile("clt")
9+
clt = clt(latitude=(-90.0, 90.0), longitude=(-180., 175.), squeeze=1,
10+
time=('1979-1-1 0:0:0.0', '1988-12-1 0:0:0.0'))
11+
12+
# Initialize canvas:
13+
canvas = vcs.init()
14+
canvas.setantialiasing(0)
15+
canvas.setbgoutputdimensions(1200,1091,units="pixels")
16+
canvas.drawlogooff()
17+
18+
t1 = vcs.createtemplate()
19+
t1.scale(.5, "y")
20+
t1.move(-.15, "y")
21+
t2 = vcs.createtemplate(source=t1.name)
22+
t2.move(.5, 'y')
23+
24+
canvas.plot(clt, t1, continents=0, bg=True)
25+
canvas.plot(clt, t2, continents=1, bg=True)
26+
27+
# Load the image testing module:
28+
testingDir = os.path.join(os.path.dirname(__file__), "..")
29+
sys.path.append(testingDir)
30+
import checkimage
31+
32+
# Create the test image and compare:
33+
baseline = sys.argv[1]
34+
testFile = "test_vcs_no_continents.png"
35+
canvas.png(testFile)
36+
ret = checkimage.check_result_image(testFile, baseline,
37+
checkimage.defaultThreshold)
38+
sys.exit(ret)

0 commit comments

Comments
 (0)