|
|
|
@ -216,6 +216,7 @@ public class ControlMessageReaderTest {
|
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
|
DataOutputStream dos = new DataOutputStream(bos);
|
|
|
|
DataOutputStream dos = new DataOutputStream(bos);
|
|
|
|
dos.writeByte(ControlMessage.TYPE_SET_CLIPBOARD);
|
|
|
|
dos.writeByte(ControlMessage.TYPE_SET_CLIPBOARD);
|
|
|
|
|
|
|
|
dos.writeByte(1); // paste
|
|
|
|
byte[] text = "testé".getBytes(StandardCharsets.UTF_8);
|
|
|
|
byte[] text = "testé".getBytes(StandardCharsets.UTF_8);
|
|
|
|
dos.writeShort(text.length);
|
|
|
|
dos.writeShort(text.length);
|
|
|
|
dos.write(text);
|
|
|
|
dos.write(text);
|
|
|
|
@ -227,6 +228,9 @@ public class ControlMessageReaderTest {
|
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals(ControlMessage.TYPE_SET_CLIPBOARD, event.getType());
|
|
|
|
Assert.assertEquals(ControlMessage.TYPE_SET_CLIPBOARD, event.getType());
|
|
|
|
Assert.assertEquals("testé", event.getText());
|
|
|
|
Assert.assertEquals("testé", event.getText());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean parse = (event.getFlags() & ControlMessage.FLAGS_PASTE) != 0;
|
|
|
|
|
|
|
|
Assert.assertTrue(parse);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
@ -238,6 +242,7 @@ public class ControlMessageReaderTest {
|
|
|
|
dos.writeByte(ControlMessage.TYPE_SET_CLIPBOARD);
|
|
|
|
dos.writeByte(ControlMessage.TYPE_SET_CLIPBOARD);
|
|
|
|
|
|
|
|
|
|
|
|
byte[] rawText = new byte[ControlMessageReader.CLIPBOARD_TEXT_MAX_LENGTH];
|
|
|
|
byte[] rawText = new byte[ControlMessageReader.CLIPBOARD_TEXT_MAX_LENGTH];
|
|
|
|
|
|
|
|
dos.writeByte(1); // paste
|
|
|
|
Arrays.fill(rawText, (byte) 'a');
|
|
|
|
Arrays.fill(rawText, (byte) 'a');
|
|
|
|
String text = new String(rawText, 0, rawText.length);
|
|
|
|
String text = new String(rawText, 0, rawText.length);
|
|
|
|
|
|
|
|
|
|
|
|
@ -251,6 +256,9 @@ public class ControlMessageReaderTest {
|
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals(ControlMessage.TYPE_SET_CLIPBOARD, event.getType());
|
|
|
|
Assert.assertEquals(ControlMessage.TYPE_SET_CLIPBOARD, event.getType());
|
|
|
|
Assert.assertEquals(text, event.getText());
|
|
|
|
Assert.assertEquals(text, event.getText());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean parse = (event.getFlags() & ControlMessage.FLAGS_PASTE) != 0;
|
|
|
|
|
|
|
|
Assert.assertTrue(parse);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
|