changeset 9265:d32c32056ba1

8136840: Correct controls test refactor Reviewed-by:
author ddhill
date Tue, 22 Sep 2015 10:23:09 -0400
parents 1853405d2b86
children 222d8f8a82c6
files modules/controls/src/test/java/com/sun/javafx/scene/control/ContextMenuContentShim.java modules/controls/src/test/java/javafx/scene/control/skin/TableColumnHeaderShim.java modules/controls/src/test/java/test/com/sun/javafx/scene/control/infrastructure/TableColumnHeaderUtil.java modules/controls/src/test/java/test/javafx/scene/control/ContextMenuTest.java modules/controls/src/test/java/test/javafx/scene/control/TableViewTest.java
diffstat 5 files changed, 314 insertions(+), 269 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/test/java/com/sun/javafx/scene/control/ContextMenuContentShim.java	Mon Sep 21 16:17:03 2015 -0700
+++ b/modules/controls/src/test/java/com/sun/javafx/scene/control/ContextMenuContentShim.java	Tue Sep 22 10:23:09 2015 -0400
@@ -24,18 +24,15 @@
  */
 package com.sun.javafx.scene.control;
 
-import test.com.sun.javafx.scene.control.infrastructure.KeyEventFirer;
-import test.com.sun.javafx.scene.control.infrastructure.MouseEventFirer;
 import javafx.collections.ObservableList;
 import javafx.scene.Node;
 import javafx.scene.control.ContextMenu;
-import javafx.scene.control.CustomMenuItem;
 import javafx.scene.control.Menu;
 import javafx.scene.control.MenuItem;
 import javafx.scene.control.skin.ContextMenuSkin;
-import javafx.scene.input.KeyCode;
 
 import java.util.Optional;
+import javafx.scene.layout.Region;
 
 public class ContextMenuContentShim {
 
@@ -43,6 +40,10 @@
         // no-op
     }
 
+    public static Region get_selectedBackground(ContextMenuContent menu) {
+        return menu.selectedBackground;
+    }
+
     public static Menu getOpenSubMenu(ContextMenu menu) {
         ContextMenuContent content = getMenuContent(menu);
         return content.getOpenSubMenu();
@@ -137,70 +138,4 @@
         return null;
     }
 
-    public static void pressDownKey(ContextMenu menu) {
-//        getShowingMenuContent(menu).ifPresent(content -> new KeyEventFirer(content).doDownArrowPress());
-        Optional<ContextMenuContent> showingMenuContent = getShowingMenuContent(menu);
-        if (showingMenuContent.isPresent()) {
-            ContextMenuContent content = showingMenuContent.get();
-            new KeyEventFirer(content).doDownArrowPress();
-        }
-    }
-
-    public static void pressUpKey(ContextMenu menu) {
-//        getShowingMenuContent(menu).ifPresent(content -> new KeyEventFirer(content).doUpArrowPress());
-        Optional<ContextMenuContent> showingMenuContent = getShowingMenuContent(menu);
-        if (showingMenuContent.isPresent()) {
-            ContextMenuContent content = showingMenuContent.get();
-            new KeyEventFirer(content).doUpArrowPress();
-        }
-    }
-
-    public static void pressLeftKey(ContextMenu menu) {
-//        getShowingMenuContent(menu).ifPresent(content -> new KeyEventFirer(content).doLeftArrowPress());
-        Optional<ContextMenuContent> showingMenuContent = getShowingMenuContent(menu);
-        if (showingMenuContent.isPresent()) {
-            ContextMenuContent content = showingMenuContent.get();
-            new KeyEventFirer(content).doLeftArrowPress();
-        }
-    }
-
-    public static void pressRightKey(ContextMenu menu) {
-//        getShowingMenuContent(menu).ifPresent(content -> new KeyEventFirer(content).doRightArrowPress());
-        Optional<ContextMenuContent> showingMenuContent = getShowingMenuContent(menu);
-        if (showingMenuContent.isPresent()) {
-            ContextMenuContent content = showingMenuContent.get();
-            new KeyEventFirer(content).doRightArrowPress();
-        }
-    }
-
-    public static void pressEnterKey(ContextMenu menu) {
-//        getShowingMenuContent(menu).ifPresent(content -> new KeyEventFirer(content).doKeyPress(KeyCode.ENTER));
-        Optional<ContextMenuContent> showingMenuContent = getShowingMenuContent(menu);
-        if (showingMenuContent.isPresent()) {
-            ContextMenuContent content = showingMenuContent.get();
-            new KeyEventFirer(content).doKeyPress(KeyCode.ENTER);
-        }
-    }
-
-    public static void pressMouseButton(ContextMenu menu) {
-        Optional<ContextMenuContent> showingMenuContent = getShowingMenuContent(menu);
-        if (showingMenuContent.isPresent()) {
-            ContextMenuContent.MenuItemContainer itemContainer =
-                    (ContextMenuContent.MenuItemContainer) showingMenuContent.get().selectedBackground;
-
-            MenuItem item = itemContainer.getItem();
-            if (item instanceof CustomMenuItem) {
-                // If the item is a CustomMenuItem, we fire the event on the
-                // content of that CustomMenuItem.
-                // Also, note that we firea mouse _clicked_ event, as opposed to
-                // a press and release. I'm not sure why this is what the
-                // ContextMenuContent code expects, but I didn't want to mess with
-                // it at this point.
-                Node customContent = ((CustomMenuItem)item).getContent();
-                new MouseEventFirer(customContent).fireMouseClicked();
-            } else {
-                new MouseEventFirer(itemContainer).fireMousePressAndRelease();
-            }
-        }
-    }
 }
