From 536c5ddc87627f3c2f7731d849d39cb32d52356b Mon Sep 17 00:00:00 2001 From: culler Date: Fri, 27 Oct 2017 19:35:14 +0000 Subject: Add a regression test with constraint aqua which tests that all embedded windows in a Text get moved when scrolling. If the logic change introduced in [2148dd68] is reverted then this test fails. --- generic/tkTextDisp.c | 1 + generic/tkTextWind.c | 6 ++++++ tests/textDisp.test | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 594495d..d2b6147 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -4148,6 +4148,7 @@ DisplayText( numRedisplays++; if (tkTextDebug) { Tcl_SetVar2(interp, "tk_textRedraw", NULL, "", TCL_GLOBAL_ONLY); + Tcl_SetVar2(interp, "tk_textEmbWinDisplay", NULL, "", TCL_GLOBAL_ONLY); } /* diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index c9fc20f..94fbb70 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -1112,6 +1112,12 @@ TkTextEmbWinDisplayProc( return; } + if (tkTextDebug) { + /* The variable tk_textEmbWinDisplay is cleared in DisplayText. */ + Tcl_SetVar2(textPtr->interp, "tk_textEmbWinDisplay", NULL, + Tk_PathName(tkwin), + TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); + } if ((x + chunkPtr->width) <= 0) { /* * The window is off-screen; just unmap it. diff --git a/tests/textDisp.test b/tests/textDisp.test index 216f767..5fdf8e1 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -948,6 +948,28 @@ test textDisp-6.9 {DisplayText, horizontal scrollbar updates} { update set scrollInfo } [list 0.0 [expr {4.0/11}]] +test textDisp-6.10 {DisplayText, redisplay embedded windows after scroll.} {aqua} { + .t configure -wrap char + .t delete 1.0 end + .t insert 1.0 "Line 1" + foreach i {2 3 4} { + .t insert end "\nLine $i" + } + .t insert end "\n" + .t window create end -create { + button %W.button_one -text "Button 1"} + .t insert end "\nLine 6\n" + .t window create end -create { + button %W.button_two -text "Button 2"} + .t insert end "\nLine 8\n" + .t window create end -create { + button %W.button_three -text "Button 3"} + update + .t delete 2.0 3.0 + update + list $tk_textEmbWinDisplay +} {{.t.button_one .t.button_two .t.button_three}} + # The following group of tests is marked non-portable because # they result in a lot of extra redisplay under Ultrix. I don't -- cgit v0.12