< prev index next >
modules/controls/src/test/java/javafx/scene/control/TreeViewKeyInputTest.java
Print this page
rev 8906 : RT-46083: TimelineClipCore exceptions handling improvent
*** 33,42 ****
--- 33,43 ----
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.TreeViewAnchorRetriever;
+ 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;
*** 2190,2204 ****
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;
root.getChildren().clear();
root.setExpanded(true);
for (int i = 0; i < items; i++) {
root.getChildren().add(new TreeItem<>("Row " + i));
--- 2191,2200 ----
*** 2214,2236 ****
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
keyboard.doKeyPress(KeyCode.UP, KeyModifier.SHIFT); // bug time?
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_37130_pageUpAtTop() {
final int items = 100;
root.getChildren().clear();
--- 2210,2235 ----
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));
}
@Test public void test_rt_37130_pageUpAtTop() {
final int items = 100;
root.getChildren().clear();
< prev index next >