Skip to content
Permalink
Browse files

8237372: NullPointerException in TabPaneSkin.stopDrag

Reviewed-by: arapte
  • Loading branch information
Robert Lichtenberger Ambarish Rapte
Robert Lichtenberger authored and Ambarish Rapte committed Jan 29, 2020
1 parent 79fc0d0 commit 5a0e71b82057d51c16338f4ad1e331d24840e7eb
@@ -2210,17 +2210,17 @@ private void stopDrag() {
if (dragState == DragState.START) {
// No drag action was performed.
resetDrag();
return;
}
// Animate tab header being dragged to its final position.
dragHeaderSourceX = dragTabHeader.getLayoutX();
dragHeaderTransitionX = dragHeaderDestX - dragHeaderSourceX;
dragHeaderAnim.playFromStart();

// Reorder the tab list.
if (dragHeaderStartX != dragHeaderDestX) {
((TabObservableList<Tab>) getSkinnable().getTabs()).reorder(dragTabHeader.tab, swapTab);
swapTab = null;
} else if (dragState == DragState.REORDER) {
// Animate tab header being dragged to its final position.
dragHeaderSourceX = dragTabHeader.getLayoutX();
dragHeaderTransitionX = dragHeaderDestX - dragHeaderSourceX;
dragHeaderAnim.playFromStart();

// Reorder the tab list.
if (dragHeaderStartX != dragHeaderDestX) {
((TabObservableList<Tab>) getSkinnable().getTabs()).reorder(dragTabHeader.tab, swapTab);
swapTab = null;
}
}
}

@@ -463,6 +463,23 @@ private void show() {
assertSame(TabPane.TabDragPolicy.FIXED, tabPane.getTabDragPolicy());
}

@Test public void tabDragPolicyReorderAndAsymmetricMouseEvent() {
tabPane.setTabDragPolicy(TabPane.TabDragPolicy.REORDER);
tabPane.getTabs().add(tab1);
tabPane.getTabs().add(tab2);
root.getChildren().add(tabPane);
show();

root.layout();

double xval = (tabPane.localToScene(tabPane.getLayoutBounds())).getMinX();
double yval = (tabPane.localToScene(tabPane.getLayoutBounds())).getMinY();

SceneHelper.processMouseEvent(scene,
MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_RELEASED, xval+75, yval+20));
tk.firePulse();
}

@Test public void setRotateGraphicAndSeeValueIsReflectedInModel() {
tabPane.setRotateGraphic(true);
assertTrue(tabPane.rotateGraphicProperty().getValue());

0 comments on commit 5a0e71b

Please sign in to comment.
You can’t perform that action at this time.