Skip to content

Commit 91d90e4

Browse files
committed
nvim: fix HLAttrs and WindowConfig testcase
Signed-off-by: Koichi Shiraishi <[email protected]>
1 parent 6fd9a89 commit 91d90e4

File tree

1 file changed

+66
-44
lines changed

1 file changed

+66
-44
lines changed

nvim/api_test.go

Lines changed: 66 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,16 +3160,20 @@ func testHighlight(v *Nvim) func(*testing.T) {
31603160
}
31613161

31623162
wantCTerm := &HLAttrs{
3163-
Underline: true,
3164-
Foreground: -1,
3165-
Background: 10,
3166-
Special: -1,
3163+
Underline: true,
3164+
Foreground: -1,
3165+
Background: 10,
3166+
Special: -1,
3167+
CtermForeground: -1,
3168+
CtermBackground: -1,
31673169
}
31683170
wantGUI := &HLAttrs{
3169-
Bold: true,
3170-
Foreground: cm["Red"],
3171-
Background: cm["Yellow"],
3172-
Special: cm["Blue"],
3171+
Bold: true,
3172+
Foreground: cm["Red"],
3173+
Background: cm["Yellow"],
3174+
Special: cm["Blue"],
3175+
CtermForeground: -1,
3176+
CtermBackground: -1,
31733177
}
31743178

31753179
var nsID int
@@ -3219,12 +3223,14 @@ func testHighlight(v *Nvim) func(*testing.T) {
32193223
}
32203224