--- a/modules/controls/src/test/java/javafx/scene/control/skin/TableColumnHeaderShim.java	Mon Sep 21 16:17:03 2015 -0700
+++ b/modules/controls/src/test/java/javafx/scene/control/skin/TableColumnHeaderShim.java	Tue Sep 22 10:23:09 2015 -0400
@@ -24,24 +24,16 @@
  */
 package javafx.scene.control.skin;
 
-import test.com.sun.javafx.scene.control.infrastructure.VirtualFlowTestUtils;
 import javafx.scene.control.TableColumn;
 import javafx.scene.control.TableColumnBase;
-import javafx.scene.control.skin.TableColumnHeader;
 
 public class TableColumnHeaderShim {
 
-    public static int getColumnIndex(TableColumn col) {
-        TableColumnHeader colHeader = VirtualFlowTestUtils.getTableColumnHeader(col.getTableView(), col);
-        return colHeader == null ? -1 : colHeader.columnIndex;
-    }
-
     public static int getColumnIndex(TableColumnHeader colHeader) {
         return colHeader == null ? -1 : colHeader.columnIndex;
     }
 
-    public static void moveColumn(TableColumn col, int newPos) {
-        TableColumnHeader colHeader = VirtualFlowTestUtils.getTableColumnHeader(col.getTableView(), col);
+    public static void moveColumn(TableColumn col, TableColumnHeader colHeader, int newPos) {
         colHeader.moveColumn(col, newPos);
     }
 
@@ -49,14 +41,19 @@
         return header.sortPos;
     }
 
-    public static void moveColumn(TableColumn col, int dragOffset, int x) {
-        TableColumnHeader colHeader = VirtualFlowTestUtils.getTableColumnHeader(col.getTableView(), col);
-        colHeader.columnReorderingStarted(dragOffset);
-        colHeader.columnReordering(x, 0);
-        colHeader.columnReorderingComplete();
+    public static TableColumnHeader getColumnHeaderFor(TableHeaderRow header, final TableColumnBase<?,?> col) {
+        return header.getColumnHeaderFor(col);
     }
 
-    public static TableColumnHeader getColumnHeaderFor(final TableHeaderRow header, final TableColumnBase<?,?> col) {
-        return header.getColumnHeaderFor(col);
+    public static void columnReorderingStarted(TableColumnHeader header, double dragOffset) {
+        header.columnReorderingStarted(dragOffset);
+    }
+
+    public static void columnReordering(TableColumnHeader header, double sceneX, double sceneY) {
+        header.columnReordering(sceneX, sceneY);
+    }
+
+    public static void columnReorderingComplete(TableColumnHeader header) {
+        header.columnReorderingComplete();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/controls/src/test/java/test/com/sun/javafx/scene/control/infrastructure/TableColumnHeaderUtil.java	Tue Sep 22 10:23:09 2015 -0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.com.sun.javafx.scene.control.infrastructure;
+
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.skin.TableColumnHeader;
+import javafx.scene.control.skin.TableColumnHeaderShim;
+
+public class TableColumnHeaderUtil {
+
+    public static int getColumnIndex(TableColumn col) {
+        TableColumnHeader colHeader = VirtualFlowTestUtils.getTableColumnHeader(col.getTableView(), col);
+        return TableColumnHeaderShim.getColumnIndex(colHeader);
+    }
+
+    public static void moveColumn(TableColumn col, int newPos) {
+        TableColumnHeader colHeader = VirtualFlowTestUtils.getTableColumnHeader(col.getTableView(), col);
+        TableColumnHeaderShim.moveColumn(col, colHeader, newPos);
+    }
+
+    public static void moveColumn(TableColumn col, int dragOffset, int x) {
+        TableColumnHeader colHeader = VirtualFlowTestUtils.getTableColumnHeader(col.getTableView(), col);
+        TableColumnHeaderShim.columnReorderingStarted(colHeader, dragOffset);
+        TableColumnHeaderShim.columnReordering(colHeader, x, 0);
+        TableColumnHeaderShim.columnReorderingComplete(colHeader);
+    }
+    
+}
--- a/modules/controls/src/test/java/test/javafx/scene/control/ContextMenuTest.java	Mon Sep 21 16:17:03 2015 -0700
+++ b/modules/controls/src/test/java/test/javafx/scene/control/ContextMenuTest.java	Tue Sep 22 10:23:09 2015 -0400
@@ -25,6 +25,8 @@
 
 package test.javafx.scene.control;
 
+import com.sun.javafx.scene.control.ContextMenuContent;
+import com.sun.javafx.scene.control.ContextMenuContentShim;
 import test.com.sun.javafx.scene.control.infrastructure.StageLoader;
 import javafx.event.ActionEvent;
 import javafx.event.EventHandler;
@@ -42,8 +44,69 @@
 
 import static org.junit.Assert.*;
 import static com.sun.javafx.scene.control.ContextMenuContentShim.*;
+import java.util.Optional;
+import javafx.scene.Node;
+import javafx.scene.input.KeyCode;
+import test.com.sun.javafx.scene.control.infrastructure.KeyEventFirer;
+import test.com.sun.javafx.scene.control.infrastructure.MouseEventFirer;
 
 public class ContextMenuTest {
+
+    public static void pressDownKey(ContextMenu menu) {
+        Optional<ContextMenuContent> showingMenuContent = ContextMenuContentShim.getShowingMenuContent(menu);
+        if (showingMenuContent.isPresent()) {
+            ContextMenuContent content = showingMenuContent.get();
+            new KeyEventFirer(content).doDownArrowPress();
+        }
+    }
+
+    public static void pressUpKey(ContextMenu menu) {
+        Optional<ContextMenuContent> showingMenuContent = ContextMenuContentShim.getShowingMenuContent(menu);
+        if (showingMenuContent.isPresent()) {
+            ContextMenuContent content = showingMenuContent.get();
+            new KeyEventFirer(content).doUpArrowPress();
+        }
+    }
+
+    public static void pressRightKey(ContextMenu menu) {
+        Optional<ContextMenuContent> showingMenuContent = ContextMenuContentShim.getShowingMenuContent(menu);
+        if (showingMenuContent.isPresent()) {
+            ContextMenuContent content = showingMenuContent.get();
+            new KeyEventFirer(content).doRightArrowPress();
+        }
+    }
+
+    public static void pressEnterKey(ContextMenu menu) {
+        Optional<ContextMenuContent> showingMenuContent = ContextMenuContentShim.getShowingMenuContent(menu);
+        if (showingMenuContent.isPresent()) {
+            ContextMenuContent content = showingMenuContent.get();
+            new KeyEventFirer(content).doKeyPress(KeyCode.ENTER);
+        }
+    }
+
+    public static void pressLeftKey(ContextMenu menu) {
+        Optional<ContextMenuContent> showingMenuContent = ContextMenuContentShim.getShowingMenuContent(menu);
+        if (showingMenuContent.isPresent()) {
+            ContextMenuContent content = showingMenuContent.get();
+            new KeyEventFirer(content).doLeftArrowPress();
+        }
+    }
+
+    public static void pressMouseButton(ContextMenu menu) {
+        Optional<ContextMenuContent> showingMenuContent = ContextMenuContentShim.getShowingMenuContent(menu);
+        if (showingMenuContent.isPresent()) {
+            ContextMenuContent.MenuItemContainer itemContainer =  (ContextMenuContent.MenuItemContainer)
+                    ContextMenuContentShim.get_selectedBackground(showingMenuContent.get());
+            MenuItem item = itemContainer.getItem();
+            if (item instanceof CustomMenuItem) {
+                Node customContent = ((CustomMenuItem) item).getContent();
+                new MouseEventFirer(customContent).fireMouseClicked();
+            } else {
+                new MouseEventFirer(itemContainer).fireMousePressAndRelease();
+            }
+        }
+    }
+
     private MenuItem menuItem0, menuItem1, menuItem2, menuItem3;
 
     private ContextMenu contextMenu;
--- a/modules/controls/src/test/java/test/javafx/scene/control/TableViewTest.java	Mon Sep 21 16:17:03 2015 -0700
+++ b/modules/controls/src/test/java/test/javafx/scene/control/TableViewTest.java	Tue Sep 22 10:23:09 2015 -0400
@@ -101,9 +101,9 @@
 import test.com.sun.javafx.scene.control.test.Person;
 import test.com.sun.javafx.scene.control.test.RT_22463_Person;
 
-import static javafx.scene.control.skin.TableColumnHeaderShim.*;
 import javafx.scene.control.skin.TableHeaderRowShim;
 import static org.junit.Assert.assertEquals;
+import test.com.sun.javafx.scene.control.infrastructure.TableColumnHeaderUtil;
 
 public class TableViewTest {
     private TableView<String> table;
@@ -2082,12 +2082,12 @@
 
         StageLoader sl = new StageLoader(table);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(1, getColumnIndex(col2));
-
-        moveColumn(col1, 1);
-        assertEquals(1, getColumnIndex(col1));
-        assertEquals(0, getColumnIndex(col2));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col2));
+
+        TableColumnHeaderUtil.moveColumn(col1, 1);
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col2));
 
         sl.dispose();
     }
@@ -2100,12 +2100,12 @@
 
         StageLoader sl = new StageLoader(table);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(1, getColumnIndex(col2));
-
-        moveColumn(col2, 0);
-        assertEquals(1, getColumnIndex(col1));
-        assertEquals(0, getColumnIndex(col2));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col2));
+
+        TableColumnHeaderUtil.moveColumn(col2, 0);
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col2));
 
         sl.dispose();
     }
