# Copyright 2020-2021 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 . # Test "tui new-layout". tuiterm_env standard_testfile tui-layout.c if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { return -1 } # Make sure TUI is supported before continuing. with_test_prefix "initial check" { Term::clean_restart 24 80 $testfile if {![Term::enter_tui]} { unsupported "TUI not supported" return } } 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" # Avoid unbalanced curly braces problems with tcl 8.5. if { [tcl_version_at_least 8 6] } { 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" return } 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
" 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
.*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