Commit | Line | Data |
---|---|---|
88b9d363 | 1 | # Copyright 2021-2022 Free Software Foundation, Inc. |
5fb97639 AB |
2 | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | # Check scrolling in the command window. This test only covers the | |
17 | # case where scrolling in the command window is caused by issuing many | |
18 | # non-inferior related commands, as once the inferior is given control | |
19 | # the terminal settings are modified and our tuiterm library really | |
20 | # gets confused. | |
21 | ||
22 | tuiterm_env | |
23 | ||
24 | standard_testfile tui-layout.c | |
25 | ||
26 | if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { | |
27 | return -1 | |
28 | } | |
29 | ||
30 | Term::clean_restart 24 80 $testfile | |
31 | if {![Term::enter_tui]} { | |
32 | unsupported "TUI not supported" | |
33 | return | |
34 | } | |
35 | ||
36 | for {set i 0} {$i < 10} {incr i 1} { | |
37 | Term::command "p $i" | |
38 | } | |
39 | ||
40 | # Now check that the contents of the command window are as expected. | |
5fb97639 AB |
41 | Term::check_region_contents "check cmd window" 0 16 80 8 \ |
42 | [multi_line \ | |
cd074e04 AB |
43 | "\\\$7 = 6\\s+" \ |
44 | "\\(gdb\\) p 7\\s+" \ | |
45 | "\\\$8 = 7\\s+" \ | |
46 | "\\(gdb\\) p 8\\s+" \ | |
47 | "\\\$9 = 8\\s+" \ | |
48 | "\\(gdb\\) p 9\\s+" \ | |
49 | "\\\$10 = 9\\s+" \ | |
50 | "\\(gdb\\)"] | |
51 | ||
52 | # Now create a new layout where the CMD window is at the top of the | |
53 | # screen. Sitch to this layout and ensure that scrolling still works | |
54 | # as expected. | |
55 | Term::command "tui new-layout flip cmd 1 src 1" | |
56 | Term::command "layout flip" | |
57 | ||
58 | for {set i 10} {$i < 20} {incr i 1} { | |
59 | Term::command "p $i" | |
60 | } | |
61 | ||
62 | # Now check that the contents of the command window are as expected. | |
63 | Term::check_region_contents "check cmd window in flip layout" 0 0 80 8 \ | |
64 | [multi_line \ | |
65 | "\\\$17 = 16\\s+" \ | |
66 | "\\(gdb\\) p 17\\s+" \ | |
67 | "\\\$18 = 17\\s+" \ | |
68 | "\\(gdb\\) p 18\\s+" \ | |
69 | "\\\$19 = 18\\s+" \ | |
70 | "\\(gdb\\) p 19\\s+" \ | |
71 | "\\\$20 = 19\\s+" \ | |
5fb97639 | 72 | "\\(gdb\\)"] |