< prev index next >
modules/controls/src/test/java/javafx/scene/control/ListViewKeyInputTest.java
Print this page
rev 8906 : RT-46083: TimelineClipCore exceptions handling improvent
@@ -37,10 +37,11 @@
import javafx.scene.input.KeyCode;
import java.util.List;
import com.sun.javafx.PlatformUtil;
import com.sun.javafx.util.Utils;
import com.sun.javafx.scene.control.behavior.ListViewAnchorRetriever;
+import com.sun.javafx.scene.control.infrastructure.ControlTestUtils;
import com.sun.javafx.scene.control.infrastructure.KeyEventFirer;
import com.sun.javafx.scene.control.infrastructure.KeyModifier;
import com.sun.javafx.scene.control.infrastructure.StageLoader;
import com.sun.javafx.scene.control.infrastructure.VirtualFlowTestUtils;
import com.sun.javafx.tk.Toolkit;
@@ -1977,15 +1978,10 @@
assertTrue(sm.isSelected(4));
assertFalse(sm.isSelected(5));
}
@Test public void test_rt36800() {
- // get the current exception handler before replacing with our own,
- // as ListListenerHelp intercepts the exception otherwise
- final Thread.UncaughtExceptionHandler exceptionHandler = Thread.currentThread().getUncaughtExceptionHandler();
- Thread.currentThread().setUncaughtExceptionHandler((t, e) -> fail("We don't expect any exceptions in this test!"));
-
final int items = 10;
listView.getItems().clear();
for (int i = 0; i < items; i++) {
listView.getItems().add("Row " + i);
}
@@ -2000,31 +1996,29 @@
keyboard.doKeyPress(KeyCode.UP, KeyModifier.SHIFT); // 4
keyboard.doKeyPress(KeyCode.UP, KeyModifier.SHIFT); // 3
keyboard.doKeyPress(KeyCode.UP, KeyModifier.SHIFT); // 2
keyboard.doKeyPress(KeyCode.UP, KeyModifier.SHIFT); // 1
keyboard.doKeyPress(KeyCode.UP, KeyModifier.SHIFT); // 0
+
+ final Thread.UncaughtExceptionHandler exceptionHandler = ControlTestUtils.setHandler();
+ try {
keyboard.doKeyPress(KeyCode.UP, KeyModifier.SHIFT); // bug time?
+ } finally {
+ ControlTestUtils.resetHandler(exceptionHandler);
+ }
assertEquals(0, getAnchor());
assertTrue(fm.isFocused(0));
assertTrue(sm.isSelected(0));
assertFalse(sm.isSelected(1));
assertFalse(sm.isSelected(2));
assertFalse(sm.isSelected(3));
assertFalse(sm.isSelected(4));
assertFalse(sm.isSelected(5));
-
- // reset the exception handler
- Thread.currentThread().setUncaughtExceptionHandler(exceptionHandler);
}
@Test public void test_rt_36942() {
- // get the current exception handler before replacing with our own,
- // as ListListenerHelp intercepts the exception otherwise
- final Thread.UncaughtExceptionHandler exceptionHandler = Thread.currentThread().getUncaughtExceptionHandler();
- Thread.currentThread().setUncaughtExceptionHandler((t, e) -> fail("We don't expect any exceptions in this test!"));
-
final int items = 3;
listView.getItems().clear();
for (int i = 0; i < items; i++) {
listView.getItems().add("Row " + i);
}
@@ -2040,16 +2034,19 @@
StageLoader sl = new StageLoader(root);
sm.select(0);
keyboard.doKeyPress(KeyCode.DOWN, KeyModifier.SHIFT); // 0,1
keyboard.doKeyPress(KeyCode.DOWN, KeyModifier.SHIFT); // 0,1,2
+
+ final Thread.UncaughtExceptionHandler exceptionHandler = ControlTestUtils.setHandler();
+ try {
keyboard.doKeyPress(KeyCode.DOWN, KeyModifier.SHIFT); // 0,1,2,Exception?
+ } finally {
+ ControlTestUtils.resetHandler(exceptionHandler);
+ }
sl.dispose();
-
- // reset the exception handler
- Thread.currentThread().setUncaughtExceptionHandler(exceptionHandler);
}
@Test public void test_rt_37130_pageUpAtTop() {
final int items = 100;
listView.getItems().clear();
< prev index next >