@@ -2119,14 +2119,14 @@
 
         StageLoader sl = new StageLoader(table);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(1, getColumnIndex(col2));
-        assertEquals(2, getColumnIndex(col3));
-
-        moveColumn(col1, 1);
-        assertEquals(1, getColumnIndex(col1));
-        assertEquals(0, getColumnIndex(col2));
-        assertEquals(2, getColumnIndex(col3));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col3));
+
+        TableColumnHeaderUtil.moveColumn(col1, 1);
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col3));
 
         sl.dispose();
     }
@@ -2140,14 +2140,14 @@
 
         StageLoader sl = new StageLoader(table);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(1, getColumnIndex(col2));
-        assertEquals(2, getColumnIndex(col3));
-
-        moveColumn(col2, 0);
-        assertEquals(1, getColumnIndex(col1));
-        assertEquals(0, getColumnIndex(col2));
-        assertEquals(2, getColumnIndex(col3));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col3));
+
+        TableColumnHeaderUtil.moveColumn(col2, 0);
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col3));
 
         sl.dispose();
     }
@@ -2161,14 +2161,14 @@
 
         StageLoader sl = new StageLoader(table);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(1, getColumnIndex(col2));
-        assertEquals(2, getColumnIndex(col3));
-
-        moveColumn(col2, 2);
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(2, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col3));
+
+        TableColumnHeaderUtil.moveColumn(col2, 2);
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
 
         sl.dispose();
     }
