diff --git a/code/TMDD.sbproj b/code/TMDD.sbproj index 3480cba..233c913 100644 Binary files a/code/TMDD.sbproj and b/code/TMDD.sbproj differ diff --git a/code/TMDDApp.mlapp b/code/TMDDApp.mlapp index d6145aa..acd37f6 100644 Binary files a/code/TMDDApp.mlapp and b/code/TMDDApp.mlapp differ diff --git a/resources/project/Project.xml b/resources/project/Project.xml index b4141a8..dfe1ea3 100644 --- a/resources/project/Project.xml +++ b/resources/project/Project.xml @@ -138,6 +138,13 @@ + + + + + + diff --git a/tests/tLampView.m b/tests/tLampView.m new file mode 100644 index 0000000..2e85a94 --- /dev/null +++ b/tests/tLampView.m @@ -0,0 +1,72 @@ +% This test file was generated by Copilot. Validate generated output before use. +classdef tLampView < matlab.unittest.TestCase + properties + Model + LampViewObj + Parent + end + + methods(TestMethodSetup) + function createLampView(testCase) + testCase.Parent = figure('Visible', 'off'); % Create a hidden figure for the lamp + testCase.Model = SimulationModel(); % Assuming SimulationModel is defined elsewhere + testCase.LampViewObj = LampView(testCase.Parent, testCase.Model); + end + end + + methods(Test) + function testIsOnTrue(testCase) + simulate(testCase.Model, [0.5234,0.0485,0.0934,119,150,24]); + + testCase.verifyTrue(testCase.LampViewObj.IsOn); + end + + function testIsOnFalse(testCase) + simulate(testCase.Model, [0.5234,0.0485,0.0934,119,200,24]); + + testCase.verifyFalse(testCase.LampViewObj.IsOn); + end + + function testLampColorSuccess(testCase) + testCase.LampViewObj.IsOn = true; + expectedColor = testCase.LampViewObj.LampColorSucess; + + actualColor = testCase.LampViewObj.LampObj.Color; + + testCase.verifyEqual(actualColor, expectedColor, 'Lamp color should be success color when IsOn is true.'); + end + + function testLampColorFailure(testCase) + testCase.LampViewObj.IsOn = false; + expectedColor = testCase.LampViewObj.LampColorFailure; + + actualColor = testCase.LampViewObj.LampObj.Color; + + testCase.verifyEqual(actualColor, expectedColor, 'Lamp color should be failure color when IsOn is false.'); + end + + function testTooltipSuccess(testCase) + testCase.LampViewObj.IsOn = true; + expectedTooltip = char(compose("Target occupancy remains\n between thresholds")); + + actualTooltip = testCase.LampViewObj.LampObj.Tooltip; + + testCase.verifyEqual(actualTooltip, expectedTooltip, 'Tooltip should indicate success when IsOn is true.'); + end + + function testTooltipFailure(testCase) + testCase.LampViewObj.IsOn = false; + expectedTooltip = char(compose("Target occupancy does not remain\n between thresholds")); + + actualTooltip = testCase.LampViewObj.LampObj.Tooltip; + + testCase.verifyEqual(actualTooltip, expectedTooltip, 'Tooltip should indicate failure when IsOn is false.'); + end + end + + methods(TestMethodTeardown) + function closeFigure(testCase) + close(testCase.Parent); + end + end +end \ No newline at end of file