Debian Codegraph @

vt/mode_test.go

raw symbols SCIP
1 // Copyright 2025 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
15 package vt
16
17 import "testing"
18
19 func TestPmStrings(t *testing.T) {
20 pm := PmAutoMargin
21 if s := pm.Enable(); s != "\x1b[?7h" {
22 t.Errorf("enable string wrong: %s", s)
23 }
24 if s := pm.Disable(); s != "\x1b[?7l" {
25 t.Errorf("disable string wrong: %s", s)
26 }
27 if s := pm.Query(); s != "\x1b[?7$p" {
28 t.Errorf("query string wrong: %s", s)
29 }
30 if s := pm.Reply(ModeNA); s != "\x1b[?7;0$y" {
31 t.Errorf("reply(NA) string wrong: %s", s)
32 }
33 if s := pm.Reply(ModeOn); s != "\x1b[?7;1$y" {
34 t.Errorf("reply(On) string wrong: %s", s)
35 }
36 if s := pm.Reply(ModeOff); s != "\x1b[?7;2$y" {
37 t.Errorf("reply(Off) string wrong: %s", s)
38 }
39 if s := pm.Reply(ModeOnLocked); s != "\x1b[?7;3$y" {
40 t.Errorf("reply(OnLocked) string wrong: %s", s)
41 }
42 if s := pm.Reply(ModeOffLocked); s != "\x1b[?7;4$y" {
43 t.Errorf("reply(OffLocked) string wrong: %s", s)
44 }
45 }