Commit Graph

25 Commits

Author SHA1 Message Date
Christian Duerr 2234234ca9 Enable history comparison in ref-tests
Previously ref-tests just ignored the scrollback history to keep
the old tests working, this would lead to new tests which rely on
scrollback history to succeeed even though they should not.

This has been fixed and it is now possible to create ref-tests with and
without scrollback history. When available the scrollback history is
compared, but the old tests still work without having to adjust them.

This fixes #1244.
2018-06-02 09:56:50 -07:00
Joe Wilm 4ed25009c4 Remove some unused methods and impls 2018-06-02 09:24:38 -07:00
Joe Wilm bbe276e3a8 Back Grid with VecDeque
VecDeque offers improved performance beyond a plain Vec for common
scrolling situations (full screen scroll). Additionally, VecDeque is
necessary for performant scrollback since recycling old rows for a Vec
would be expensive (push/pop front would shift entire vec).
2018-06-02 09:24:38 -07:00
Joe Wilm 2bda79d94c Add ref test for 855 2017-11-11 09:23:43 -08:00
Joe Wilm faece31854 Run all ref tests
There were two ref tests that were not being run. Oops!
2017-11-11 09:23:43 -08:00
Joe Wilm c8dcbd3308 Add ref test for CSI REP 2017-09-30 16:30:04 -07:00
Joe Wilm f298e0455a Fix bug with tab rendering
Closes #494.
Resolves #529.
Resolves #512.
Resolves #493.
2017-05-01 09:56:42 -07:00
Joe Wilm 09031decc0 Support insert mode 2017-05-01 08:21:42 -07:00
Joe Wilm 7d20d29f37 Implement tab stop manipulation
Adds implementations for TBC (tabulation clear) and HTS (set horizontal
tabstop).
2017-05-01 08:21:42 -07:00
Joe Wilm 8963e97a5a Add more vttest ref tests 2017-04-19 20:24:02 -07:00
Joe Wilm 811cb266d2 Add reftest for vttest 2 scroll 2017-04-19 20:19:04 -07:00
Joe Wilm 7bc1691b0f Add ref test for tab rendering 2017-04-04 09:03:33 -07:00
Joe Wilm 79576b6c0b Add better printing for ref test failure
The previous format was extremely difficult for a human to parse.
2017-04-03 20:44:23 -07:00
Joe Wilm 53507ce7d0 Add ref test for tab background highlighting
Generated with

    echo -e "\x1b[48;5;31m1\t2\n\n3\x1b[0;m"
2017-02-27 08:05:11 -08:00
Joe Wilm 59295e4431 Add zsh tab completion ref test 2017-02-07 08:08:08 -08:00
Joe Wilm f2f750f9f3 Alacritty now compiles on stable Rust 🎉 2017-02-03 08:11:19 -08:00
Danny Dulai e04584b082 support for inverting the cursor or using colors 2017-01-29 16:06:29 -08:00
Steven Fackler 41f99dc4c0 Dynamically generate test harness
This uses the rustc-test crate, a copy of the standard test crate, to
dynamically create tests for each reference test. No need to remember to
update the macro, just add the directory to ref!
2017-01-23 08:59:54 -08:00
quininer kel 0a53d3cb86 add fish_cc ref
and update Cargo.lock
2016-12-16 18:39:51 +08:00
Joe Wilm ed48d08c03 Implement Handler::identify_terminal for Term
The identify_terminal function signature had to change to support
writing to the terminal before processing additional input.
2016-12-11 20:23:41 -08:00
Joe Wilm 23e36f1925 Add support for indexed colors
ANSI escape sequences like `\x1b[48;5;10m` were not supported until now.
Specifically, the second attribute, 5, says that the following attribute
is a color index.

The ref tests were updated since `enum Color` variants changed.
2016-12-11 20:23:41 -08:00
Joe Wilm 30bee80a69 Refactor cell selection out of renderer
The terminal now has a `renderable_cells()` function that returns a
`RenderableCellIter` iterator. This allows reuse of the cell selection
code by multiple renderers, makes it testable, and makes it
independently optimizable.

The render API now takes an `Iterator<Item=IndexedCell>` to support both
the new renderable cells iterator and the `render_string()` method which
generates its own iterator.

The `vim_large_window_scoll` ref test was added here because it provides
a nice large and busy grid to benchmark the cell selection with.
2016-12-11 20:23:41 -08:00
Joe Wilm 52a3b0aece Remove unnecessary slicing
json::from_str takes a &str which will auto deref from &String.
2016-11-20 07:45:18 -08:00
Joe Wilm 0dfba30181 Add a number of simple ref-tests
Also adds a feature `err-println` for enabling `err_println!` printing.
2016-11-19 21:34:22 -08:00
Joe Wilm 66dbd29cd1 Add support for recording/running ref tests
Ref tests use a recording of the terminal protocol and a serialization
of the grid state to check that the parsing and action handling systems
produce the correct result. Ref tests may be recorded by running
alacritty with `--ref-test` and closing the terminal by using the window
"X" button. At that point, the recording is fully written to disk, and a
serialization of important state is recorded. Those files should be
moved to an appropriate folder in the `tests/ref/` tree, and the
`ref_test!` macro invocation should be updated accordingly.

A couple of changes were necessary to make this work:

* Ref tests shouldn't create a pty; the pty was refactored out of the
  `Term` type.
* Repeatable lines/cols were needed; on startup, the terminal is resized
* by default to 80x24 though that may be changed by passing
  `--dimensions w h`.
* Calculating window size based on desired rows/columns and font metrics
  required making load_font callable multiple times.
* Refactor types into library crate so they may be imported in an
  integration test.
* A whole bunch of types needed symmetric serialization and
  deserialization. Mostly this was just adding derives, but the custom
  deserialization of Rgb had to change to a deserialize_with function.

This initially adds one ref test as a sanity check, and more will be
added in subsequent commits. This initial ref tests just starts the
terminal and runs `ll`.
2016-11-19 21:34:11 -08:00