Skip to content

Commit d785a36

Browse files
authored
Update tests for Cluster Extensions in Custom XML (#1582)
- Add command with args in test cluster extension
1 parent 43455f0 commit d785a36

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

test/custom-matter-xml.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ test(
430430
expect(sdkExt).toContain(
431431
"/ command: 0x0006 / 0xFFF201 => SampleMfgSpecificToggleWithTransition2, test extension: ''"
432432
)
433+
expect(sdkExt).toContain('transitionTime - int16u')
434+
expect(sdkExt).toContain('transitionTime - int16u - default_value=0x0003')
433435
// checking if baseType for command arguments derived from custom xml is accurate
434436
expect(sdkExt).toContain(
435437
'Sample Custom Cluster - AddArgumentsResponse\n returnValue - int8u'
@@ -444,6 +446,10 @@ test(
444446
'{ (uint16_t)0x0, (uint16_t)0x0, (uint16_t)0xFFFF }, /* Sample Mfg Specific Attribute 2 */ \\'
445447
)
446448

449+
let endpointOut = genResult.content['endpoints.out']
450+
expect(endpointOut).not.toBeNull()
451+
expect(endpointOut).toContain('- SampleMfgSpecificOnWithTransition2: /')
452+
447453
// delete custom xml and generate again
448454
sessionPartitionInfo =
449455
await querySession.selectSessionPartitionInfoFromPackageId(

test/resource/custom-cluster/matter-custom.xml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
-->
1717
<configurator>
18-
<domain name="CHIP"/>
18+
<domain name="CHIP"/>
1919
<cluster>
2020
<domain>General</domain>
2121
<name>Sample Custom Cluster</name>
@@ -24,25 +24,25 @@ limitations under the License.
2424
<description>The Sample MEI cluster showcases cluster manufacturer extensions</description>
2525
<!-- Attributes -->
2626
<!-- A simple boolean attribute that flips or flops -->
27-
<attribute side="server" code="0x0000" define="FLIP_FLOP" type="BOOLEAN" writable="true" default="false" optional="false">FlipFlop</attribute>
27+
<attribute side="server" code="0x0000" define="FLIP_FLOP" type="BOOLEAN" writable="true" default="false">FlipFlop</attribute>
2828
<!-- Command Responses -->
29-
<command source="server" code="0x01" name="AddArgumentsResponse" optional="false" disableDefaultResponse="true">
29+
<command source="server" code="0x01" name="AddArgumentsResponse" disableDefaultResponse="true">
3030
<description>
3131
Response for AddArguments that returns the sum.
3232
</description>
3333
<arg name="returnValue" type="INT8U"/>
3434
</command>
3535

3636
<!-- Commands -->
37-
<command source="client" code="0x02" name="AddArguments" response="AddArgumentsResponse" optional="false">
37+
<command source="client" code="0x02" name="AddArguments" response="AddArgumentsResponse">
3838
<description>
3939
Command that takes two uint8 arguments and returns their sum.
4040
</description>
4141
<arg name="arg1" type="INT8U"/>
4242
<arg name="arg2" type="INT8U"/>
4343
</command>
4444

45-
<command source="client" code="0x00" name="Ping" optional="false">
45+
<command source="client" code="0x00" name="Ping">
4646
<description>
4747
Simple command without any parameters and without a response.
4848
</description>
@@ -54,9 +54,11 @@ limitations under the License.
5454
<clusterExtension code="0x0006">
5555
<attribute side="server" code="0xFFF10000" define="SAMPLE_MFG_SPECIFIC_TRANSITION_TIME_2" type="INT8U" min="0x0000" max="0xFFFF" writable="true" default="0x0000" optional="true">Sample Mfg Specific Attribute 2</attribute>
5656
<attribute side="server" code="0xFFF10001" define="SAMPLE_MFG_SPECIFIC_TRANSITION_TIME_4" type="INT16U" min="0x0000" max="0xFFFF" writable="true" default="0x0000" optional="true">Sample Mfg Specific Attribute 4</attribute>
57-
<command source="client" code="0xFFF100" name="SampleMfgSpecificOnWithTransition2" optional="true">
57+
<command source="client" code="0xFFF100" name="SampleMfgSpecificOnWithTransition2">
5858
<description>Client command that turns the device on with a transition given
5959
by the transition time in the Ember Sample transition time attribute.</description>
60+
<arg name="transitionMode" type="INT8U"/>
61+
<arg name="transitionTime" type="INT16U" default="0x0003"/>
6062
</command>
6163
<command source="client" code="0xFFF101" name="SampleMfgSpecificToggleWithTransition2" optional="true">
6264
<description>Client command that toggles the device with a transition given

0 commit comments

Comments
 (0)