Debian Codegraph @

vt/tests/cursor_test.go

raw symbols SCIP
1 // Copyright 2026 The TCell Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 package tests
15
16 import (
17 "testing"
18
19 "github.com/gdamore/tcell/v3/vt"
20 )
21
22 func TestCursorStyle(t *testing.T) {
23 VerifyF(t, vt.SteadyBlock.IsVisible(), "steady block should be visible")
24 VerifyF(t, vt.SteadyBlock.Show() == vt.SteadyBlock, "steady block show should be non-op")
25 VerifyF(t, !vt.SteadyBlock.Hide().IsVisible(), "steady block hide should be hidden")
26 VerifyF(t, vt.SteadyBlock.Hide().Show() == vt.SteadyBlock, "steady block hide and show should be inverse")
27 VerifyF(t, !vt.SteadyBlock.IsBlinking(), "steady block should be steady")
28 VerifyF(t, vt.SteadyBlock.Blink().IsBlinking(), "steady block blink should work")
29 VerifyF(t, vt.SteadyBlock.Blink() == vt.BlinkingBlock, "steady block blink should be blinking block")
30 VerifyF(t, vt.SteadyBlock.Steady() == vt.SteadyBlock, "steady block should be steady")
31 VerifyF(t, vt.SteadyBlock.Blink().Steady() == vt.SteadyBlock, "steady block blink and steady should be inverse")
32
33 VerifyF(t, vt.SteadyBar.IsVisible(), "steady bar should be visible")
34 VerifyF(t, vt.SteadyBar.Show() == vt.SteadyBar, "steady bar show should be non-op")
35 VerifyF(t, !vt.SteadyBar.Hide().IsVisible(), "steady bar hide should be hidden")
36 VerifyF(t, vt.SteadyBar.Hide().Show() == vt.SteadyBar, "steady bar hide and show should be inverse")
37 VerifyF(t, !vt.SteadyBar.IsBlinking(), "steady bar should be steady")
38 VerifyF(t, vt.SteadyBar.Blink().IsBlinking(), "steady bar blink should work")
39 VerifyF(t, vt.SteadyBar.Blink() == vt.BlinkingBar, "steady bar blink should be blinking bar")
40 VerifyF(t, vt.SteadyBar.Steady() == vt.SteadyBar, "steady bar should be steady")
41 VerifyF(t, vt.SteadyBar.Blink().Steady() == vt.SteadyBar, "steady bar blink and steady should be inverse")
42
43 VerifyF(t, vt.SteadyUnderline.IsVisible(), "steady underline should be visible")
44 VerifyF(t, vt.SteadyUnderline.Show() == vt.SteadyUnderline, "steady underline show should be non-op")
45 VerifyF(t, !vt.SteadyUnderline.Hide().IsVisible(), "steady underline hide should be hidden")
46 VerifyF(t, vt.SteadyUnderline.Hide().Show() == vt.SteadyUnderline, "steady underline hide and show should be inverse")
47 VerifyF(t, !vt.SteadyUnderline.IsBlinking(), "steady underline should be steady")
48 VerifyF(t, vt.SteadyUnderline.Blink().IsBlinking(), "steady underline blink should work")
49 VerifyF(t, vt.SteadyUnderline.Blink() == vt.BlinkingUnderline, "steady underline blink should be blinking underline")
50 VerifyF(t, vt.SteadyUnderline.Steady() == vt.SteadyUnderline, "steady underline should be steady")
51 VerifyF(t, vt.SteadyUnderline.Blink().Steady() == vt.SteadyUnderline, "steady underline blink and steady should be inverse")
52
53 VerifyF(t, vt.BlinkingBlock.IsVisible(), "blinking block should be visible")
54 VerifyF(t, vt.BlinkingBlock.Show() == vt.BlinkingBlock, "blinking block show should be non-op")
55 VerifyF(t, !vt.BlinkingBlock.Hide().IsVisible(), "blinking block hide should be hidden")
56 VerifyF(t, vt.BlinkingBlock.Hide().Show() == vt.BlinkingBlock, "blinking block hide and show should be inverse")
57 VerifyF(t, vt.BlinkingBlock.IsBlinking(), "blinking block should be blinking")
58 VerifyF(t, vt.BlinkingBlock.Blink().IsBlinking(), "blinking block blink should work")
59 VerifyF(t, vt.BlinkingBlock.Steady() == vt.SteadyBlock, "blinking block steady should be steady block")
60 VerifyF(t, vt.BlinkingBlock.Blink() == vt.BlinkingBlock, "blinking block should be blinking block")
61 VerifyF(t, vt.BlinkingBlock.Steady().Blink() == vt.BlinkingBlock, "blinking block steady and blink should be inverse")
62
63 VerifyF(t, vt.BlinkingBar.IsVisible(), "blinking bar should be visible")
64 VerifyF(t, vt.BlinkingBar.Show() == vt.BlinkingBar, "blinking bar show should be non-op")
65 VerifyF(t, !vt.BlinkingBar.Hide().IsVisible(), "blinking bar hide should be hidden")
66 VerifyF(t, vt.BlinkingBar.Hide().Show() == vt.BlinkingBar, "blinking bar hide and show should be inverse")
67 VerifyF(t, vt.BlinkingBar.IsBlinking(), "blinking bar should be blinking")
68 VerifyF(t, vt.BlinkingBar.Blink().IsBlinking(), "blinking bar blink should work")
69 VerifyF(t, vt.BlinkingBar.Steady() == vt.SteadyBar, "blinking bar steady should be steady bar")
70 VerifyF(t, vt.BlinkingBar.Blink() == vt.BlinkingBar, "blinking bar should be blinking bar")
71 VerifyF(t, vt.BlinkingBar.Steady().Blink() == vt.BlinkingBar, "blinking bar steady and blink should be inverse")
72
73 VerifyF(t, vt.BlinkingUnderline.IsVisible(), "blinking underline should be visible")
74 VerifyF(t, vt.BlinkingUnderline.Show() == vt.BlinkingUnderline, "blinking underline show should be non-op")
75 VerifyF(t, !vt.BlinkingUnderline.Hide().IsVisible(), "blinking underline hide should be hidden")
76 VerifyF(t, vt.BlinkingUnderline.Hide().Show() == vt.BlinkingUnderline, "blinking underline hide and show should be inverse")
77 VerifyF(t, vt.BlinkingUnderline.IsBlinking(), "blinking underline should be blinking")
78 VerifyF(t, vt.BlinkingUnderline.Blink().IsBlinking(), "blinking underline blink should work")
79 VerifyF(t, vt.BlinkingUnderline.Steady() == vt.SteadyUnderline, "blinking underline steady should be steady underline")
80 VerifyF(t, vt.BlinkingUnderline.Blink() == vt.BlinkingUnderline, "blinking underline should be blinking underline")
81 VerifyF(t, vt.BlinkingUnderline.Steady().Blink() == vt.BlinkingUnderline, "blinking underline steady and blink should be inverse")
82 }