Home | History | Annotate | Line # | Download | only in gdb.tui
      1  1.1.1.3  christos # Copyright 2019-2024 Free Software Foundation, Inc.
      2      1.1  christos 
      3      1.1  christos # This program is free software; you can redistribute it and/or modify
      4      1.1  christos # it under the terms of the GNU General Public License as published by
      5      1.1  christos # the Free Software Foundation; either version 3 of the License, or
      6      1.1  christos # (at your option) any later version.
      7      1.1  christos #
      8      1.1  christos # This program is distributed in the hope that it will be useful,
      9      1.1  christos # but WITHOUT ANY WARRANTY; without even the implied warranty of
     10      1.1  christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11      1.1  christos # GNU General Public License for more details.
     12      1.1  christos #
     13      1.1  christos # You should have received a copy of the GNU General Public License
     14      1.1  christos # along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15      1.1  christos 
     16      1.1  christos # Test TUI resizing with empty windows.
     17      1.1  christos 
     18      1.1  christos tuiterm_env
     19      1.1  christos 
     20      1.1  christos standard_testfile
     21      1.1  christos 
     22      1.1  christos Term::clean_restart 24 80
     23      1.1  christos 
     24      1.1  christos if {![Term::enter_tui]} {
     25      1.1  christos     unsupported "TUI not supported"
     26      1.1  christos     return
     27      1.1  christos }
     28      1.1  christos 
     29      1.1  christos # Each entry describes a layout.  It has these items:
     30      1.1  christos # 1. Layout name
     31      1.1  christos # 2. Test name
     32      1.1  christos # 3. List of boxes in 80x24 mode
     33      1.1  christos # 4. List of boxes in 90x40 mode
     34      1.1  christos # 5. List of test name and text for the empty window
     35      1.1  christos set layouts {
     36      1.1  christos     {src src {{0 0 80 15}} {{0 0 90 26}}
     37      1.1  christos 	{{"no source" "No Source Available"}}}
     38  1.1.1.2  christos     {regs src-regs {{0 0 80 8} {0 7 80 8}} {{0 0 90 13} {0 12 90 13}}
     39      1.1  christos 	{
     40      1.1  christos 	    {"no source" "No Source Available"}
     41      1.1  christos 	    {"no regs" "Register Values Unavailable"}
     42      1.1  christos 	}}
     43  1.1.1.2  christos     {asm asm {{0 0 80 15}} {{0 0 90 26}}
     44      1.1  christos 	{
     45      1.1  christos 	    {"no asm" "No Assembly Available"}
     46      1.1  christos 	}}
     47  1.1.1.2  christos     {regs asm-regs {{0 0 80 8} {0 7 80 8}} {{0 0 90 13} {0 12 90 13}}
     48      1.1  christos 	{
     49      1.1  christos 	    {"no asm" "No Assembly Available"}
     50      1.1  christos 	    {"no regs" "Register Values Unavailable"}
     51      1.1  christos 	}}
     52  1.1.1.2  christos     {split split {{0 0 80 8} {0 7 80 8}} {{0 0 90 13} {0 12 90 13}}
     53      1.1  christos 	{
     54      1.1  christos 	    {"no source" "No Source Available"}
     55      1.1  christos 	    {"no asm" "No Assembly Available"}
     56      1.1  christos 	}}
     57  1.1.1.2  christos     {regs split-regs {{0 0 80 8} {0 7 80 8}} {{0 0 90 13} {0 12 90 13}}
     58      1.1  christos 	{
     59      1.1  christos 	    {"no asm" "No Assembly Available"}
     60      1.1  christos 	    {"no regs" "Register Values Unavailable"}
     61      1.1  christos 	}}
     62      1.1  christos }
     63      1.1  christos 
     64      1.1  christos # Helper function to verify a list of boxes.
     65      1.1  christos proc check_boxes {boxes} {
     66      1.1  christos     set boxno 1
     67      1.1  christos     foreach box $boxes {
     68      1.1  christos 	eval Term::check_box [list "box $boxno"] $box
     69      1.1  christos 	incr boxno
     70      1.1  christos     }
     71      1.1  christos }
     72      1.1  christos 
     73      1.1  christos # Helper function to verify text.
     74      1.1  christos proc check_text {text_list} {
     75      1.1  christos     set text [Term::get_all_lines]
     76      1.1  christos     foreach item $text_list {
     77      1.1  christos 	lassign $item testname check
     78      1.1  christos 	if {![gdb_assert {[regexp -- $check $text]} $testname]} {
     79      1.1  christos 	    Term::dump_screen
     80      1.1  christos 	}
     81      1.1  christos     }
     82      1.1  christos }
     83      1.1  christos 
     84      1.1  christos foreach layout $layouts {
     85      1.1  christos     lassign $layout name testname small_boxes large_boxes text_list
     86      1.1  christos 
     87      1.1  christos     with_test_prefix $testname {
     88      1.1  christos 	Term::command "layout $name"
     89      1.1  christos 	with_test_prefix 80x24 {
     90      1.1  christos 	    check_boxes $small_boxes
     91      1.1  christos 	    check_text $text_list
     92      1.1  christos 	}
     93      1.1  christos 
     94      1.1  christos 	Term::resize 40 90
     95      1.1  christos 	with_test_prefix 90x40 {
     96      1.1  christos 	    check_boxes $large_boxes
     97      1.1  christos 	    check_text $text_list
     98      1.1  christos 	}
     99      1.1  christos 	Term::resize 24 80
    100  1.1.1.2  christos 	with_test_prefix "80x24 again" {
    101  1.1.1.2  christos 	    check_boxes $small_boxes
    102  1.1.1.2  christos 	    check_text $text_list
    103  1.1.1.2  christos 	}
    104      1.1  christos     }
    105      1.1  christos }
    106