Skip to content

Commit 2e0776a

Browse files
committed
nvim: add WindowConfig and SetWindowConfig testcases
Signed-off-by: Koichi Shiraishi <[email protected]>
1 parent cd61402 commit 2e0776a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

nvim/api_test.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3485,6 +3485,25 @@ func testFloatingWindow(v *Nvim) func(*testing.T) {
34853485
t.Fatalf("got %d height but want %d", gotHeight, wantHeight)
34863486
}
34873487

3488+
wantWinConfig := &WindowConfig{
3489+
Relative: "editor",
3490+
Anchor: "NW",
3491+
Width: 40,
3492+
Height: 10,
3493+
Row: 1,
3494+
Focusable: false,
3495+
}
3496+
if err := v.SetWindowConfig(w, wantWinConfig); err != nil {
3497+
t.Fatal(err)
3498+
}
3499+
gotWinConfig, err := v.WindowConfig(w)
3500+
if err != nil {
3501+
t.Fatal(err)
3502+
}
3503+
if !reflect.DeepEqual(gotWinConfig, wantWinConfig) {
3504+
t.Fatalf("want %#v but got %#v", wantWinConfig, gotWinConfig)
3505+
}
3506+
34883507
var (
34893508
numberOpt bool
34903509
relativenumberOpt bool
@@ -3582,6 +3601,28 @@ func testFloatingWindow(v *Nvim) func(*testing.T) {
35823601
t.Fatalf("got %d height but want %d", gotHeight, wantHeight)
35833602
}
35843603

3604+
wantWinConfig := &WindowConfig{
3605+
Relative: "editor",
3606+
Anchor: "NW",
3607+
Width: 40,
3608+
Height: 10,
3609+
Row: 1,
3610+
Focusable: false,
3611+
}
3612+
b.SetWindowConfig(w, wantWinConfig)
3613+
if err := b.Execute(); err != nil {
3614+
t.Fatal(err)
3615+
}
3616+
3617+
gotWinConfig := new(WindowConfig)
3618+
b.WindowConfig(w, gotWinConfig)
3619+
if err := b.Execute(); err != nil {
3620+
t.Fatal(err)
3621+
}
3622+
if !reflect.DeepEqual(gotWinConfig, wantWinConfig) {
3623+
t.Fatalf("want %#v but got %#v", wantWinConfig, gotWinConfig)
3624+
}
3625+
35853626
var (
35863627
numberOpt bool
35873628
relativenumberOpt bool

0 commit comments

Comments
 (0)