mirror of
https://github.com/walles/moar.git
synced 2024-07-14 23:30:25 +03:00
Test case for #166
This test reproduces the symptoms of the crash in #166. Next step is to make it not crash any more.
This commit is contained in:
parent
ddd7aec274
commit
abc235fbef
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
/moar
|
||||
/moar.exe
|
||||
/releases/moar-*
|
||||
/m/__debug_bin*
|
||||
|
40
m/scrollPosition_test.go
Normal file
40
m/scrollPosition_test.go
Normal file
@ -0,0 +1,40 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/walles/moar/twin"
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func TestCanonicalize1000(t *testing.T) {
|
||||
pager := Pager{}
|
||||
pager.screen = twin.NewFakeScreen(100, 100)
|
||||
pager.reader = NewReaderFromText("test", strings.Repeat("a\n", 2000))
|
||||
pager.ShowStatusBar = true
|
||||
pager.ShowLineNumbers = true
|
||||
pager.scrollPosition = newScrollPosition("TestCanonicalize1000")
|
||||
|
||||
scrollPosition := scrollPosition{
|
||||
internalDontTouch: scrollPositionInternal{
|
||||
lineNumberOneBased: 1000,
|
||||
deltaScreenLines: 0,
|
||||
name: "Fake scroll position",
|
||||
canonicalizing: false,
|
||||
canonical: scrollPositionCanonical{
|
||||
width: 0,
|
||||
height: 0,
|
||||
showLineNumbers: false,
|
||||
showStatusBar: false,
|
||||
wrapLongLines: false,
|
||||
lineNumberOneBased: 0,
|
||||
deltaScreenLines: 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
lineNumberOneBased := scrollPosition.lineNumberOneBased(&pager)
|
||||
|
||||
assert.Equal(t, lineNumberOneBased, 1)
|
||||
}
|
Loading…
Reference in New Issue
Block a user