public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed 1/3] [gdb/testsuite] Fix reverse attribute in tuiterm
@ 2023-05-26 13:02 Tom de Vries
  2023-05-26 13:02 ` [pushed 2/3] [gdb/testsuite] Add invisible and blinking attributes " Tom de Vries
  2023-05-26 13:03 ` [pushed 3/3] [gdb/testsuite] Add test-case gdb.tui/color-prompt.exp Tom de Vries
  0 siblings, 2 replies; 3+ messages in thread
From: Tom de Vries @ 2023-05-26 13:02 UTC (permalink / raw)
  To: gdb-patches

I noticed in proc Term::_csi_m arguments that while parameters 7 and 27 are
supposed to set the reverse attribute to 1 and 0, in fact it's set to 1 in
both cases:
...
 		    7 {
			set _attrs(reverse) 1
		    }
  ...
		    27 {
			set _attrs(reverse) 1
 		    }
...

Fix this and add a regression test in gdb.tui/tuiterm.exp.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.tui/tuiterm.exp | 36 +++++++++++++++++++++++++++++++
 gdb/testsuite/lib/tuiterm.exp     |  2 +-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.tui/tuiterm.exp b/gdb/testsuite/gdb.tui/tuiterm.exp
index 6cc6c628e73..ff0a3ac48ad 100644
--- a/gdb/testsuite/gdb.tui/tuiterm.exp
+++ b/gdb/testsuite/gdb.tui/tuiterm.exp
@@ -676,6 +676,40 @@ proc test_insert_line { } {
     } 2 0
 }
 
+proc test_attrs {} {
+    foreach { attr vals } {
+	reverse {
+	    7 1
+	    27 0
+	}
+	underline {
+	    4 1
+	    24 0
+	}
+	intensity {
+	    1 bold
+	    2 dim
+	    22 normal
+	}
+    } {
+	setup_terminal 8 1
+	set re ""
+	foreach { arg val } $vals {
+	    Term::_insert "a"
+	    Term::_csi_m $arg
+	    append re "a<$attr:$val>"
+	}
+
+	Term::_insert "a"
+	append re "a"
+
+	set re "^$re *$"
+
+	set line [Term::get_line_with_attrs 0]
+	gdb_assert { [regexp $re $line] } "attribute: $attr"
+    }
+}
+
 # Run proc TEST_PROC_NAME with a "small" terminal.
 
 proc run_one_test_small { test_proc_name } {
@@ -727,3 +761,5 @@ foreach_with_prefix test {
 } {
     run_one_test_large $test
 }
+
+test_attrs
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 5c0be85ee73..49ce79558c6 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -590,7 +590,7 @@ namespace eval Term {
 			set _attrs(underline) 0
 		    }
 		    27 {
-			set _attrs(reverse) 1
+			set _attrs(reverse) 0
 		    }
 		    30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 {
 			set _attrs(fg) $item

base-commit: 86b96a79b81fa6fcbb3e136d8c720c4aa6df8eda
-- 
2.35.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-26 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26 13:02 [pushed 1/3] [gdb/testsuite] Fix reverse attribute in tuiterm Tom de Vries
2023-05-26 13:02 ` [pushed 2/3] [gdb/testsuite] Add invisible and blinking attributes " Tom de Vries
2023-05-26 13:03 ` [pushed 3/3] [gdb/testsuite] Add test-case gdb.tui/color-prompt.exp Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).