@@ -2182,14 +2182,14 @@
 
         StageLoader sl = new StageLoader(table);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(1, getColumnIndex(col2));
-        assertEquals(2, getColumnIndex(col3));
-
-        moveColumn(col3, 1);
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(2, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col3));
+
+        TableColumnHeaderUtil.moveColumn(col3, 1);
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
 
         sl.dispose();
     }
@@ -2203,14 +2203,14 @@
 
         StageLoader sl = new StageLoader(table);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(1, getColumnIndex(col2));
-        assertEquals(2, getColumnIndex(col3));
-
-        moveColumn(col1, 2);
-        assertEquals(2, getColumnIndex(col1));
-        assertEquals(0, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col3));
+
+        TableColumnHeaderUtil.moveColumn(col1, 2);
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
 
         sl.dispose();
     }
@@ -2224,14 +2224,14 @@
 
         StageLoader sl = new StageLoader(table);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(1, getColumnIndex(col2));
-        assertEquals(2, getColumnIndex(col3));
-
-        moveColumn(col3, 0);
-        assertEquals(1, getColumnIndex(col1));
-        assertEquals(2, getColumnIndex(col2));
-        assertEquals(0, getColumnIndex(col3));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col3));
+
+        TableColumnHeaderUtil.moveColumn(col3, 0);
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col3));
 
         sl.dispose();
     }
