1 # Copyright
2023-2024 Free Software Foundation
, Inc.
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.
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.
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
/>.
16 # Check that
"set tui compact-source on" has the intended effect.
18 require allow_tui_tests
24 # Let
's generate the source file. We want a short file, with less than 10
25 # lines, and the copyright notice by itself is already more that that.
33 set re_line_four [string_to_regexp [lindex $src_list 3]]
34 set src_txt [join $src_list "\n"]
35 set srcfile [standard_output_file $srcfile]
36 set fd [open $srcfile w]
40 if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
44 Term::clean_restart 24 80 $binfile
46 gdb_test_no_output "maint set tui-left-margin-verbose on"
47 gdb_test_no_output "set tui compact-source on"
49 if {![Term::enter_tui]} {
50 unsupported "TUI not supported"
56 set max_line_nr_in_source_file [llength $src_list]
57 # Ensure there are more lines in the window than in the source file.
58 set src_window_lines [expr $max_line_nr_in_source_file + 2]
59 # Account for border size.
60 set src_window_size [expr $src_window_lines + 2]
61 Term::command "wh src $src_window_size"
63 set re_left_margin "___4_"
65 Term::check_contents "compact source format" \
66 "$re_border$re_left_margin$re_line_four *$re_border"
68 set re_left_margin "___0*[expr $max_line_nr_in_source_file + 1]_"
69 Term::check_contents_not "no surplus line number" \
70 "$re_border$re_left_margin *$re_border"