Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.tui / new-layout.exp
1 # Copyright 2020-2022 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 "tui new-layout".
17
18 tuiterm_env
19
20 standard_testfile tui-layout.c
21
22 if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
23 return -1
24 }
25
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"
31 return
32 }
33 }
34
35 Term::clean_restart 24 80 $testfile
36
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"
47
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"
56 }
57
58 gdb_test_no_output "tui new-layout example asm 1 status 0 cmd 1"
59
60 gdb_test "help layout example" \
61 "Apply the \"example\" layout.*tui new-layout example asm 1 status 0 cmd 1"
62
63 gdb_test_no_output "tui new-layout example2 {asm 1 status 0} 1 cmd 1"
64
65 gdb_test "help layout example2" \
66 "Apply the \"example2\" layout.*tui new-layout example2 {asm 1 status 0} 1 cmd 1"
67
68 gdb_test_no_output "tui new-layout h {-horizontal asm 1 src 1} 1 status 0 cmd 1"
69
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"
72
73 if {![Term::enter_tui]} {
74 unsupported "TUI not supported"
75 return
76 }
77
78 set text [Term::get_all_lines]
79 gdb_assert {![string match "No Source Available" $text]} \
80 "initial source listing"
81
82 Term::command "layout example"
83 Term::check_contents "example layout shows assembly" \
84 "$hex <main>"
85
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"
91
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
95
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
This page took 0.035026 seconds and 4 git commands to generate.