import os, sys, cdms2, vcs, vcs.testing.regression as regression

dataset = cdms2.open(os.path.join(vcs.sample_data,"clt.nc"))
data = dataset("clt")
canvas = regression.init()
isoline = canvas.createisoline()
isoline.label="y"
texts=[]
colors = []
for i in range(10):
    text = canvas.createtext()
    text.color = 50 + 12 * i
    text.height = 12
    colors.append(100 + 12 * i)
    if i%2 == 0:
      texts.append(text.name)
    else:
      texts.append(text)
isoline.text = texts

# First test using isoline.text[...].color
canvas.plot(data, isoline, bg=1)

baseline = os.path.splitext(sys.argv[1])
baselineImage = "%s%s"%baseline
ret = regression.run_wo_terminate(canvas, "test_vcs_isoline_labels.png", baselineImage)

# Now set isoline.linecolors and test again.
canvas.clear()
isoline.linecolors = colors
canvas.plot(data, isoline, bg=1)
baselineImage = "%s%d%s"%(baseline[0], 2, baseline[1])
testImage = os.path.abspath("test_vcs_isoline_labels2.png")
ret += regression.run_wo_terminate(canvas, testImage, baselineImage)

# Now set isoline.textcolors and test again.
canvas.clear()
isoline.textcolors = colors
canvas.plot(data, isoline, bg=1)

baselineImage = "%s%d%s"%(baseline[0], 3, baseline[1])
testImage = os.path.abspath("test_vcs_isoline_labels3.png")
ret += regression.run_wo_terminate(canvas, testImage, baselineImage)

sys.exit(ret)

[((158, 175), 'vcs.testing.regression.init', 'regression.init', ([], {}), '()\n', (173, 175), True, 'import os, sys, cdms2, vcs, vcs.testing.regression as regression\n'), ((573, 602), 'os.path.splitext', 'os.path.splitext', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (589, 602), False, 'import os, sys, cdms2, vcs, vcs.testing.regression as regression\n'), ((641, 726), 'vcs.testing.regression.run_wo_terminate', 'regression.run_wo_terminate', (['canvas', '"""test_vcs_isoline_labels.png"""', 'baselineImage'], {}), "(canvas, 'test_vcs_isoline_labels.png',\n    baselineImage)\n", (668, 726), True, 'import os, sys, cdms2, vcs, vcs.testing.regression as regression\n'), ((912, 959), 'os.path.abspath', 'os.path.abspath', (['"""test_vcs_isoline_labels2.png"""'], {}), "('test_vcs_isoline_labels2.png')\n", (927, 959), False, 'import os, sys, cdms2, vcs, vcs.testing.regression as regression\n'), ((967, 1028), 'vcs.testing.regression.run_wo_terminate', 'regression.run_wo_terminate', (['canvas', 'testImage', 'baselineImage'], {}), '(canvas, testImage, baselineImage)\n', (994, 1028), True, 'import os, sys, cdms2, vcs, vcs.testing.regression as regression\n'), ((1219, 1266), 'os.path.abspath', 'os.path.abspath', (['"""test_vcs_isoline_labels3.png"""'], {}), "('test_vcs_isoline_labels3.png')\n", (1234, 1266), False, 'import os, sys, cdms2, vcs, vcs.testing.regression as regression\n'), ((1274, 1335), 'vcs.testing.regression.run_wo_terminate', 'regression.run_wo_terminate', (['canvas', 'testImage', 'baselineImage'], {}), '(canvas, testImage, baselineImage)\n', (1301, 1335), True, 'import os, sys, cdms2, vcs, vcs.testing.regression as regression\n'), ((1337, 1350), 'sys.exit', 'sys.exit', (['ret'], {}), '(ret)\n', (1345, 1350), False, 'import os, sys, cdms2, vcs, vcs.testing.regression as regression\n'), ((87, 126), 'os.path.join', 'os.path.join', (['vcs.sample_data', '"""clt.nc"""'], {}), "(vcs.sample_data, 'clt.nc')\n", (99, 126), False, 'import os, sys, cdms2, vcs, vcs.testing.regression as regression\n')]