Bug 563531 - [Tests][StyledText] Scrolling with arrow down key does not
update caret painting
A test case for regression from
2abb22fa4db3f7c87fc38290f55d0d8c4d4a4465.
Change-Id: I5622f35d8819866078f8f1376111b26803d14990
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
index b84c518..0c4f185 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
@@ -5801,4 +5801,37 @@
String clipboardText = (String) clipboard.getContents(rtfTranfer);
assertTrue("RTF copy failed", clipboardText.length() > 0);
}
+
+/**
+ * Bug 563531 - [regression][StyledText] Scrolling with arrow down key does not update caret painting
+ */
+@Test
+public void test_caretLocationOnArrowMove() {
+ text.setText(
+ "............................................................\n"
+ + "............................................................\n"
+ + "............................................................\n"
+ + "............................................................\n"
+ + "............................................................\n"
+ + "............................................................\n"
+ + "............................................................\n"
+ + "............................................................\n"
+ + "............................................................\n"
+ + "............................................................\n"
+ + "............................................................\n"
+ + "............................................................");
+
+ shell.open();
+ text.setSize(10, 50);
+
+ for (int i = 0; i < 5; i++) {
+ text.invokeAction(ST.LINE_DOWN);
+ }
+
+ Point caretLocation = text.getCaret().getLocation();
+ int caretOffset = text.getCaretOffset();
+ text.setCaretOffset(0);
+ text.setCaretOffset(caretOffset);
+ assertEquals(text.getCaret().getLocation(), caretLocation);
+}
}