| # Copyright 2021 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" |
| |
| 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\\)"] |