Skip to content

Commit 2a4e277

Browse files
committed
filter ListSelectorTwoPane tests prior to R2022a due to testing issues
1 parent 3e21da9 commit 2a4e277

File tree

2 files changed

+56
-52
lines changed

2 files changed

+56
-52
lines changed

test/+wt/+test/ListSelectorTwoPane.m

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
classdef ListSelectorTwoPane < wt.test.BaseWidgetTest
22
% Implements a unit test for a widget or component
33

4-
% Copyright 2020-2025 The MathWorks Inc.
4+
% Copyright 2020-2025 The MathWorks Inc.
55

66
%% Properties
77
properties
@@ -22,7 +22,7 @@ function createFigure(testCase)
2222
testCase.Figure.Position(3:4) = [700 800];
2323
testCase.Grid.RowHeight = repmat({175},1,4);
2424
testCase.Grid.ColumnWidth = {'1x','1x','1x'};
25-
25+
2626
end %function
2727

2828
end %methods
@@ -55,7 +55,7 @@ function setup(testCase)
5555

5656
%% Unit Tests
5757
methods (Test)
58-
58+
5959
function testProgrammaticItemsValueSelection(testCase)
6060

6161
% Get the RightList
@@ -117,10 +117,10 @@ function testProgrammaticItemsDataValueSelection(testCase)
117117
testCase.verifyEqual(testCase.CallbackCount, 0);
118118

119119
end %function
120-
121-
120+
121+
122122
function testProgrammaticItemsAndItemsDataValueSelection(testCase)
123-
123+
124124
% Get the RightList
125125
listControl = testCase.Widget.RightList;
126126

@@ -141,7 +141,7 @@ function testProgrammaticItemsAndItemsDataValueSelection(testCase)
141141
newSelIdx = [1 2];
142142
newValue = testCase.ItemData(newSelIdx);
143143
testCase.verifySetProperty("Value", newValue);
144-
144+
145145
% List and selection should now match value
146146
testCase.verifyEqual(string(listControl.Items), testCase.ItemNames(newSelIdx));
147147
testCase.verifyEqual(listControl.ItemsData, newSelIdx);
@@ -155,7 +155,7 @@ function testProgrammaticItemsAndItemsDataValueSelection(testCase)
155155

156156
% Verify callback did not fire
157157
testCase.verifyEqual(testCase.CallbackCount, 0);
158-
end
158+
end
159159

160160

161161
function testHighlightedValue(testCase)
@@ -183,7 +183,7 @@ function testHighlightedValue(testCase)
183183
end %function
184184

185185

186-
186+
187187
function testInteractiveSelection(testCase)
188188

189189
% Get the RightList
@@ -214,7 +214,7 @@ function testInteractiveSelection(testCase)
214214

215215
end %function
216216

217-
217+
218218
function testButtonEnables(testCase)
219219

220220
% Get the RightList and button grid
@@ -269,7 +269,7 @@ function testButtonEnables(testCase)
269269

270270
end %function
271271

272-
272+
273273
function testButtonFunctions(testCase)
274274

275275
% Get the RightList and button grid
@@ -329,7 +329,7 @@ function testButtonFunctions(testCase)
329329

330330
% Verify new highlight
331331
testCase.verifyEqual(w.HighlightedValue, testCase.ItemNames(1));
332-
332+
333333
% Verify button enables
334334
testCase.verifyEquality(buttonGrid.ButtonEnable(2:4), [1 0 1]);
335335

@@ -343,10 +343,10 @@ function testButtonFunctions(testCase)
343343
testCase.verifyEqual(testCase.CallbackCount, 5);
344344

345345
end %function
346-
347-
346+
347+
348348
function testHighlightedSelectionChange(testCase)
349-
349+
350350
% Get the RightList and button grid
351351
w = testCase.Widget;
352352
leftlistControl = testCase.Widget.LeftList;
@@ -369,54 +369,58 @@ function testHighlightedSelectionChange(testCase)
369369

370370
% Give a moment for update to run
371371
drawnow
372-
372+
373373
% Verify new order
374374
newIdx = [1 3 4];
375375
testCase.verifyEqual(w.Value, testCase.ItemNames(newIdx));
376376
testCase.verifyEqual(w.SelectedIndex, newIdx);
377-
377+
378378
% Verify highlighted values
379379
testCase.verifyEqual(w.HighlightedValue, testCase.ItemNames(newIdx(selIdx)));
380380
testCase.verifyEqual(w.LeftList.Value, 2);
381-
381+
382382
% Select item to deselect
383383
selIdx = 1;
384384
testCase.choose(rightListControl, selIdx)
385-
385+
386386
% Check button enables
387387
testCase.verifyEquality(buttonGrid.ButtonEnable, [1 1 0 1]);
388-
388+
389389
% Move items to the left
390390
testCase.press(button(2))
391-
391+
392392
% Verify new order
393393
newIdx = [3 4];
394394
testCase.verifyEqual(w.Value, testCase.ItemNames(newIdx));
395395
testCase.verifyEqual(w.SelectedIndex, newIdx);
396-
396+
397397
% Verify highlighted values
398398
testCase.verifyEqual(w.HighlightedValue, testCase.ItemNames(newIdx(1)));
399399
testCase.verifyEqual(w.LeftList.Value, 1);
400-
400+
401401
% Verify callbacks fired
402402
testCase.verifyEqual(testCase.CallbackCount, 3);
403-
403+
404404
end
405405

