Skip to content

Commit 9fedaef

Browse files
committed
Add testcase for Sortable option
1 parent 1a16a0f commit 9fedaef

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test/+wt/+test/ListSelector.m

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,40 @@ function testButtonFunctions(testCase)
315315

316316

317317

318+
function testSortable(testCase)
319+
320+
% Get the listbox and button grid
321+
w = testCase.Widget;
322+
listControl = testCase.Widget.ListBox;
323+
buttonGrid = testCase.Widget.ListButtons;
324+
button = buttonGrid.Button;
325+
326+
% Add a list of items and put all on list
327+
testCase.verifySetProperty("Value", testCase.ItemNames);
328+
329+
% Select multiple items with mouse
330+
selIdx = [2 3];
331+
testCase.choose(listControl, selIdx)
332+
333+
% Move items further down
334+
testCase.press(button(4))
335+
testCase.press(button(4))
336+
337+
% Press down one too many
338+
testCase.press(button(4))
339+
340+
% Switch Sortable option off
341+
testCase.verifySetProperty("Sortable", false);
342+
testCase.verifyEquality(w.SelectedIndex, 1:numel(testCase.ItemNames));
343+
344+
% Switch Sortable option back on
345+
testCase.verifySetProperty("Sortable", true);
346+
testCase.verifyEquality(w.SelectedIndex, 1:numel(testCase.ItemNames));
347+
348+
end
349+
350+
351+
318352
function testUserButtons(testCase)
319353

320354
% Get the widget

0 commit comments

Comments
 (0)