From 0d1c77ca4797bd6bfc72ff240cee6e2476890944 Mon Sep 17 00:00:00 2001 From: ericm Date: Wed, 17 Nov 1999 22:13:02 +0000 Subject: * tests/listbox.test: Added tests for ListboxUpdateHScrollbar. * generic/tkListbox.c: Changed some old static buffers to base size on TCL_DOUBLLE_SPACE instead of (completely) hardcoding the size. --- generic/tkListbox.c | 6 +++--- tests/listbox.test | 43 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 99c4350..9d75cd7 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkListbox.c,v 1.6 1999/11/17 21:56:37 ericm Exp $ + * RCS: @(#) $Id: tkListbox.c,v 1.7 1999/11/17 22:13:02 ericm Exp $ */ #include "tkPort.h" @@ -2667,7 +2667,7 @@ static void ListboxUpdateVScrollbar(listPtr) register Listbox *listPtr; /* Information about widget. */ { - char string[100]; + char string[TCL_DOUBLE_SPACE * 2]; double first, last; int result; Tcl_Interp *interp; @@ -2729,7 +2729,7 @@ static void ListboxUpdateHScrollbar(listPtr) register Listbox *listPtr; /* Information about widget. */ { - char string[60]; + char string[TCL_DOUBLE_SPACE * 2]; int result, windowWidth; double first, last; Tcl_Interp *interp; diff --git a/tests/listbox.test b/tests/listbox.test index b5efd58..d753251 100644 --- a/tests/listbox.test +++ b/tests/listbox.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: listbox.test,v 1.5 1999/11/17 21:56:37 ericm Exp $ +# RCS: @(#) $Id: listbox.test,v 1.6 1999/11/17 22:13:03 ericm Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -1803,7 +1803,48 @@ test listbox-21.8 {ListboxListVarProc, test selection after listvar mod} { set x [list a b c] .l curselection } 2 +test listbox-21.9 {ListboxListVarProc, test hscrollbar after listvar mod} { + catch {destroy .l} + catch {unset x} + set log {} + listbox .l -font $fixed -width 10 -xscrollcommand "record x" -listvar x + pack .l + update + lappend x "0000000000" + update + lappend x "00000000000000000000" + update + set log +} [list {x 0 1} {x 0 1} {x 0 0.5}] +test listbox-21.10 {ListboxListVarProc, test hscrollbar after listvar mod} { + catch {destroy .l} + catch {unset x} + set log {} + listbox .l -font $fixed -width 10 -xscrollcommand "record x" -listvar x + pack .l + update + lappend x "0000000000" + update + lappend x "00000000000000000000" + update + set x [list "0000000000"] + update + set log +} [list {x 0 1} {x 0 1} {x 0 0.5} {x 0 1}] +# UpdateHScrollbar +test listbox-22.1 {UpdateHScrollbar} { + catch {destroy .l} + set log {} + listbox .l -font $fixed -width 10 -xscrollcommand "record x" + pack .l + update + .l insert end "0000000000" + update + .l insert end "00000000000000000000" + update + set log +} [list {x 0 1} {x 0 1} {x 0 0.5}] resetGridInfo catch {destroy .l2} -- cgit v0.12