Skip to content

Commit

Permalink
8237372: NullPointerException in TabPaneSkin.stopDrag
Browse files Browse the repository at this point in the history
Reviewed-by: arapte
  • Loading branch information
Robert Lichtenberger authored and arapte committed Jan 29, 2020
1 parent 79fc0d0 commit 5a0e71b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
Expand Up @@ -2210,17 +2210,17 @@ private void stopDrag() {
if (dragState == DragState.START) { if (dragState == DragState.START) {
// No drag action was performed. // No drag action was performed.
resetDrag(); resetDrag();
return; } else if (dragState == DragState.REORDER) {
} // Animate tab header being dragged to its final position.
// Animate tab header being dragged to its final position. dragHeaderSourceX = dragTabHeader.getLayoutX();
dragHeaderSourceX = dragTabHeader.getLayoutX(); dragHeaderTransitionX = dragHeaderDestX - dragHeaderSourceX;
dragHeaderTransitionX = dragHeaderDestX - dragHeaderSourceX; dragHeaderAnim.playFromStart();
dragHeaderAnim.playFromStart();

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


Expand Down
Expand Up @@ -463,6 +463,23 @@ private void show() {
assertSame(TabPane.TabDragPolicy.FIXED, tabPane.getTabDragPolicy()); 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() { @Test public void setRotateGraphicAndSeeValueIsReflectedInModel() {
tabPane.setRotateGraphic(true); tabPane.setRotateGraphic(true);
assertTrue(tabPane.rotateGraphicProperty().getValue()); assertTrue(tabPane.rotateGraphicProperty().getValue());
Expand Down

0 comments on commit 5a0e71b

Please sign in to comment.