aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.tui/new-layout.exp
blob: b71de7de5fa1e4d4ea676fad04a9ff29316930f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright 2020 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Test "tui new-layout".

load_lib "tuiterm.exp"

standard_testfile tui-layout.c

if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
    return -1
}

Term::clean_restart 24 80 $testfile

gdb_test "tui new-layout" \
    "No layout name specified"
gdb_test "tui new-layout example" \
    "New layout does not contain any windows"
gdb_test "tui new-layout example zzq" \
    "Unknown window \"zzq\""
gdb_test "tui new-layout example src 1 src 1" \
    "Window \"src\" seen twice in layout"
gdb_test "tui new-layout example src 1" \
    "New layout does not contain the \"cmd\" window"
gdb_test "tui new-layout example src 1}" \
    "Extra '}' in layout specification"
gdb_test "tui new-layout example {src 1} 1}" \
    "Extra '}' in layout specification"
gdb_test "tui new-layout example {src 1" \
    "Missing '}' in layout specification"

gdb_test_no_output "tui new-layout example asm 1 status 0 cmd 1"

gdb_test "help layout example" \
    "Apply the \"example\" layout.*tui new-layout example asm 1 status 0 cmd 1"

gdb_test_no_output "tui new-layout example2 {asm 1 status 0} 1 cmd 1"

gdb_test "help layout example2" \
    "Apply the \"example2\" layout.*tui new-layout example2 {asm 1 status 0} 1 cmd 1"

gdb_test_no_output "tui new-layout h {-horizontal asm 1 src 1} 1 status 0 cmd 1"

gdb_test "help layout h" \
    "Apply the \"h\" layout.*tui new-layout h {-horizontal asm 1 src 1} 1 status 0 cmd 1"

if {![Term::enter_tui]} {
    unsupported "TUI not supported"
}

set text [Term::get_all_lines]
gdb_assert {![string match "No Source Available" $text]} \
    "initial source listing"

Term::command "layout example"
Term::check_contents "example layout shows assembly" \
    "$hex <main>"

Term::command "layout h"
Term::check_box "left window box" 0 0 40 15
Term::check_box "right window box" 39 0 41 15
Term::check_contents "horizontal display" \
    "$hex <main>.*21.*return 0"

Term::command "winheight src - 5"
Term::check_box "left window box after shrink" 0 0 40 10
Term::check_box "right window box after shrink" 39 0 41 10

Term::command "winheight src + 5"
Term::check_box "left window box after grow" 0 0 40 15
Term::check_box "right window box after grow" 39 0 41 15