1 # Copyright 2020 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 # Test "tui new-layout".
20 standard_testfile tui-layout.c
22 if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
26 # Make sure TUI is supported before continuing.
27 with_test_prefix "initial check" {
28 Term::clean_restart 24 80 $testfile
29 if {![Term::enter_tui]} {
30 unsupported "TUI not supported"
35 Term::clean_restart 24 80 $testfile
37 gdb_test "tui new-layout" \
38 "No layout name specified"
39 gdb_test "tui new-layout example" \
40 "New layout does not contain any windows"
41 gdb_test "tui new-layout example zzq" \
42 "Unknown window \"zzq\""
43 gdb_test "tui new-layout example src 1 src 1" \
44 "Window \"src\" seen twice in layout"
45 gdb_test "tui new-layout example src 1" \
46 "New layout does not contain the \"cmd\" window"
48 # Avoid unbalanced curly braces problems with tcl 8.5.
49 if { [tcl_version_at_least 8 6] } {
50 gdb_test "tui new-layout example src 1\}" \
51 "Extra '\}' in layout specification"
52 gdb_test "tui new-layout example {src 1} 1\}" \
53 "Extra '\}' in layout specification"
54 gdb_test "tui new-layout example \{src 1" \
55 "Missing '\}' in layout specification"
58 gdb_test_no_output "tui new-layout example asm 1 status 0 cmd 1"
60 gdb_test "help layout example" \
61 "Apply the \"example\" layout.*tui new-layout example asm 1 status 0 cmd 1"
63 gdb_test_no_output "tui new-layout example2 {asm 1 status 0} 1 cmd 1"
65 gdb_test "help layout example2" \
66 "Apply the \"example2\" layout.*tui new-layout example2 {asm 1 status 0} 1 cmd 1"
68 gdb_test_no_output "tui new-layout h {-horizontal asm 1 src 1} 1 status 0 cmd 1"
70 gdb_test "help layout h" \
71 "Apply the \"h\" layout.*tui new-layout h {-horizontal asm 1 src 1} 1 status 0 cmd 1"
73 if {![Term::enter_tui]} {
74 unsupported "TUI not supported"
78 set text [Term::get_all_lines]
79 gdb_assert {![string match "No Source Available" $text]} \
80 "initial source listing"
82 Term::command "layout example"
83 Term::check_contents "example layout shows assembly" \
86 Term::command "layout h"
87 Term::check_box "left window box" 0 0 40 15
88 Term::check_box "right window box" 39 0 41 15
89 Term::check_contents "horizontal display" \
90 "$hex <main>.*21.*return 0"
92 Term::command "winheight src - 5"
93 Term::check_box "left window box after shrink" 0 0 40 10
94 Term::check_box "right window box after shrink" 39 0 41 10
96 Term::command "winheight src + 5"
97 Term::check_box "left window box after grow" 0 0 40 15
98 Term::check_box "right window box after grow" 39 0 41 15