406406

407407
function testItemsChange(testCase)
408408

409+
testCase.assumeMinimumRelease("R2022a");
410+
409411
% Get the RightList and button grid
410412
w = testCase.Widget;
411413
leftlistControl = testCase.Widget.LeftList;
412414
buttonGrid = testCase.Widget.ListButtons;
413415
button = buttonGrid.Button;
414-
416+
415417
for idx = 1:numel(w.Items)
416-
418+
417419
% Select last item
418-
testCase.choose(leftlistControl, numel(w.Items) + 1 - idx)
419-
420+
%RJ - This may fail in R2021a
421+
idxSel = numel(w.Items) + 1 - idx;
422+
testCase.choose(leftlistControl, idxSel)
423+
420424
% Check button enables
421425
switch idx
422426
case 1
@@ -433,34 +437,34 @@ function testItemsChange(testCase)
433437
% Give a moment for update to run
434438
drawnow
435439
end
436-
440+
437441
% Check button enables
438442
testCase.verifyEquality(buttonGrid.ButtonEnable, [0 1 1 0]);
439-
443+
440444
% Verify new order
441445
newIdx = 5:-1:1;
442-
testCase.verifyEqual(w.Value, testCase.ItemNames(newIdx));
446+
testCase.verifyEqual(w.Value, testCase.ItemNames(newIdx));% Fails in 21a
443447
testCase.verifyEqual(w.SelectedIndex, newIdx);
444-
448+
445449
% Change items
446450
newSel = [1 3 5];
447451
w.Items = w.Items(newSel);
448-
452+
449453
% Give a moment for update to run
450454
drawnow
451-
455+
452456
% Verify new value and selected index
453457
testCase.verifyEqual(w.Value, testCase.ItemNames([5 3 1]));
454458
testCase.verifyEqual(w.SelectedIndex, [3 2 1]);
455459
testCase.verifyEqual(w.HighlightedValue, testCase.ItemNames(5));
456-
460+
457461
% Move items to the left
458462
testCase.press(button(2))
459463
testCase.press(button(2))
460-
464+
461465
% Give a moment for update to run
462466
drawnow
463-
467+
464468
% Verify new order
465469
newIdx = 1;
466470
testCase.verifyEqual(w.Value, testCase.ItemNames(newIdx));
@@ -469,18 +473,20 @@ function testItemsChange(testCase)
469473
testCase.verifyEqual(w.LeftList.Value, 2);
470474

471475
end
472-
473-
476+
477+
474478
function testSortable(testCase)
475479

480+
testCase.assumeMinimumRelease("R2022a");
481+
476482
% Get the RightList and button grid
477483
w = testCase.Widget;
478484
leftlistControl = testCase.Widget.LeftList;
479485
buttonGrid = testCase.Widget.ListButtons;
480486
button = buttonGrid.Button;
481-
487+
482488
for idx = 1:numel(w.Items)
483-
489+
484490
% Select last item
485491
testCase.choose(leftlistControl, numel(w.Items) + 1 - idx)
486492

@@ -490,33 +496,33 @@ function testSortable(testCase)
490496
% Give a moment for update to run
491497
drawnow
492498
end
493-
499+
494500
% Verify new order
495501
newIdx = 5:-1:1;
496502
testCase.verifyEqual(w.Value, testCase.ItemNames(newIdx));
497503
testCase.verifyEqual(w.SelectedIndex, newIdx);
498-
504+
499505
% Set sortable
500506
w.Sortable = false;
501-
507+
502508
% Give a moment for update to run
503509
drawnow
504-
510+
505511
% Check new order
506512
newIdx = 1:5;
507513
testCase.verifyEqual(w.Value, testCase.ItemNames(newIdx));
508514
testCase.verifyEqual(w.SelectedIndex, newIdx);
509515
end
510516

511-
517+
512518
function testUserButtons(testCase)
513519

514520
% Get the widget
515521
w = testCase.Widget;
516522

517523
% Add User buttons
518524
w.UserButtons.Icon = ["plot_24.png","play_24.png"];
519-
drawnow
525+
drawnow
520526

521527
% Add user buttons
522528
b = w.UserButtons.Button;
@@ -531,7 +537,7 @@ function testUserButtons(testCase)
531537

532538
end %function
533539

534-
540+
535541
function testStyleProperties(testCase)
536542

537543
% Set ButtonWidth
@@ -548,7 +554,7 @@ function testStyleProperties(testCase)
548554

549555
end %function
550556

551-
557+
552558

553559
end %methods (Test)
554560

test/+wt/+test/RowEntriesTable.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ function populateInitialData(testCase)
5353

5454
function setup(testCase)
5555

56-
isUnsupported = isMATLABReleaseOlderThan("R2022a");
57-
diag = "Release not supported.";
58-
testCase.assumeFalse(isUnsupported, diag)
56+
testCase.assumeMinimumRelease("R2022a");
5957

6058
fcn = @()wt.RowEntriesTable(testCase.Grid);
6159
testCase.Widget = verifyWarningFree(testCase,fcn);

0 commit comments

Comments
 (0)