< prev index next >

modules/controls/src/test/java/javafx/scene/control/TableViewKeyInputTest.java

Print this page
rev 8906 : RT-46083: TimelineClipCore exceptions handling improvent

*** 38,47 **** --- 38,48 ---- import java.util.function.Function; import com.sun.javafx.PlatformUtil; import com.sun.javafx.util.Utils; import com.sun.javafx.scene.control.behavior.TableViewAnchorRetriever; + 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;
*** 3472,3486 **** @Test public void test_rt36800_cellSelection() { test_rt36800(true); } private void test_rt36800(boolean cellSelection) { - // 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; tableView.getItems().clear(); for (int i = 0; i < items; i++) { tableView.getItems().add("Row " + i); } --- 3473,3482 ----
*** 3508,3518 **** --- 3504,3520 ---- 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); + } if (cellSelection) { assertEquals(0, getAnchor().getRow()); assertEquals(col, getAnchor().getTableColumn()); assertTrue(fm.isFocused(0, col));
*** 3530,3550 **** 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; tableView.getItems().clear(); for (int i = 0; i < items; i++) { tableView.getItems().add("Row " + i); } --- 3532,3544 ----
*** 3565,3580 **** 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 keyboard.doKeyPress(KeyCode.DOWN, KeyModifier.SHIFT); // 0,1,2,Exception? sl.dispose(); - - // reset the exception handler - Thread.currentThread().setUncaughtExceptionHandler(exceptionHandler); } @Test public void test_rt_37130_pageUpAtTop() { final int items = 100; tableView.getItems().clear(); --- 3559,3577 ---- 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(); } @Test public void test_rt_37130_pageUpAtTop() { final int items = 100; tableView.getItems().clear();
< prev index next >