mirror of https://github.com/liamg/aminal.git
Resolves sixel rendering regression issue and adds gui unit test to validate rendered image (#221)
* Reset line feed mode on sixel handling * Sixel test
This commit is contained in:
parent
a5e51dbbdd
commit
82ab02da9b
32
main_test.go
32
main_test.go
|
@ -24,8 +24,12 @@ func terminate(msg string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
func sleep() {
|
||||
time.Sleep(time.Second)
|
||||
func sleep(seconds ...int) {
|
||||
count := 1
|
||||
if len(seconds) > 0 {
|
||||
count = seconds[0]
|
||||
}
|
||||
time.Sleep(time.Duration(count) * time.Second)
|
||||
}
|
||||
|
||||
func hash(path string) string {
|
||||
|
@ -162,6 +166,30 @@ func TestScreenFeatures(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestSixel(t *testing.T) {
|
||||
runMain(func() {
|
||||
|
||||
testFunc := func(term *terminal.Terminal, g *gui.GUI) {
|
||||
termRef = term; guiRef = g
|
||||
|
||||
sleep()
|
||||
send(term, "export PS1='> '\n")
|
||||
sleep()
|
||||
send(term, "clear\n")
|
||||
sleep()
|
||||
send(term, "cat example.sixel\n")
|
||||
sleep(4)
|
||||
|
||||
guiRef.Screenshot("test-sixel.png")
|
||||
validateScreen("test-sixel.png")
|
||||
|
||||
g.Close()
|
||||
}
|
||||
|
||||
initialize(testFunc)
|
||||
})
|
||||
}
|
||||
|
||||
// Last Test should terminate main goroutine since it's infinity looped to execute others GUI tests in main goroutine
|
||||
func TestExit(t *testing.T) {
|
||||
os.Exit(0)
|
||||
|
|
|
@ -125,6 +125,12 @@ func sixelHandler(pty chan rune, terminal *Terminal) error {
|
|||
return fmt.Errorf("Failed to parse sixel data: %s", err)
|
||||
}
|
||||
|
||||
isNewLineMode := terminal.terminalState.IsNewLineMode()
|
||||
if isNewLineMode == false {
|
||||
terminal.SetNewLineMode()
|
||||
defer terminal.SetLineFeedMode()
|
||||
}
|
||||
|
||||
drawSixel(six, terminal)
|
||||
|
||||
return nil
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
Loading…
Reference in New Issue