@@ -2247,14 +2247,14 @@
 
         col2.setVisible(false);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
-
-        moveColumn(col1, 1);
-        assertEquals(1, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(0, getColumnIndex(col3));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
+
+        TableColumnHeaderUtil.moveColumn(col1, 1);
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col3));
 
         sl.dispose();
     }
@@ -2270,14 +2270,14 @@
 
         col2.setVisible(false);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
-
-        moveColumn(col1, 100);
-        assertEquals(1, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(0, getColumnIndex(col3));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
+
+        TableColumnHeaderUtil.moveColumn(col1, 100);
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col3));
 
         sl.dispose();
     }
@@ -2293,14 +2293,14 @@
 
         col2.setVisible(false);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
-
-        moveColumn(col3, 0);
-        assertEquals(1, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(0, getColumnIndex(col3));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
+
+        TableColumnHeaderUtil.moveColumn(col3, 0);
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col3));
 
         sl.dispose();
     }
@@ -2320,20 +2320,20 @@
         col2.setVisible(false);
         col4.setVisible(false);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(2, getColumnIndex(col5));
-        assertEquals(3, getColumnIndex(col6));
-
-        moveColumn(col1, 1);    // 1 should represent the spot between col2 and col4
-        assertEquals(1, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(0, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(2, getColumnIndex(col5));
-        assertEquals(3, getColumnIndex(col6));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col6));
+
+        TableColumnHeaderUtil.moveColumn(col1, 1);    // 1 should represent the spot between col2 and col4
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col6));
 
         sl.dispose();
     }
@@ -2353,20 +2353,20 @@
         col2.setVisible(false);
         col4.setVisible(false);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(2, getColumnIndex(col5));
-        assertEquals(3, getColumnIndex(col6));
-
-        moveColumn(col1, 3);    // 3 should represent the end place
-        assertEquals(3, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(0, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(1, getColumnIndex(col5));
-        assertEquals(2, getColumnIndex(col6));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col6));
+
+        TableColumnHeaderUtil.moveColumn(col1, 3);    // 3 should represent the end place
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col6));
 
         sl.dispose();
     }
@@ -2386,20 +2386,20 @@
         col2.setVisible(false);
         col4.setVisible(false);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(2, getColumnIndex(col5));
-        assertEquals(3, getColumnIndex(col6));
-
-        moveColumn(col3, 0);
-        assertEquals(1, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(0, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(2, getColumnIndex(col5));
-        assertEquals(3, getColumnIndex(col6));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col6));
+
+        TableColumnHeaderUtil.moveColumn(col3, 0);
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col6));
 
         sl.dispose();
     }
@@ -2419,20 +2419,20 @@
         col2.setVisible(false);
         col4.setVisible(false);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(2, getColumnIndex(col5));
-        assertEquals(3, getColumnIndex(col6));
-
-        moveColumn(col3, 3);    // 3 should represent the end place
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(3, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(1, getColumnIndex(col5));
-        assertEquals(2, getColumnIndex(col6));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col6));
+
+        TableColumnHeaderUtil.moveColumn(col3, 3);    // 3 should represent the end place
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col6));
 
         sl.dispose();
     }
