Skip to content

Commit f0f94a6

Browse files
script for TC-CC-10.1 - changes for CCB4261 (#41561)
* change for ccb4261 * Apply suggestion from @lpbeliveau-silabs Co-authored-by: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> * add tolerance as variable * Apply suggestion from @lpbeliveau-silabs Co-authored-by: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> * restyler-comments * restyler part 2 * fix text in error messages * move CTmin/max inside PICS guard * Updated the tests index and the steps array --------- Co-authored-by: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> Co-authored-by: lpbeliveau-silabs <louis-philip.beliveau@silabs.com>
1 parent 9dda583 commit f0f94a6

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/python_testing/TC_CC_10_1.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from matter.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
4747

4848
kCCAttributeValueIDs = [0x0001, 0x0003, 0x0004, 0x0007, 0x4000, 0x4001, 0x4002, 0x4003, 0x4004]
49+
kTempTolerance = 0.15
4950

5051

5152
class TC_CC_10_1(MatterBaseTest):
@@ -108,10 +109,9 @@ def steps_TC_CC_10_1(self) -> list[TestStep]:
108109
TestStep("2c", "TH sends _MoveToColor command_ to DUT, with: ColorX = 32768/0x8000 (x=0.5) (purple), ColorY = 19660/0x4CCC (y=0.3), TransitionTime = 0 (immediate)"),
109110
TestStep("2d", "TH reads _CurrentX and CurrentY attributes_ from DUT."),
110111
TestStep("2e", "TH sends _MoveToColorTemperature command_ to DUT with _ColorTemperatureMireds_=(_ColorTempPhysicalMinMireds_ + _ColorTempPhysicalMaxMireds_)/2"),
111-
TestStep("2f", "TH sends _MoveColorTemperature command_ to DUT with _MoveMode_ = 0x01 (up), _Rate_ = (_ColorTempPhysicalMaxMireds_ - _ColorTempPhysicalMinMireds_)/40"),
112-
TestStep("2g", "After 10 seconds, TH reads _ColorTemperatureMireds attribute_ from DUT."),
113-
TestStep("2h", "TH sends _EnhancedMoveToHueAndSaturation command_ to DUT with _EnhancedHue_=20000, _Saturation_=50 and _TransitionTime_=0 (immediately)."),
114-
TestStep("2i", "TH reads _EnhancedCurrentHue and CurrentSaturation attributes_ from DUT."),
112+
TestStep("2f", "TH reads _ColorTemperatureMireds attribute_ from DUT."),
113+
TestStep("2g", "TH sends _EnhancedMoveToHueAndSaturation command_ to DUT with _EnhancedHue_=20000, _Saturation_=50 and _TransitionTime_=0 (immediately)."),
114+
TestStep("2h", "TH reads _EnhancedCurrentHue and CurrentSaturation attributes_ from DUT."),
115115
TestStep("3", "TH sends a _StoreScene_ command to DUT with the _GroupID_ field set to _G~1~_ and the _SceneID_ field set to 0x01."),
116116
TestStep("4", "TH sends a _ViewScene_ command to DUT with the _GroupID_ field set to _G~1~_ and the _SceneID_ field set to 0x01."),
117117
TestStep(
@@ -214,6 +214,7 @@ async def test_TC_CC_10_1(self):
214214
self.step("2a")
215215
if self.pics_guard(self.check_pics("CC.S.F00")):
216216
await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, cluster.Commands.MoveToHueAndSaturation(200, 50, 0, 1, 1))
217+
await asyncio.sleep(1)
217218

218219
self.step("2b")
219220
if self.pics_guard(self.check_pics("CC.S.F00")):
@@ -223,13 +224,14 @@ async def test_TC_CC_10_1(self):
223224
asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster][attributes.CurrentHue], 170,
224225
"CurrentHue is not greater than or equal to 170")
225226
asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster]
226-
[attributes.CurrentSaturation], 58, "CurrentSaturation is not 58")
227+
[attributes.CurrentSaturation], 58, "CurrentSaturation is not less than or equal 58")
227228
asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster]
228-
[attributes.CurrentSaturation], 42, "CurrentSaturation is not 42")
229+
[attributes.CurrentSaturation], 42, "CurrentSaturation is not greater than or equal 42")
229230

