Commit | Line | Data |
---|---|---|
2b1d00c2 TT |
1 | # Copyright 2019 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 resizing with empty windows. | |
17 | ||
18 | load_lib "tuiterm.exp" | |
19 | ||
20 | standard_testfile | |
21 | ||
22 | Term::clean_restart 24 80 | |
23 | ||
24 | if {![Term::enter_tui]} { | |
25 | unsupported "TUI not supported" | |
26 | } | |
27 | ||
28 | # Each entry describes a layout. It has these items: | |
29 | # 1. Layout name | |
30 | # 2. Test name | |
31 | # 3. List of boxes in 80x24 mode | |
32 | # 4. List of boxes in 90x40 mode | |
33 | # 5. List of test name and text for the empty window | |
34 | set layouts { | |
35 | {src src {{3 0 77 15}} {{3 0 87 23}} | |
36 | {{"no source" "No Source Available"}}} | |
37 | {regs src-regs {{0 0 80 8} {3 7 77 8}} {{0 0 90 13} {3 13 87 13}} | |
38 | { | |
39 | {"no source" "No Source Available"} | |
40 | {"no regs" "Register Values Unavailable"} | |
41 | }} | |
3df505f6 | 42 | {asm asm {{3 0 77 15}} {{3 0 87 23}} |
2b1d00c2 TT |
43 | {"no asm" "No Assembly Available"}} |
44 | {regs asm-regs {{0 0 80 8} {3 7 77 9}} {{0 0 90 13} {3 13 87 14}} | |
45 | { | |
46 | {"no asm" "No Assembly Available"} | |
47 | {"no regs" "Register Values Unavailable"} | |
48 | }} | |
3df505f6 | 49 | {split split {{3 0 77 8} {3 7 77 9}} {{3 0 87 13} {3 13 87 14}} |
2b1d00c2 TT |
50 | { |
51 | {"no source" "No Source Available"} | |
52 | {"no asm" "No Assembly Available"} | |
53 | }} | |
54 | {regs split-regs {{0 0 80 8} {3 7 77 9}} {{0 0 90 13} {3 13 87 14}} | |
55 | { | |
56 | {"no asm" "No Assembly Available"} | |
57 | {"no regs" "Register Values Unavailable"} | |
58 | }} | |
59 | } | |
60 | ||
61 | # Helper function to verify a list of boxes. | |
62 | proc check_boxes {boxes} { | |
63 | set boxno 1 | |
64 | foreach box $boxes { | |
65 | if {$boxno > 1} { | |
66 | # The upper-left corner of the second box may not render | |
67 | # properly, due to overlap. | |
68 | setup_xfail *-*-* | |
69 | } | |
70 | eval Term::check_box [list "box $boxno"] $box | |
71 | incr boxno | |
72 | } | |
73 | } | |
74 | ||
75 | # Helper function to verify text. | |
76 | proc check_text {text_list} { | |
77 | set text [Term::get_all_lines] | |
78 | foreach item $text_list { | |
79 | lassign $item testname check | |
80 | gdb_assert {[string first $check $text]} $testname | |
81 | } | |
82 | } | |
83 | ||
84 | foreach layout $layouts { | |
85 | lassign $layout name testname small_boxes large_boxes text_list | |
86 | ||
87 | with_test_prefix $testname { | |
88 | Term::command "layout $name" | |
89 | with_test_prefix 80x24 { | |
90 | check_boxes $small_boxes | |
91 | check_text $text_list | |
92 | } | |
93 | ||
3df505f6 TT |
94 | Term::resize 40 90 |
95 | with_test_prefix 90x40 { | |
96 | check_boxes $large_boxes | |
97 | check_text $text_list | |
98 | } | |
99 | Term::resize 24 80 | |
2b1d00c2 TT |
100 | } |
101 | } |