summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.tui/scroll.exp
blob: c23cd2b9abf9a3036d53a50984d3b2fbf0eb29ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright 2021-2022 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Check scrolling in the command window.  This test only covers the
# case where scrolling in the command window is caused by issuing many
# non-inferior related commands, as once the inferior is given control
# the terminal settings are modified and our tuiterm library really
# gets confused.

tuiterm_env

standard_testfile tui-layout.c

if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
    return -1
}

Term::clean_restart 24 80 $testfile
if {![Term::enter_tui]} {
    unsupported "TUI not supported"
    return
}

for {set i 0} {$i < 10} {incr i 1} {
    Term::command "p $i"
}

# Now check that the contents of the command window are as expected.
Term::check_region_contents "check cmd window" 0 16 80 8 \
    [multi_line \
	 "\\\$7 = 6\\s+" \
	 "\\(gdb\\) p 7\\s+" \
	 "\\\$8 = 7\\s+" \
	 "\\(gdb\\) p 8\\s+" \
	 "\\\$9 = 8\\s+" \
	 "\\(gdb\\) p 9\\s+" \
	 "\\\$10 = 9\\s+" \
	 "\\(gdb\\)"]

# Now create a new layout where the CMD window is at the top of the
# screen.  Sitch to this layout and ensure that scrolling still works
# as expected.
Term::command "tui new-layout flip cmd 1 src 1"
Term::command "layout flip"

Term::check_box "src window" 0 8 80 16
Term::command "winheight cmd 8"
Term::check_box "src window after resize" 0 8 80 16

for {set i 10} {$i < 20} {incr i 1} {
    Term::command "p $i"
}

# Now check that the contents of the command window are as expected.
Term::check_region_contents "check cmd window in flip layout" 0 0 80 8 \
    [multi_line \
	 "\\\$17 = 16\\s+" \
	 "\\(gdb\\) p 17\\s+" \
	 "\\\$18 = 17\\s+" \
	 "\\(gdb\\) p 18\\s+" \
	 "\\\$19 = 18\\s+" \
	 "\\(gdb\\) p 19\\s+" \
	 "\\\$20 = 19\\s+" \
	 "\\(gdb\\)"]