Closed sirexeclp closed 4 years ago
Please have a look at the requirements described in https://github.com/Chaostreff-Potsdam/erika3004/issues/34#issue-545393620
I'd really like there to be some simple test + support for CharacterBasedErikaMock.
Plus: Let's wait for the big upcoming merge of https://github.com/Chaostreff-Potsdam/erika3004/pull/28
First Hardware test was successful. method expects string in reversed order
@sirexeclp I'm a bit confused, will code tests according to the way I assume the hardware will work.
Generally, I would have assumed
?
That is what I would assume from manual operation of the device.
Seeing the code, though, I think it wil work like so:
I will write tests assuming the latter, for now.
From a user's point of view, I'm unsure what they will expect - when in doubt, let's add a comment that clarifies this.
EDIT:
The only thing for me to give you green light is verifying the assumptions I coded into the tests.
EDIT: The Erika will behave like the "backspace" key when it is used in reverse print mode. It will move left first, then delete the character that was there, then remain in place.
"Manual" test script I used to verify delete_ascii works: I just took the unit test + watched that the curses output also works out.
from erika.erika_mock import CharacterBasedErikaMock
with CharacterBasedErikaMock(width=5, height=1, inside_unit_test=True, exception_if_overprinted=False) as my_erika:
my_erika.print_ascii("Hello")
my_erika.move_left()
my_erika.delete_ascii("o")
my_erika.delete_ascii("lle")
my_erika.move_right()
my_erika.print_ascii("elp")
my_erika.wait_for_user_if_simulated()
EDIT: In retrospect, I guess I could have tested (and automated the test as part of the existing one) using inch(y, x)
or `instr(y, x [,n])
EDIT: I automated this check
using correction mode and reverse printing this implements issue #34