test(android): RenderingControl lower clamp + GetVolume request body checks
android / Build + lint + test (push) Failing after 1m17s
android / Build + lint + test (push) Failing after 1m17s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+22
@@ -37,6 +37,13 @@ class RenderingControlClientTest {
|
||||
</s:Body>
|
||||
</s:Envelope>""".trimIndent()))
|
||||
assertEquals(42, client.getVolume())
|
||||
val request = server.takeRequest()
|
||||
val body = request.body.readUtf8()
|
||||
assertTrue(body.contains("<Channel>Master</Channel>")) { body }
|
||||
assertEquals(
|
||||
"\"urn:schemas-upnp-org:service:RenderingControl:1#GetVolume\"",
|
||||
request.getHeader("SOAPACTION"),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -53,4 +60,19 @@ class RenderingControlClientTest {
|
||||
val body = server.takeRequest().body.readUtf8()
|
||||
assertTrue(body.contains("<DesiredVolume>100</DesiredVolume>")) { body }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `setVolume clamps below VOLUME_MIN to zero`() = runTest {
|
||||
server.enqueue(MockResponse().setBody(
|
||||
"""<?xml version="1.0"?>
|
||||
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<s:Body>
|
||||
<u:SetVolumeResponse
|
||||
xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"/>
|
||||
</s:Body>
|
||||
</s:Envelope>""".trimIndent()))
|
||||
client.setVolume(-5)
|
||||
val body = server.takeRequest().body.readUtf8()
|
||||
assertTrue(body.contains("<DesiredVolume>0</DesiredVolume>")) { body }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user