modules/controls/src/test/java/com/sun/javafx/scene/control/skin/VirtualFlowTest.java

Print this page
rev 8393 : RT-39035: [TableView] TableView vertical mouse wheel scrolling does not go to the bottom (screen at a time or fast wheel setting)

@@ -986,10 +986,70 @@
             assertTrue(Integer.toString(count), count <= 100);
         });
         flow.addTrailingCells(true);
     }
 
+    private int rt36556_instanceCount;
+    @Test
+    public void test_rt36556() {
+        rt36556_instanceCount = 0;
+        flow = new VirtualFlow();
+        flow.setVertical(true);
+        flow.setCreateCell(p -> {
+            rt36556_instanceCount++;
+            return new CellStub(flow);
+        });
+        flow.setCellCount(100);
+        flow.resize(300, 300);
+        pulse();
+        final int cellCountAtStart = rt36556_instanceCount;
+        flow.adjustPixels(10000);
+        pulse();
+        assertEquals(cellCountAtStart, rt36556_instanceCount);
+        assertNull(flow.getVisibleCell(0));
+        assertMinimalNumberOfCellsAreUsed(flow);
+    }
+
+    @Test
+    public void test_rt36556_scrollto() {
+        rt36556_instanceCount = 0;
+        flow = new VirtualFlow();
+        flow.setVertical(true);
+        flow.setCreateCell(p -> {
+            rt36556_instanceCount++;
+            return new CellStub(flow);
+        });
+        flow.setCellCount(100);
+        flow.resize(300, 300);
+        pulse();
+        final int cellCountAtStart = rt36556_instanceCount;
+        flow.scrollTo(80);
+        pulse();
+        assertEquals(cellCountAtStart, rt36556_instanceCount);
+        assertNull(flow.getVisibleCell(0));
+        assertMinimalNumberOfCellsAreUsed(flow);
+    }
+    
+    @Test
+    public void test_RT39035() {
+        flow.adjustPixels(250);
+        pulse();
+        flow.adjustPixels(500);
+        pulse();
+        assertTrue(flow.getPosition() < 1.0);
+        assertMinimalNumberOfCellsAreUsed(flow);
+    }
+
+    @Test
+    public void test_RT37421() {
+        flow.setPosition(0.98);
+        pulse();
+        flow.adjustPixels(100);
+        pulse();
+        assertEquals(1.0, flow.getPosition(), 0.0);
+        assertMinimalNumberOfCellsAreUsed(flow);
+    }
 }
 
 class CellStub extends IndexedCell {
     String s;
     VirtualFlow flow;