Home | History | Annotate | Line # | Download | only in gdb.tui
      1 # Copyright 2024 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 # Test that enabling tui while having a current frame results in
     17 # centering and highlighting the associated line.
     18 
     19 require allow_tui_tests
     20 
     21 tuiterm_env
     22 
     23 standard_testfile tui-layout.c
     24 
     25 if { [build_executable "failed to prepare" $testfile $srcfile ] == -1} {
     26     return -1
     27 }
     28 
     29 Term::clean_restart 24 80 $binfile
     30 
     31 if {![runto_main]} {
     32     perror "test suppressed"
     33     return
     34 }
     35 
     36 if {![Term::enter_tui]} {
     37     unsupported "TUI not supported"
     38     return
     39 }
     40 
     41 set line "  return 0;"
     42 set nr [gdb_get_line_number $line]
     43 
     44 set screen_line [Term::get_line_with_attrs 6]
     45 verbose -log "screen line 6: '$screen_line'"
     46 gdb_assert { [regexp "$nr <reverse:1>$line<reverse:0>" $screen_line] } \
     47     "highlighted line in middle of source window"
     48