1# Copyright 2021-2023 Free Software Foundation, Inc. 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 22tuiterm_env 23 24standard_testfile tui-layout.c 25 26if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { 27 return -1 28} 29 30Term::clean_restart 24 80 $testfile 31if {![Term::enter_tui]} { 32 unsupported "TUI not supported" 33 return 34} 35 36for {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. 41Term::check_region_contents "check cmd window" 0 16 80 8 \ 42 [multi_line \ 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. 55Term::command "tui new-layout flip cmd 1 src 1" 56Term::command "layout flip" 57 58Term::check_box "src window" 0 8 80 16 59Term::command "winheight cmd 8" 60Term::check_box "src window after resize" 0 8 80 16 61 62for {set i 10} {$i < 20} {incr i 1} { 63 set cmd "p $i" 64 send_gdb "$cmd\n" 65 Term::wait_for_region_contents 0 0 80 8 \ 66 [multi_line \ 67 "$gdb_prompt [string_to_regexp $cmd]\\s+" \ 68 "\\\$\\d+ = $i\\s+" \ 69 "$gdb_prompt "] 70} 71 72# Now check that the contents of the command window are as expected. 73Term::check_region_contents "check cmd window in flip layout" 0 0 80 8 \ 74 [multi_line \ 75 "\\\$17 = 16\\s+" \ 76 "\\(gdb\\) p 17\\s+" \ 77 "\\\$18 = 17\\s+" \ 78 "\\(gdb\\) p 18\\s+" \ 79 "\\\$19 = 18\\s+" \ 80 "\\(gdb\\) p 19\\s+" \ 81 "\\\$20 = 19\\s+" \ 82 "\\(gdb\\)"] 83