Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering test using virtual screen #656

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tompng
Copy link
Member

@tompng tompng commented Mar 20, 2024

This pull request is a PoC of rendering test with virtual screen.

assert_readmultiline(expected: '1.itself', prompt: '>', termination_proc: ->*{true}) do |io|
  io.write '1.ab'
  assert_equal ['>1.ab', ' 1.abs', ' 1.abs2'], io.current_screen
  io.write "\e"
  io.wait 0.49999999999
  assert_equal ['>1.ab', ' 1.abs', ' 1.abs2'], io.current_screen
  io.wait 0.00000000002
  assert_equal ['>1.ab'], io.current_screen
  io.write "\C-h\C-h\C-h.itself"
  io.close
end

Since we introduced differential rendering in #614, LineEditor now have a cache of what LineEditor rendered to the screen. In other words, LineEditor now have a virtual screen internally. We can use it for testing.

We still need yamatanooroti, but we can reduce using it to make CI faster.

Key actor test: use this virtual screen test
Test of render_differential correctly rendered to terminal: use yamatanooroti
Test some edge cases, Test rendering through multiple readmultiline: use yamatanooroti

TODO: specify terminal window size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant