#! /usr/bin/python3
# Test program for module {contour_example}
# Last edited on 2021-10-19 12:18:02 by stolfi

import path
import path_hp
import path_example
import contour_example
import move 
import move_parms
import contact 
import block
import hacks
import palette
import job_parms
import rn
import pyx
import sys
from math import sqrt, sin, cos, floor, ceil, inf, nan, pi

parms = job_parms.typical_js()
parms['solid_raster_width'] = 1.0
parms['contour_trace_width'] = 0.5

mp_jump = move_parms.make_for_jumps(parms)
mp_cont = move_parms.make_for_contours(parms)
mp_fill = move_parms.make_for_fillings(parms)

wd_fill = move_parms.width(mp_fill)

def test_contours_A():
  sys.stderr.write("--- testing {contours_A} ---\n")
  
  tag = "contours_A"
  
  CRS, PTSS = contour_example.contours_A(mp_cont)
 
  ncr = len(CRS)
  
  CLRS = hacks.trace_colors(len(CRS), None)
  rwd = 0.80
  wd_axes = 0.05*wd_fill;  # Axes of traces.
  grid = True
  deco = True

  fname = "tests/out/contour_example_TST_" + tag
  path.plot_to_files(fname, CRS, CLRS, rwd, wd_axes, grid, deco)
  
  return
  # ----------------------------------------------------------------------

def test_contours_B():
  sys.stderr.write("--- testing {contours_B} ---\n")
  
  tag = "contours_B"
  
  CRS = contour_example.contours_B(mp_cont)

  CLRS = hacks.trace_colors(len(CRS), None)
  rwd = 0.80
  wd_axes = 0.05*wd_fill;  # Axes of traces.
  grid = True
  deco = True

  fname = "tests/out/contour_example_TST_" + tag
  path.plot_to_files(fname, CRS, CLRS, rwd, wd_axes, grid, deco)
  
  return
  # ----------------------------------------------------------------------
 
test_contours_B()
test_contours_A()