32213225
wantErrorMsgEHL := &HLAttrs{
3222-
Bold: true,
3223-
Underline: true,
3224-
Italic: true,
3225-
Foreground: 16777215,
3226-
Background: 16711680,
3227-
Special: -1,
3226+
Bold: true,
3227+
Underline: true,
3228+
Italic: true,
3229+
Foreground: 16777215,
3230+
Background: 16711680,
3231+
Special: -1,
3232+
CtermForeground: -1,
3233+
CtermBackground: -1,
32283234
}
32293235
if !reflect.DeepEqual(wantErrorMsgEHL, errorMsgHL) {
32303236
t.Fatalf("SetHighlight:\nwant %#v\n got %#v", wantErrorMsgEHL, errorMsgHL)
@@ -3242,14 +3248,16 @@ func testHighlight(v *Nvim) func(*testing.T) {
32423248
t.Fatal(err)
32433249
}
32443250
want := &HLAttrs{
3245-
Bold: true,
3246-
Underline: false,
3247-
Undercurl: false,
3248-
Italic: false,
3249-
Reverse: false,
3250-
Foreground: 16776960,
3251-
Background: 16711680,
3252-
Special: -1,
3251+
Bold: true,
3252+
Underline: false,
3253+
Undercurl: false,
3254+
Italic: false,
3255+
Reverse: false,
3256+
Foreground: 16776960,
3257+
Background: 16711680,
3258+
Special: -1,
3259+
CtermForeground: -1,
3260+
CtermBackground: -1,
32533261
}
32543262
got, err := v.HLByID(nsID2, true)
32553263
if err != nil {
@@ -3290,16 +3298,20 @@ func testHighlight(v *Nvim) func(*testing.T) {
32903298
}
32913299

32923300
wantCTerm := &HLAttrs{
3293-
Underline: true,
3294-
Foreground: -1,
3295-
Background: 10,
3296-
Special: -1,
3301+
Underline: true,
3302+
Foreground: -1,
3303+
Background: 10,
3304+
Special: -1,
3305+
CtermForeground: -1,
3306+
CtermBackground: -1,
32973307
}
32983308
wantGUI := &HLAttrs{
3299-
Bold: true,
3300-
Foreground: cm[`Red`],
3301-
Background: cm[`Yellow`],
3302-
Special: cm[`Blue`],
3309+
Bold: true,
3310+
Foreground: cm[`Red`],
3311+
Background: cm[`Yellow`],
3312+
Special: cm[`Blue`],
3313+
CtermForeground: -1,
3314+
CtermBackground: -1,
33033315
}
33043316

33053317
var nsID int
@@ -3356,12 +3368,14 @@ func testHighlight(v *Nvim) func(*testing.T) {
33563368
}
33573369

33583370
wantErrorMsgEHL := &HLAttrs{
3359-
Bold: true,
3360-
Underline: true,
3361-
Italic: true,
3362-
Foreground: 16777215,
3363-
Background: 16711680,
3364-
Special: -1,
3371+
Bold: true,
3372+
Underline: true,
3373+
Italic: true,
3374+
Foreground: 16777215,
3375+
Background: 16711680,
3376+
Special: -1,
3377+
CtermForeground: -1,
3378+
CtermBackground: -1,
33653379
}
33663380
if !reflect.DeepEqual(&errorMsgHL, wantErrorMsgEHL) {
33673381
t.Fatalf("SetHighlight:\ngot %#v\nwant %#v", &errorMsgHL, wantErrorMsgEHL)
@@ -3380,14 +3394,16 @@ func testHighlight(v *Nvim) func(*testing.T) {
33803394
t.Fatal(err)
33813395
}
33823396
want := &HLAttrs{
3383-
Bold: true,
3384-
Underline: false,
3385-
Undercurl: false,
3386-
Italic: false,
3387-
Reverse: false,
3388-
Foreground: 16776960,
3389-
Background: 16711680,
3390-
Special: -1,
3397+
Bold: true,
3398+
Underline: false,
3399+
Undercurl: false,
3400+
Italic: false,
3401+
Reverse: false,
3402+
Foreground: 16776960,
3403+
Background: 16711680,
3404+
Special: -1,
3405+
CtermForeground: -1,
3406+
CtermBackground: -1,
33913407
}
33923408

33933409
var got HLAttrs
@@ -3478,6 +3494,7 @@ func testFloatingWindow(v *Nvim) func(*testing.T) {
34783494
Col: 0,
34793495
Focusable: true,
34803496
Style: "minimal",
3497+
ZIndex: 50,
34813498
}
34823499
w, err := v.OpenWindow(Buffer(0), true, cfg)
34833500
if err != nil {
@@ -3518,6 +3535,7 @@ func testFloatingWindow(v *Nvim) func(*testing.T) {
35183535
Height: 10,
35193536
Row: 1,
35203537
Focusable: false,
3538+
ZIndex: 50,
35213539
}
35223540
if err := v.SetWindowConfig(w, wantWinConfig); err != nil {
35233541
t.Fatal(err)
@@ -3595,6 +3613,7 @@ func testFloatingWindow(v *Nvim) func(*testing.T) {
35953613
Col: 0,
35963614
Focusable: true,
35973615
Style: "minimal",
3616+
ZIndex: 50,
35983617
}
35993618
var w Window
36003619
b.OpenWindow(Buffer(0), true, cfg, &w)
@@ -3634,6 +3653,7 @@ func testFloatingWindow(v *Nvim) func(*testing.T) {
36343653
Height: 10,
36353654
Row: 1,
36363655
Focusable: false,
3656+
ZIndex: 50,
36373657
}
36383658
b.SetWindowConfig(w, wantWinConfig)
36393659
if err := b.Execute(); err != nil {
@@ -4525,6 +4545,7 @@ func testTerm(v *Nvim) func(*testing.T) {
45254545
Height: 31,
45264546
Row: 1,
45274547
Col: 1,
4548+
ZIndex: 50,
45284549
}
45294550
if _, err := v.OpenWindow(buf, false, cfg); err != nil {
45304551
t.Fatal(err)
@@ -4556,6 +4577,7 @@ func testTerm(v *Nvim) func(*testing.T) {
45564577
Height: 31,
45574578
Row: 1,
45584579
Col: 1,
4580+
ZIndex: 50,
45594581
}
45604582
var win Window
45614583
b.OpenWindow(buf, false, cfg, &win)

0 commit comments

Comments
 (0)