Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.tui / new-layout.exp
CommitLineData
88b9d363 1# Copyright 2020-2022 Free Software Foundation, Inc.
ee325b61
TT
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
8c74a764 18tuiterm_env
ee325b61
TT
19
20standard_testfile tui-layout.c
21
22if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
23 return -1
24}
25
581bea2c 26# Make sure TUI is supported before continuing.
5f278258
TT
27with_test_prefix "initial check" {
28 Term::clean_restart 24 80 $testfile
29 if {![Term::enter_tui]} {
30 unsupported "TUI not supported"
31 return
32 }
581bea2c
SL
33}
34
ee325b61
TT
35Term::clean_restart 24 80 $testfile
36
37gdb_test "tui new-layout" \
38 "No layout name specified"
39gdb_test "tui new-layout example" \
40 "New layout does not contain any windows"
41gdb_test "tui new-layout example zzq" \
42 "Unknown window \"zzq\""
43gdb_test "tui new-layout example src 1 src 1" \
44 "Window \"src\" seen twice in layout"
45gdb_test "tui new-layout example src 1" \
46 "New layout does not contain the \"cmd\" window"
10067028
TV
47
48# Avoid unbalanced curly braces problems with tcl 8.5.
49if { [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}
ee325b61
TT
57
58gdb_test_no_output "tui new-layout example asm 1 status 0 cmd 1"
59
60gdb_test "help layout example" \
61 "Apply the \"example\" layout.*tui new-layout example asm 1 status 0 cmd 1"
62
c22fef7e
TT
63gdb_test_no_output "tui new-layout example2 {asm 1 status 0} 1 cmd 1"
64
65gdb_test "help layout example2" \
66 "Apply the \"example2\" layout.*tui new-layout example2 {asm 1 status 0} 1 cmd 1"
67
7c043ba6
TT
68gdb_test_no_output "tui new-layout h {-horizontal asm 1 src 1} 1 status 0 cmd 1"
69
70gdb_test "help layout h" \
71 "Apply the \"h\" layout.*tui new-layout h {-horizontal asm 1 src 1} 1 status 0 cmd 1"
72
ee325b61
TT
73if {![Term::enter_tui]} {
74 unsupported "TUI not supported"
581bea2c 75 return
ee325b61
TT
76}
77
78set text [Term::get_all_lines]
79gdb_assert {![string match "No Source Available" $text]} \
80 "initial source listing"
81
82Term::command "layout example"
83Term::check_contents "example layout shows assembly" \
7c043ba6
TT
84 "$hex <main>"
85
86Term::command "layout h"
87Term::check_box "left window box" 0 0 40 15
88Term::check_box "right window box" 39 0 41 15
89Term::check_contents "horizontal display" \
90 "$hex <main>.*21.*return 0"
91
92Term::command "winheight src - 5"
93Term::check_box "left window box after shrink" 0 0 40 10
94Term::check_box "right window box after shrink" 39 0 41 10
95
96Term::command "winheight src + 5"
97Term::check_box "left window box after grow" 0 0 40 15
98Term::check_box "right window box after grow" 39 0 41 15
This page took 0.236733 seconds and 4 git commands to generate.