Browse Source

Added a new recording for the tests

pull/97/head
Eugenio Parodi 3 years ago
parent
commit
255e622e95
  1. 3
      Makefile
  2. 24
      TermTk/TTkTestWidgets/testwidget.py
  3. 11
      tests/pytest/test_001_demo.py

3
Makefile

@ -91,7 +91,8 @@ test: .venv
# Play the test stream
# tests/pytest/test_001_demo.py -p test.input.bin
mkdir -p tmp
wget -O tmp/test.input.bin https://github.com/ceccopierangiolieugenio/binaryRepo/raw/master/pyTermTk/tests/test.input.001.bin
wget -O tmp/test.input.001.bin https://github.com/ceccopierangiolieugenio/binaryRepo/raw/master/pyTermTk/tests/test.input.001.bin
wget -O tmp/test.input.002.bin https://github.com/ceccopierangiolieugenio/binaryRepo/raw/master/pyTermTk/tests/test.input.002.bin
tools/check.import.sh
. .venv/bin/activate ; \
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .venv,build,tmp ; \

24
TermTk/TTkTestWidgets/testwidget.py

@ -31,16 +31,24 @@ from TermTk.TTkWidgets.label import *
from TermTk.TTkWidgets.frame import *
class _TestContent(TTkWidget):
t01 = TTkString(color=TTkColor.fg("#ff0000") ,text=" L😎rem ipsum dolor sit amet, ⌚ ❤ 💙 🙋'")
t02 = TTkString(color=TTkColor.fg("#ff8800") ,text="consectetur adipiscing elit,")
t03 = TTkString(color=TTkColor.fg("#ffff00") ,text="sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
t04 = TTkString(color=TTkColor.fg("#00ff00") ,text="Ut enim ad minim veniam,")
t05 = TTkString(color=TTkColor.fg("#00ffff") ,text="quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.")
t06 = TTkString(color=TTkColor.fg("#0088ff") ,text="Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.")
t07 = TTkString(color=TTkColor.fg("#0000ff") ,text="Excepteur sint occaecat cupidatat non proident,")
t08 = TTkString(color=TTkColor.fg("#ff00ff") ,text="sunt in culpa qui officia deserunt mollit anim id est laborum.")
def paintEvent(self):
# TTkLog.debug(f"Test Paint - {self._name}")
y=0; self._canvas.drawText(pos=(-5,y),text=TTkString(color=TTkColor.fg("#ff0000") ,text=" L😎rem ipsum dolor sit amet, ⌚ ❤ 💙 🙋'"))
y+=1; self._canvas.drawText(pos=(0,y), text=TTkString(color=TTkColor.fg("#ff8800") ,text="consectetur adipiscing elit,"))
y+=1; self._canvas.drawText(pos=(0,y), text=TTkString(color=TTkColor.fg("#ffff00") ,text="sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."))
y+=1; self._canvas.drawText(pos=(0,y), text=TTkString(color=TTkColor.fg("#00ff00") ,text="Ut enim ad minim veniam,"))
y+=1; self._canvas.drawText(pos=(0,y), text=TTkString(color=TTkColor.fg("#00ffff") ,text="quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."))
y+=1; self._canvas.drawText(pos=(0,y), text=TTkString(color=TTkColor.fg("#0088ff") ,text="Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."))
y+=1; self._canvas.drawText(pos=(0,y), text=TTkString(color=TTkColor.fg("#0000ff") ,text="Excepteur sint occaecat cupidatat non proident,"))
y+=1; self._canvas.drawText(pos=(0,y), text=TTkString(color=TTkColor.fg("#ff00ff") ,text="sunt in culpa qui officia deserunt mollit anim id est laborum."))
y=0; self._canvas.drawText(pos=(-5,y), text=self.t01)
y+=1; self._canvas.drawText(pos=( 0,y), text=self.t02)
y+=1; self._canvas.drawText(pos=( 0,y), text=self.t03)
y+=1; self._canvas.drawText(pos=( 0,y), text=self.t04)
y+=1; self._canvas.drawText(pos=( 0,y), text=self.t05)
y+=1; self._canvas.drawText(pos=( 0,y), text=self.t06)
y+=1; self._canvas.drawText(pos=( 0,y), text=self.t07)
y+=1; self._canvas.drawText(pos=( 0,y), text=self.t08)
y+=1; self._canvas.drawGrid(
pos=(0,y),size=(self._width,self._height-y),
hlines=(2,5,7), vlines=(4,7,15,30),

11
tests/pytest/test_001_demo.py

@ -166,7 +166,16 @@ def test_recording1():
# demo.ttk.TTkLog.use_default_file_logging()
demo.ttk.TTkLog.installMessageHandler(message_handler)
root = TTkRecord(title="pyTermTk Demo Record", record=False)
root.loadQueue(open('tmp/test.input.bin', 'rb'))
root.loadQueue(open('tmp/test.input.001.bin', 'rb'))
winTabbed1 = demo.ttk.TTkWindow(parent=root,pos=(0,0), size=(80,24), title="pyTermTk Showcase", border=True, layout=demo.ttk.TTkGridLayout())
demo.demoShowcase(winTabbed1, True)
root.mainloop()
def test_recording2():
# demo.ttk.TTkLog.use_default_file_logging()
demo.ttk.TTkLog.installMessageHandler(message_handler)
root = TTkRecord(title="pyTermTk Demo Record", record=False)
root.loadQueue(open('tmp/test.input.002.bin', 'rb'))
winTabbed1 = demo.ttk.TTkWindow(parent=root,pos=(0,0), size=(80,24), title="pyTermTk Showcase", border=True, layout=demo.ttk.TTkGridLayout())
demo.demoShowcase(winTabbed1, True)
root.mainloop()
Loading…
Cancel
Save