@@ -2452,20 +2452,20 @@
         col2.setVisible(false);
         col4.setVisible(false);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(2, getColumnIndex(col5));
-        assertEquals(3, getColumnIndex(col6));
-
-        moveColumn(col6, 0);
-        assertEquals(1, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(2, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(3, getColumnIndex(col5));
-        assertEquals(0, getColumnIndex(col6));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col6));
+
+        TableColumnHeaderUtil.moveColumn(col6, 0);
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col6));
 
         sl.dispose();
     }
@@ -2485,20 +2485,20 @@
         col2.setVisible(false);
         col4.setVisible(false);
 
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(1, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(2, getColumnIndex(col5));
-        assertEquals(3, getColumnIndex(col6));
-
-        moveColumn(col6, 1);
-        assertEquals(0, getColumnIndex(col1));
-        assertEquals(-1, getColumnIndex(col2));
-        assertEquals(2, getColumnIndex(col3));
-        assertEquals(-1, getColumnIndex(col4));
-        assertEquals(3, getColumnIndex(col5));
-        assertEquals(1, getColumnIndex(col6));
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col6));
+
+        TableColumnHeaderUtil.moveColumn(col6, 1);
+        assertEquals(0, TableColumnHeaderUtil.getColumnIndex(col1));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col2));
+        assertEquals(2, TableColumnHeaderUtil.getColumnIndex(col3));
+        assertEquals(-1, TableColumnHeaderUtil.getColumnIndex(col4));
+        assertEquals(3, TableColumnHeaderUtil.getColumnIndex(col5));
+        assertEquals(1, TableColumnHeaderUtil.getColumnIndex(col6));
 
         sl.dispose();
     }
@@ -3302,28 +3302,28 @@
         // RT-37057).
 
         // Drag column 1 to slot 1. As expected, the column position doesn't change.
-        TableColumnHeaderShim.moveColumn(column1, 0);
+        TableColumnHeaderUtil.moveColumn(column1, 0);
         assertEquals(column1, table.getVisibleLeafColumn(0));
         assertEquals(column2, table.getVisibleLeafColumn(1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header1));
         assertEquals(1, TableColumnHeaderShim.getColumnIndex(header2));
 
         // Drag column 1 to slot 2. As expected, the column 1 and 2 swap positions.
-        TableColumnHeaderShim.moveColumn(column1, 1);
+        TableColumnHeaderUtil.moveColumn(column1, 1);
         assertEquals(column2, table.getVisibleLeafColumn(0));
         assertEquals(column1, table.getVisibleLeafColumn(1));
         assertEquals(1, TableColumnHeaderShim.getColumnIndex(header1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header2));
 
         // Drag column 1 to slot 0. As expected, the column 1 and 2 swap positions.
-        TableColumnHeaderShim.moveColumn(column1, 0);
+        TableColumnHeaderUtil.moveColumn(column1, 0);
         assertEquals(column1, table.getVisibleLeafColumn(0));
         assertEquals(column2, table.getVisibleLeafColumn(1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header1));
         assertEquals(1, TableColumnHeaderShim.getColumnIndex(header2));
 
         // Drag column 1 to slot 1 again. What? Why did they swap positions this time?
-        TableColumnHeaderShim.moveColumn(column1, 0);
+        TableColumnHeaderUtil.moveColumn(column1, 0);
         assertEquals(column1, table.getVisibleLeafColumn(0));
         assertEquals(column2, table.getVisibleLeafColumn(1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header1));
@@ -3365,28 +3365,28 @@
         // in TableColumnHeader
 
         // Drag column 1 to slot 1. As expected, the column position doesn't change.
-        TableColumnHeaderShim.moveColumn(column1, 9, 61);
+        TableColumnHeaderUtil.moveColumn(column1, 9, 61);
         assertEquals(column1, table.getVisibleLeafColumn(0));
         assertEquals(column2, table.getVisibleLeafColumn(1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header1));
         assertEquals(1, TableColumnHeaderShim.getColumnIndex(header2));
 
         // Drag column 1 to slot 2. As expected, the column 1 and 2 swap positions.
