From 255e622e959d771b8d28634190c39a343fe1270d Mon Sep 17 00:00:00 2001 From: Eugenio Parodi Date: Thu, 29 Dec 2022 14:11:29 +0100 Subject: [PATCH] Added a new recording for the tests --- Makefile | 3 ++- TermTk/TTkTestWidgets/testwidget.py | 24 ++++++++++++++++-------- tests/pytest/test_001_demo.py | 11 ++++++++++- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index d5faff06..f43e42d9 100644 --- a/Makefile +++ b/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 ; \ diff --git a/TermTk/TTkTestWidgets/testwidget.py b/TermTk/TTkTestWidgets/testwidget.py index 1dd5f95e..4bb632fb 100644 --- a/TermTk/TTkTestWidgets/testwidget.py +++ b/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), diff --git a/tests/pytest/test_001_demo.py b/tests/pytest/test_001_demo.py index 37b99768..15b54d9d 100755 --- a/tests/pytest/test_001_demo.py +++ b/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() \ No newline at end of file