230231
self.step("2c")
231232
if self.pics_guard(self.check_pics("CC.S.F03")):
232233
await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, cluster.Commands.MoveToColor(32768, 19660, 0, 1, 1))
234+
await asyncio.sleep(1)
233235

234236
self.step("2d")
235237
if self.pics_guard(self.check_pics("CC.S.F03")):
@@ -244,28 +246,27 @@ async def test_TC_CC_10_1(self):
244246
"CurrentY is not greater than or equal to 17000")
245247

246248
self.step("2e")
249+
CTtarget = round((ColorTempPhysicalMinMiredsValue + ColorTempPhysicalMaxMiredsValue) / 2)
247250
if self.pics_guard(self.check_pics("CC.S.F04")):
248-
await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, cluster.Commands.MoveToColorTemperature((ColorTempPhysicalMinMiredsValue + ColorTempPhysicalMaxMiredsValue) / 2, 0, 1, 1))
251+
await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, cluster.Commands.MoveToColorTemperature(CTtarget, 0, 1, 1))
249252
await asyncio.sleep(1)
250253

251254
self.step("2f")
252255
if self.pics_guard(self.check_pics("CC.S.F04")):
253-
await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, cluster.Commands.MoveColorTemperature(self.matter_test_config.endpoint, (ColorTempPhysicalMaxMiredsValue - ColorTempPhysicalMinMiredsValue) / 40, 1, 1))
254-
await asyncio.sleep(10)
256+
CTmax = round(CTtarget * (1 + kTempTolerance))
257+
CTmin = round(CTtarget * (1 - kTempTolerance))
258+
result = await self.TH1.ReadAttribute(self.dut_node_id, [(self.matter_test_config.endpoint, attributes.ColorTemperatureMireds)])
259+
asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster][attributes.ColorTemperatureMireds], CTmax,
260+
"ColorTemperatureMireds is not less than or equal to %d" % CTmax)
261+
asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster][attributes.ColorTemperatureMireds], CTmin,
262+
"ColorTemperatureMireds is not greater than or equal to %d" % CTmin)
255263

256264
self.step("2g")
257-
if self.pics_guard(self.check_pics("CC.S.F04")):
258-
ColorTemperatureMireds = await self.read_single_attribute_check_success(cluster, attributes.ColorTemperatureMireds)
259-
asserts.assert_less_equal(ColorTemperatureMireds, ColorTempPhysicalMaxMiredsValue,
260-
"ColorTemperatureMireds is not less than or equal to ColorTempPhysicalMaxMireds")
261-
asserts.assert_greater_equal(ColorTemperatureMireds, ColorTempPhysicalMinMiredsValue,
262-
"ColorTemperatureMireds is not greater than or equal to ColorTempPhysicalMinMireds")
263-
264-
self.step("2h")
265265
if self.pics_guard(self.check_pics("CC.S.F01")):
266266
await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, cluster.Commands.EnhancedMoveToHueAndSaturation(20000, 50, 0, 1, 1))
267+
await asyncio.sleep(1)
267268

268-
self.step("2i")
269+
self.step("2h")
269270
if self.pics_guard(self.check_pics("CC.S.F01")):
270271
result = await self.TH1.ReadAttribute(self.dut_node_id, [(self.matter_test_config.endpoint, attributes.EnhancedCurrentHue), (self.matter_test_config.endpoint, attributes.CurrentSaturation)])
271272
asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster][attributes.EnhancedCurrentHue], 21800,

0 commit comments

Comments
 (0)