Subject: -selectbackground tag configuration option: tests

From: fvogel <[email-masked]>
Date: Tue, 9 Feb 2016 21:27:11 +0000

---
 tests/textTag.test | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/tests/textTag.test b/tests/textTag.test
index fed073a..a7935da 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -228,6 +228,17 @@ test textTag-1.25 {configuration options} -constraints {
 } -cleanup {
     .t tag configure x -rmargin [lindex [.t tag configure x -rmargin] 3]
 } -returnCodes error -result {bad screen distance "bad"}
+test textTag-1.25a {tag configuration options} -body {
+    .t tag configure x -selectbackground #012345
+    .t tag cget x -selectbackground
+} -cleanup {
+    .t tag configure x -selectbackground [lindex [.t tag configure x -selectbackground] 3]
+} -result {#012345}
+test textTag-1.25b {configuration options} -body {
+    .t tag configure x -selectbackground non-existent
+} -cleanup {
+    .t tag configure x -selectbackground [lindex [.t tag configure x -selectbackground] 3]
+} -returnCodes error -result {unknown color name "non-existent"}
 test textTag-1.26 {tag configuration options} -constraints {
     haveCourier12
 } -body {
@@ -713,7 +724,29 @@ test textTag-5.22 {TkTextTagCmd - "configure" option} -constraints {
     .t tag configure sel -borderwidth {}
     .t cget -selectborderwidth
 } -result {}
-
+test textTag-5.23 {TkTextTagCmd - "configure" option} -body {
+    set x {}
+    # when [.t tag cget sel -selectbackground] == "", mirroring happens between
+    #     the text widget option -selectbackground
+    # and the tag         option -background
+    .t tag configure sel -selectbackground {}
+    .t configure -selectbackground black
+    .t tag configure sel -background yellow
+    lappend x [.t cget -selectbackground]
+    .t tag configure sel -background orange
+    .t configure -selectbackground blue
+    lappend x [.t tag cget sel -background]
+    # when [.t tag cget sel -selectbackground] != "", mirroring happens between
+    #     the text widget option -selectbackground
+    # and the tag         option -selectbackground
+    .t tag configure sel -selectbackground green
+    .t configure -selectbackground red
+    lappend x [.t tag cget sel -selectbackground]
+    .t configure -selectbackground black
+    .t tag configure sel -selectbackground white
+    lappend x [.t cget -selectbackground]
+    return $x
+} -result {yellow blue red white}
 
 test textTag-6.1 {TkTextTagCmd - "delete" option} -constraints {
     haveCourier12 
-- 
cgit v0.12