-        TableColumnHeaderShim.moveColumn(column1, 12, 139);
+        TableColumnHeaderUtil.moveColumn(column1, 12, 139);
         assertEquals(column2, table.getVisibleLeafColumn(0));
         assertEquals(column1, table.getVisibleLeafColumn(1));
         assertEquals(1, TableColumnHeaderShim.getColumnIndex(header1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header2));
 
         // Drag column 1 to slot 0. As expected, the column 1 and 2 swap positions.
-        TableColumnHeaderShim.moveColumn(column1, 45, 21);
+        TableColumnHeaderUtil.moveColumn(column1, 45, 21);
         assertEquals(column1, table.getVisibleLeafColumn(0));
         assertEquals(column2, table.getVisibleLeafColumn(1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header1));
         assertEquals(1, TableColumnHeaderShim.getColumnIndex(header2));
 
         // Drag column 1 to slot 1 again. What? Why did they swap positions this time?
-        TableColumnHeaderShim.moveColumn(column1, 19, 63);
+        TableColumnHeaderUtil.moveColumn(column1, 19, 63);
         assertEquals(column1, table.getVisibleLeafColumn(0));
         assertEquals(column2, table.getVisibleLeafColumn(1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header1));
@@ -3428,21 +3428,21 @@
         // RT-37057).
 
         // Drag column 1 to slot 2. As expected, the column 1 and 2 swap positions
-        TableColumnHeaderShim.moveColumn(column1, 1);
+        TableColumnHeaderUtil.moveColumn(column1, 1);
         assertEquals(column2, table.getVisibleLeafColumn(0));
         assertEquals(column1, table.getVisibleLeafColumn(1));
         assertEquals(1, TableColumnHeaderShim.getColumnIndex(header1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header2));
 
         // Drag column 1 to slot 0. As expected, the column 1 and 2 swap positions.
-        TableColumnHeaderShim.moveColumn(column1, 0);
+        TableColumnHeaderUtil.moveColumn(column1, 0);
         assertEquals(column1, table.getVisibleLeafColumn(0));
         assertEquals(column2, table.getVisibleLeafColumn(1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header1));
         assertEquals(1, TableColumnHeaderShim.getColumnIndex(header2));
 
         // Drag column 4 to slot 1. What? It behaves like it was dragged to slot 0?!
-        TableColumnHeaderShim.moveColumn(column4, 1);
+        TableColumnHeaderUtil.moveColumn(column4, 1);
         assertEquals(column1, table.getVisibleLeafColumn(0));
         assertEquals(column4, table.getVisibleLeafColumn(1));
         assertEquals(column2, table.getVisibleLeafColumn(2));
@@ -3488,21 +3488,21 @@
         // in TableColumnHeader
 
         // Drag column 1 to slot 2. As expected, the column 1 and 2 swap positions
-        TableColumnHeaderShim.moveColumn(column1, 25, 136);
+        TableColumnHeaderUtil.moveColumn(column1, 25, 136);
         assertEquals(column2, table.getVisibleLeafColumn(0));
         assertEquals(column1, table.getVisibleLeafColumn(1));
         assertEquals(1, TableColumnHeaderShim.getColumnIndex(header1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header2));
 
         // Drag column 1 to slot 0. As expected, the column 1 and 2 swap positions.
-        TableColumnHeaderShim.moveColumn(column1, 51, 23);
+        TableColumnHeaderUtil.moveColumn(column1, 51, 23);
         assertEquals(column1, table.getVisibleLeafColumn(0));
         assertEquals(column2, table.getVisibleLeafColumn(1));
         assertEquals(0, TableColumnHeaderShim.getColumnIndex(header1));
         assertEquals(1, TableColumnHeaderShim.getColumnIndex(header2));
 
         // Drag column 4 to slot 1. What? It behaves like it was dragged to slot 0?!
-        TableColumnHeaderShim.moveColumn(column4, 56, 103);
+        TableColumnHeaderUtil.moveColumn(column4, 56, 103);
         assertEquals(column1, table.getVisibleLeafColumn(0));
         assertEquals(column4, table.getVisibleLeafColumn(1));
         assertEquals(column2, table.getVisibleLeafColumn(2));