Skip to content

Commit

Permalink
fixup! ScrollListboxIntoView: Add it with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
t-b committed Feb 4, 2025
1 parent 121c32e commit b887c37
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Packages/tests/Basic/UTF_GuiUtilities.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ static Function TestScrollListboxIntoView()

ListBox list, listWave=listWave, size={300, 100}
ctrl = "list"
DoUpdate/W=$win

try
ScrollListboxIntoView(win, ctrl, NaN)
Expand All @@ -417,38 +418,39 @@ static Function TestScrollListboxIntoView()
CHECK_NO_RTE()
endtry

DoUpdate/W=$win
topRow = GetTopRow_IGNORE(win, ctrl)
CHECK_EQUAL_VAR(topRow, 0)

// clips to zero
ret = ScrollListboxIntoView(win, ctrl, -1)
CHECK_EQUAL_VAR(ret, 1)
DoUpdate/W=$win

DoUpdate/W=$win
topRow = GetTopRow_IGNORE(win, ctrl)
CHECK_EQUAL_VAR(topRow, 0)

// clips to available rows
ret = ScrollListboxIntoView(win, ctrl, 500)
CHECK_EQUAL_VAR(ret, 0)
DoUpdate/W=$win

DoUpdate/W=$win
topRow = GetTopRow_IGNORE(win, ctrl)
CHECK_EQUAL_VAR(topRow, 124)

// moves to the top if lower than current
ret = ScrollListboxIntoView(win, ctrl, 50)
CHECK_EQUAL_VAR(ret, 0)
DoUpdate/W=$win

DoUpdate/W=$win
topRow = GetTopRow_IGNORE(win, ctrl)
CHECK_EQUAL_VAR(topRow, 50)

// and to the bottom if larger
ret = ScrollListboxIntoView(win, ctrl, 75)
CHECK_EQUAL_VAR(ret, 0)
DoUpdate/W=$win

DoUpdate/W=$win
topRow = GetTopRow_IGNORE(win, ctrl)
CHECK_EQUAL_VAR(topRow, 71)

Expand Down

0 comments on commit b887c37

Please sign in to comment.