Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/git-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
platform: [ubuntu-latest, windows-latest]

# List of MATLAB releases over which to run the tests.
matlab-version: [R2023b, R2024a, R2024b, latest]
matlab-version: [R2023b, R2024a, R2024b, R2025b, R2026a, latest]

# UITest with gestures only from R2023b and later.

Expand Down
47 changes: 47 additions & 0 deletions test/+wt/+test/ButtonGrid.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ function testCreationByIcon(testCase)
icon = ["add" "delete" "play" "pause" "stop"] + "_24.png";

testCase.verifySetProperty("Icon", icon);

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

end %function

Expand All @@ -50,6 +53,23 @@ function testCreationByTextAndIcon(testCase)

expNum = max(numel(text), numel(icon));
testCase.verifyNumElements(testCase.Widget.Button, expNum)

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

end %function


function testEmptyButtons(testCase)
% Add buttons by Icon and Text

testCase.verifySetProperty("Icon", strings(1,0));
testCase.verifySetProperty("Text", strings(1,0));

testCase.verifyEmpty(testCase.Widget.Button)

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

end %function

Expand All @@ -65,6 +85,9 @@ function testMissingIcons(testCase)

expNum = max(numel(text), numel(icon));
testCase.verifyNumElements(testCase.Widget.Button, expNum)

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

end %function

Expand All @@ -80,6 +103,9 @@ function testMissingText(testCase)

expNum = max(numel(text), numel(icon));
testCase.verifyNumElements(testCase.Widget.Button, expNum)

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

end %function

Expand All @@ -97,6 +123,9 @@ function testExtraTooltip(testCase)

expNum = max(numel(text), numel(icon));
testCase.verifyNumElements(testCase.Widget.Button, expNum)

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

end %function

Expand Down Expand Up @@ -127,6 +156,9 @@ function testPressButton(testCase)
testCase.verifyEqual([evts.Button], buttons)
testCase.verifyEqual(string({evts.Text}), text)
testCase.verifyEqual(string({evts.Tag}), tag)

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

end %function

Expand All @@ -137,6 +169,9 @@ function testBackgroundColor(testCase)
newValue = [1 0.5 0.2];
testCase.verifySetProperty("BackgroundColor", newValue);
testCase.verifyEqual(testCase.Widget.Grid.BackgroundColor, newValue);

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

end %function

Expand All @@ -156,6 +191,9 @@ function testOrientation(testCase)
testCase.verifySetProperty("Orientation", "vertical");
testCase.verifyNumElements(testCase.Widget.Grid.RowHeight, numel(icon));
testCase.verifyNumElements(testCase.Widget.Grid.ColumnWidth, 1);

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

end %function

Expand Down Expand Up @@ -188,6 +226,9 @@ function testIconAlignment(testCase)
newValue = "left";
testCase.verifySetProperty("IconAlignment", newValue);
testCase.verifyMatches(button.IconAlignment, newValue);

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

end %function

Expand All @@ -212,6 +253,9 @@ function testButtonWidthHeight(testCase)
testCase.verifySetProperty("Text", ["1", "2", "3", "4"], ["1", "2", "3", "4"])
testCase.verifyEqual(testCase.Widget.ButtonWidth, {10 20 30 30})

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

% Change to vertical layout
newOrientation = "vertical";
testCase.verifySetProperty("Orientation", newOrientation);
Expand All @@ -226,6 +270,9 @@ function testButtonWidthHeight(testCase)

testCase.verifySetProperty("ButtonWidth", {10 'fit'}, {10})
testCase.verifySetProperty("ButtonWidth", 20, {20})

diag = "Expected update to run without warnings.";
testCase.verifyWarningFree(@()testCase.Widget.forceUpdate(false), diag)

end

Expand Down
12 changes: 10 additions & 2 deletions widgets/+wt/+abstract/BaseViewChart.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,18 @@
%% Debugging Methods
methods

function forceUpdateChart(obj)
function forceUpdateChart(obj, showMessage)
% Forces update to run (For debugging only!)

disp("DEBUG: Forcing update for " + class(obj));
arguments
obj
showMessage (1,1) logical = true
end

if showMessage
disp("DEBUG: Forcing update for " + class(obj));
end

obj.update();

end %function
Expand Down
12 changes: 10 additions & 2 deletions widgets/+wt/+abstract/BaseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,18 @@
%% Debugging Methods
methods

function forceUpdate(obj)
function forceUpdate(obj, showMessage)
% Forces update to run (For debugging only!)

disp("DEBUG: Forcing update for " + class(obj));
arguments
obj
showMessage (1,1) logical = true
end

if showMessage
disp("DEBUG: Forcing update for " + class(obj));
end

obj.update();

end %function
Expand Down
12 changes: 10 additions & 2 deletions widgets/+wt/+abstract/BaseWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,18 @@
%% Debugging Methods
methods

function forceUpdate(obj)
function forceUpdate(obj, showMessage)
% Forces update to run (For debugging only!)

disp("DEBUG: Forcing update for " + class(obj));
arguments
obj
showMessage (1,1) logical = true
end

if showMessage
disp("DEBUG: Forcing update for " + class(obj));
end

obj.update();

end %function
Expand Down
4 changes: 2 additions & 2 deletions widgets/+wt/ButtonGrid.m
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ function update(obj)
end

% Remove any extra rows/cols from the grid
if obj.Orientation == "vertical"
if obj.Orientation == "vertical" && numNew > 0
obj.Grid.RowHeight(numNew+1:end) = [];
obj.Grid.ColumnWidth = obj.Grid.ColumnWidth(1);
else
elseif obj.Orientation == "horizontal" && numNew > 0
obj.Grid.ColumnWidth(numNew+1:end) = [];
obj.Grid.RowHeight = obj.Grid.RowHeight(1);
end
Expand Down
Loading