Some LCN-GTxD don't display the text if it fits exactly in one chunk (12 bytes). Observed with GT10D 8.0.
Closes #9208
Signed-off-by: Fabian Wolter <github@fabian-wolter.de>
text = new String();
}
+ // some LCN-GTxD don't display the text if it fits exactly in one chunk. Observed with GT10D 8.0.
+ if (text.getBytes(LcnDefs.LCN_ENCODING).length % DYN_TEXT_CHUNK_LENGTH == 0) {
+ text += " ";
+ }
+
// convert String to bytes to split the data every 12 bytes, because a unicode character can take more than
// one byte
ByteBuffer bb = ByteBuffer.wrap(text.getBytes(LcnDefs.LCN_ENCODING));
public void testSendDynamicText1ChunkRow1() throws LcnException {
a.sendDynamicText(1, "abcdfghijklm");
- verify(handler).sendPck(stringToByteBuffer("GTDT11abcdfghijklm"));
+ verify(handler, times(2)).sendPck(byteBufferCaptor.capture());
+
+ assertThat(byteBufferCaptor.getAllValues(), contains(stringToByteBuffer("GTDT11abcdfghijklm"),
+ stringToByteBuffer("GTDT12 \0\0\0\0\0\0\0\0\0\0\0")));
}
@Test