Commit | Line | Data |
---|---|---|
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 | 18 | tuiterm_env |
ee325b61 TT |
19 | |
20 | standard_testfile tui-layout.c | |
21 | ||
22 | if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { | |
23 | return -1 | |
24 | } | |
25 | ||
581bea2c | 26 | # Make sure TUI is supported before continuing. |
5f278258 TT |
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 | } | |
581bea2c SL |
33 | } |
34 | ||
ee325b61 TT |
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" | |
10067028 TV |
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 | } | |
ee325b61 TT |
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 | ||
c22fef7e TT |
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 | ||
7c043ba6 TT |
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 | ||
ee325b61 TT |
73 | if {![Term::enter_tui]} { |
74 | unsupported "TUI not supported" | |
581bea2c | 75 | return |
ee325b61 TT |
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" \ | |
7c043ba6 TT |
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 |