# Test program for Contractor to print texts.

# author R.N.Bosworth

# version 16 Mar 23  15:06

from emily0_9 import rendering, text_printing, texting
from guibits1_0 import coloring, font_styling, printing
from guibits1_0 import unicoding3_0, windowing, writing

""" 
Copyright (C) 2019,2021,2022,2023  R.N.Bosworth

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License (gpl.txt) for more details.
"""

# test program
# ------------
   
print("Tests of text_printing._de_escape", end=' ')
s1 = unicoding3_0.new_string()
s2 = unicoding3_0.new_string()
text_printing._de_escape(s1,s2)
assert unicoding3_0.equals(s1,unicoding3_0.new_string())
s1 = unicoding3_0.string_of("ab")
s2 = unicoding3_0.string_of("1&lt;2")
text_printing._de_escape(s1,s2)
assert unicoding3_0.equals(s1,unicoding3_0.string_of("ab1<2"))
print("OK")
  
# tests requiring a window
# ------------------------
  
def window_closing(win):
  print("start of window_closing")
  print("Tests of text_printing._try_line", end=' ')
  fss = font_styling.new_font_styles()
  pg = rendering.new_page(win,216.0,168.0,72.0,72.0,"Courier New",fss,12.0,coloring.BLACK)
  #text_printing._try_line(pg)
  pj = printing.set_page_dimensions(216.0,168.0,72.0)
  pg._current_line = unicoding3_0.string_of("Test of text_printing._try_line")
  text_printing._try_line(pj,pg)
  pg._page_position.y_offset += pg._font_size
  pg._current_line = unicoding3_0.string_of("Test of text_printing._try_line just on page")
  text_printing._try_line(pj,pg)
  pg._page_position.y_offset += pg._font_size
  pg._current_line = unicoding3_0.string_of("Test of text_printing._try_line line off page")
  text_printing._try_line(pj,pg)
  printing.end_printing(pj)
  print("OK")
  
  print("Tests of text_printing._print_line", end=' ')
  fss = font_styling.new_font_styles()
  pg = rendering.new_page(win,216.0,180.0,72.0,72.0,"Courier New",fss,12.0,coloring.BLACK)
  pj = printing.set_page_dimensions(216.0,180.0,72.0)
  pg._current_line = unicoding3_0.string_of("fred1")
  pg._line_width = writing.width_in_points_of(win,unicoding3_0.python_string_of(pg._current_line),"Courier New",fss,12.0)
  pg._current_alignment = texting.Alignment.BEGIN
  text_printing._print_line(pj,pg)
  pg._current_line = unicoding3_0.string_of("fred2")
  pg._line_width = writing.width_in_points_of(win,unicoding3_0.python_string_of(pg._current_line),"Courier New",fss,12.0)
  pg._current_alignment = texting.Alignment.END
  text_printing._print_line(pj,pg)
  pg._current_line = unicoding3_0.string_of("fred3")
  pg._line_width = writing.width_in_points_of(win,unicoding3_0.python_string_of(pg._current_line),"Courier New",fss,12.0)
  pg._current_alignment = texting.Alignment.MIDDLE
  text_printing._print_line(pj,pg)
  printing.end_printing(pj)
  print("OK")
  
  print("Tests of text_printing._print_token", end=' ')
  fss = font_styling.new_font_styles()
  pg = rendering.new_page(win,216.0,288.0,36.0,36.0,"Courier New",fss,12.0,coloring.BLACK)
  
  # initialize printing
  pj = printing.set_page_dimensions(216.0,288.0,36.0)
  # start of print
  pg._current_alignment = texting.Alignment.BEGIN
  pg._page_position.x_offset = 0.0
  pg._page_position.y_offset = 0.0
  pg._current_line = unicoding3_0.new_string()
  pg._line_width = 0.0
  text_printing._print_token(pj,unicoding3_0.string_of("The"),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("cat"),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.BEGIN
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.BEGIN
  text_printing._print_token(pj,unicoding3_0.string_of("sat"),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.BEGIN
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.BEGIN
  text_printing._print_token(pj,unicoding3_0.string_of("on"),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.BEGIN
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.BEGIN
  text_printing._print_token(pj,unicoding3_0.string_of("the"),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.BEGIN
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.BEGIN
  text_printing._print_token(pj,unicoding3_0.string_of("mat."),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.BEGIN
  text_printing._print_token(pj,unicoding3_0.string_of("\n"),texting.Alignment.MIDDLE,pg)
  assert pg._current_alignment == texting.Alignment.MIDDLE
  text_printing._print_token(pj,unicoding3_0.string_of("\n"),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.END
  printing.end_printing(pj)
  
  # start of print
  pj = printing.set_page_dimensions(216.0,288.0,36.0)
  pg._current_alignment = texting.Alignment.BEGIN
  pg._page_position.x_offset = 0.0
  pg._page_position.y_offset = 0.0
  pg._current_line = unicoding3_0.new_string()
  pg._line_width = 0.0
  text_printing._print_token(pj,unicoding3_0.string_of("The"),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("cat"),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("sat"),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("on"),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("the"),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.END,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("mat."),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.BEGIN
  text_printing._print_token(pj,unicoding3_0.string_of("\n"),texting.Alignment.MIDDLE,pg)
  assert pg._current_alignment == texting.Alignment.MIDDLE
  text_printing._print_token(pj,unicoding3_0.string_of("\n"),texting.Alignment.END,pg)
  assert pg._current_alignment == texting.Alignment.END
  printing.end_printing(pj)
  
  # start of print
  pj = printing.set_page_dimensions(216.0,288.0,36.0)
  pg._current_alignment = texting.Alignment.BEGIN
  pg._page_position.x_offset = 0.0
  pg._page_position.y_offset = 0.0
  pg._current_line = unicoding3_0.new_string()
  pg._line_width = 0.0
  text_printing._print_token(pj,unicoding3_0.string_of("The"),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("cat"),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("sat"),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("on"),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("the"),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of(" "),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("\n"),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("\n"),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("mat."),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("<end>"),texting.Alignment.BEGIN,pg)
  assert pg._current_alignment == texting.Alignment.BEGIN
  printing.end_printing(pj)
  
  # start of print
  pj = printing.set_page_dimensions(216.0,288.0,36.0)
  pg._current_alignment = texting.Alignment.BEGIN
  pg._page_position.x_offset = 0.0
  pg._page_position.y_offset = 0.0
  pg._current_line = unicoding3_0.new_string()
  pg._line_width = 0.0
  text_printing._print_token(pj,unicoding3_0.string_of("the"),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("<end>"),texting.Alignment.BEGIN,pg)
  # release printer
  printing.end_printing(pj)
  """
  # start of print  (bad token)
  pj = printing.set_page_dimensions(216.0,288.0,36.0)
  pg._current_alignment = texting.Alignment.BEGIN
  pg._page_position.x_offset = 0.0
  pg._page_position.y_offset = 0.0
  pg._current_line = unicoding3_0.new_string()
  pg._line_width = 0.0
  text_printing._print_token(pj,unicoding3_0.string_of("the"),texting.Alignment.BEGIN,pg)
  text_printing._print_token(pj,unicoding3_0.string_of("<exit>"),texting.Alignment.BEGIN,pg)
  # release printer
  printing.end_printing(pj)
  """
  print("OK")
  
  print("Tests of text_printing.print_text",end=' ')
  fss = font_styling.new_font_styles()
  t = texting.new_text()
  text_printing.print_text(win,t,"Courier New",12.0,fss)
  t = texting.new_text()
  texting.set_alignment(t,texting.Alignment.END)
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('1'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('2'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('3'))
  texting.insert_code_point(t,ord('.'))
  text_printing.print_text(win,t,"Courier New",12.0,fss)

  t = texting.new_text()
  texting.set_alignment(t,texting.Alignment.MIDDLE)
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('1'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('2'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('3'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('4'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('5'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('6'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('7'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('8'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('9'))
  texting.insert_code_point(t,ord('.'))
  text_printing.print_text(win,t,"Courier New",12.0,fss)
  
  t = texting.new_text()
  texting.set_alignment(t,texting.Alignment.BEGIN)
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('1'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('2'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('3'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('4'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('5'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('6'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('7'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('8'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('9'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('1'))
  texting.insert_code_point(t,ord('0'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('1'))
  texting.insert_code_point(t,ord('1'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('1'))
  texting.insert_code_point(t,ord('2'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('1'))
  texting.insert_code_point(t,ord('3'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('1'))
  texting.insert_code_point(t,ord('4'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('1'))
  texting.insert_code_point(t,ord('5'))
  texting.insert_code_point(t,ord(' '))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('h'))
  texting.insert_code_point(t,ord('u'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('a'))
  texting.insert_code_point(t,ord('r'))
  texting.insert_code_point(t,ord('b'))
  texting.insert_code_point(t,ord('1'))
  texting.insert_code_point(t,ord('6'))
  texting.insert_code_point(t,ord('.'))
  text_printing.print_text(win,t,"Courier New",12.0,fss)
  print("OK")
  print("")
  print("All tests OK")
  return True

print("about to open new window")
win = windowing.new_window(12.0,"Window for test of text_printing",800.0,500.0,1.0)
windowing.show(win,None,window_closing)
  
