File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,11 @@ function setup(testCase)
3939
4040 % Set the initial items
4141 testCase .verifySetProperty(" Items" , testCase .ItemNames);
42+
43+ % Set callback
44+ testCase.Widget.ButtonPushedFcn = @(s ,e )onCallbackTriggered(testCase ,e );
45+ testCase.Widget.ValueChangedFcn = @(s ,e )onCallbackTriggered(testCase ,e );
46+ testCase.Widget.HighlightedValueChangedFcn = @(s ,e )onCallbackTriggered(testCase ,e );
4247
4348 end % function
4449
@@ -363,6 +368,29 @@ function testUserButtons(testCase)
363368 testCase .verifyNumElements(b , 2 );
364369 testCase .press(b(1 ))
365370 testCase .press(b(2 ))
371+
372+ % Verify callbacks fired
373+ testCase .verifyEqual(testCase .CallbackCount, 2 );
374+
375+ end % function
376+
377+
378+
379+ function testAddSource(testCase )
380+
381+ % Get the widget
382+ w = testCase .Widget;
383+ buttonGrid = testCase .Widget.ListButtons;
384+ button = buttonGrid .Button;
385+
386+ % Add User buttons
387+ w.AddSource = ' ButtonPushedFcn' ;
388+
389+ % Press the buttons
390+ testCase .press(button(1 ))
391+
392+ % Verify callbacks fired
393+ testCase .verifyEqual(testCase .CallbackCount, 1 );
366394
367395 end % function
368396
You can’t perform that action at this time.
0 commit comments