functional/ControlsTests/test/javafx/scene/control/test/ListView/NewListViewTest.java

Print this page

        

@@ -237,12 +237,10 @@
         selectionHelper = new MultipleSelectionHelper(1, DATA_ITEMS_NUM);
         selectionHelper.setMultiple(true);
 
         requestFocusOnControl(testedControl);
 
-        testedControl.keyboard().pushKey(KeyboardButtons.DOWN);
-
         testedControl.keyboard().pressKey(KeyboardButtons.SHIFT);
         try {
             for (int i = 1; i < 5; i++) {
                 testedControl.keyboard().pushKey(KeyboardButtons.DOWN);
                 selectionHelper.push(KeyboardButtons.DOWN, KeyboardModifiers.SHIFT_DOWN_MASK);

@@ -312,14 +310,14 @@
             checkScrollingState(0, true, false, size, orientation);
         }
     }
 
     private void checkScrollingState(final double scrollValue, boolean beginVisible, boolean endVisible, int size, final Orientation orientation) {
-        //assertEquals(findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true).getControl().getValue(), scrollValue, 0.01);
+        //assertEquals(findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), orientation, true).getControl().getValue(), scrollValue, 0.01);
         testedControl.waitState(new State() {
             public Object reached() {
-                Wrap<? extends ScrollBar> sb = findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true);
+                Wrap<? extends ScrollBar> sb = findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), orientation, true);
                 if (Math.abs(sb.getControl().getValue() - scrollValue) < 0.01) {
                     return true;
                 } else {
                     return null;
                 }

@@ -368,35 +366,35 @@
 
     @Smoke
     @Test(timeout = 300000)
     public void verticalScrollBarBehaviorOnAddingDeletingTest() throws InterruptedException {
         setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 50);
-        assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null);
+        assertFalse(findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null);
         addElements(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
-        assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null);
+        assertFalse(findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null);
         setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 500);
-        assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null);
+        assertFalse(findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null);
         setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 50);
         for (int i = 0; i < 10; i++) {
             removeFromPos(0);
         }
-        assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null);
+        assertFalse(findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null);
     }
 
     //Test//RT-17538//Test removed, as non actual (bug - is not a bug).
     public void steadyScrollingTest() throws InterruptedException {
         setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 150);
 
         addRectangleAtPos(0);
         addTextFieldAtPos(1);
         addRectangleAtPos(2);
 
-        Wrap<? extends ScrollBar> sb = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true);
+        Wrap<? extends ScrollBar> sb = findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true);
         ScrollingChecker sc = new ScrollingChecker(sb.getControl().valueProperty());
         testedControl.mouse().move();
         for (int i = 0; i < 8; i++) {
-            findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1);
+            findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1);
             sc.checkChanging(+1);
         }
     }
 
     @Smoke

@@ -458,12 +456,12 @@
         addRectangleAtPos(0);
         addTextFieldAtPos(1);
 
         setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, Orientation.HORIZONTAL, Properties.orientation);
 
-        checkScreenshot("ListView_scrollBarSize1Test_HorizontalScroll_1", findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true));
-        checkScreenshot("ListView_scrollBarSize1Test_VerticalScroll_1", findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true));
+        checkScreenshot("ListView_scrollBarSize1Test_HorizontalScroll_1", findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true));
+        checkScreenshot("ListView_scrollBarSize1Test_VerticalScroll_1", findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true));
         throwScreenshotError();
     }
 
     @ScreenshotCheck
     @Test(timeout = 300000) //RT-17460

@@ -471,11 +469,11 @@
         setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, Orientation.HORIZONTAL, Properties.orientation);
         setSize(200, 210);
 
         addRectangleAtPos(0);
         addRectangleAtPos(0);
-        checkScreenshot("ListView_HorizontalScroll_2", findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true));
+        checkScreenshot("ListView_HorizontalScroll_2", findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true));
         throwScreenshotError();
     }
 
     @Smoke
     @Test(timeout = 300000) //RT-17462

@@ -485,14 +483,14 @@
 
         addRectangleAtPos(0);
         addRectangleAtPos(0);
 
         for (int i = 0; i < 100; i++) {
-            findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1);
+            findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1);
         }
 
-        assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null);
+        assertFalse(findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null);
     }
 
     @ScreenshotCheck
     @Smoke
     @Test(timeout = 300000)//RT-17465

@@ -515,13 +513,14 @@
     @Test(timeout = 300000)//RT-17705
     public void scrollingConfused1Test() throws InterruptedException, Throwable {
         setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, Orientation.HORIZONTAL, Properties.orientation);
         setSize(150, 150);
         addRectangleAtPos(0);
-        findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+20);
+        int scroll_value = Utils.isMacOS() ? -20 : +20;
+        findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(scroll_value);
 
-        findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+20);
+        findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(scroll_value);
 
         checkScreenshot("ListView_ScrollingIssue_1", testedControl);
         throwScreenshotError();
     }
 

@@ -532,19 +531,19 @@
         setSize(150, 150);
         addRectangleAtPos(0);
         Thread.sleep(500);
 
         for (int i = 0; i < 20; i++) {
-            findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1);
+            findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1);
         }
 
         for (int i = 0; i < 20; i++) {
-            findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1);
+            findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1);
         }
 
         setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, Orientation.HORIZONTAL, Properties.orientation);
-        findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+20);
+        findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+20);
         checkScreenshot("ListView_ScrollingIssue_2", testedControl);
         throwScreenshotError();
     }
 
     @ScreenshotCheck

@@ -552,12 +551,12 @@
     public void scrollingConfused3Test() throws Throwable {
         setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, Orientation.VERTICAL, Properties.orientation);
         setSize(150, 150);
         addRectangleAtPos(0);
 
-        findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+20);
-        findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+20);
+        findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+20);
+        findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+20);
         checkScreenshot("ListView_ScrollingIssue_3", testedControl);
         throwScreenshotError();
     }
 
     @Smoke

@@ -567,17 +566,17 @@
         testedControl.mouse().click();
 
         testedControl.keyboard().pushKey(KeyboardButtons.DOWN);
         testedControl.keyboard().pushKey(KeyboardButtons.DOWN);
 
-        checkListener(Listeners.focusedIndex, 1);
-        addElement("0", 0);
         checkListener(Listeners.focusedIndex, 2);
-        addElement("0", 2);
+        addElement("0", 0);
         checkListener(Listeners.focusedIndex, 3);
+        addElement("0", 2);
+        checkListener(Listeners.focusedIndex, 4);
         addElement("0", 4);
-        checkListener(Listeners.focusedIndex, 3);
+        checkListener(Listeners.focusedIndex, 5);
     }
 
     //Test//RT-17539//Test removed because developers don't count size of content.
     public void knobSizeChangingTest() throws InterruptedException, Throwable {
         setSize(150, 150);

@@ -587,16 +586,16 @@
         addElement("0", 2);
 
         checkScreenshot("ListView_ScrollBarKnobSizeIssue_1", testedControl);
 
         for (int i = 0; i < 20; i++) {
-            findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1);
+            findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1);
         }
 
         checkScreenshot("ListView_ScrollBarKnobSizeIssue_2", testedControl);
 
-        findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+10);
+        findScrollBar((Parent<Node>) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+10);
 
         checkScreenshot("ListView_ScrollBarKnobSizeIssue_3", testedControl);
         throwScreenshotError();
     }
 

@@ -612,16 +611,10 @@
         selectionHelper.setSingleCell(false);
         selectionHelper.setMultiple(false);
 
         requestFocusOnControl(testedControl);
 
-        Thread.sleep(SLEEP);
-
-        testedControl.keyboard().pushKey(KeyboardButtons.DOWN);
-
-        Thread.sleep(SLEEP);
-
         //Testing section
         try {
             for (int i = 0; i < 5; i++) {
                 testedControl.keyboard().pushKey(KeyboardButtons.DOWN, KeyboardModifiers.SHIFT_DOWN_MASK);
                 selectionHelper.push(KeyboardButtons.DOWN, KeyboardModifiers.SHIFT_DOWN_MASK);

@@ -650,22 +643,16 @@
         addElements(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
         setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, SelectionMode.SINGLE, Properties.selectionMode);
         setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, SelectionMode.MULTIPLE, Properties.selectionMode);
         setSize(130, 130);
 
-        selectionHelper = new MultipleSelectionHelper(1, DATA_ITEMS_NUM);
+        selectionHelper = new MultipleSelectionHelper(1, 10);
         selectionHelper.setSingleCell(false);
         selectionHelper.setMultiple(true);
 
         requestFocusOnControl(testedControl);
 
-        Thread.sleep(SLEEP);
-
-        testedControl.keyboard().pushKey(KeyboardButtons.DOWN);
-
-        Thread.sleep(SLEEP);
-
         //Testing section
         try {
             for (int i = 0; i < 2; i++) {
                 testedControl.keyboard().pushKey(KeyboardButtons.DOWN);
                 selectionHelper.push(KeyboardButtons.DOWN);

@@ -731,16 +718,10 @@
         selectionHelper.setSingleCell(false);
         selectionHelper.setMultiple(false);
 
         requestFocusOnControl(testedControl);
 
-        Thread.sleep(SLEEP);
-
-        testedControl.keyboard().pushKey(KeyboardButtons.DOWN);
-
-        Thread.sleep(SLEEP);
-
         //Testing section
         try {
             for (int i = 0; i < 2; i++) {
                 testedControl.keyboard().pushKey(KeyboardButtons.DOWN);
                 selectionHelper.push(KeyboardButtons.DOWN);

@@ -784,16 +765,10 @@
         selectionHelper.setSingleCell(false);
         selectionHelper.setMultiple(true);
 
         requestFocusOnControl(testedControl);
 
-        Thread.sleep(SLEEP);
-
-        testedControl.keyboard().pushKey(KeyboardButtons.DOWN);
-
-        Thread.sleep(SLEEP);
-
         //Testing section
         try {
             for (int i = 0; i < 2; i++) {
                 testedControl.keyboard().pushKey(KeyboardButtons.DOWN);
                 selectionHelper.push(KeyboardButtons.DOWN);

@@ -897,10 +872,11 @@
      */
     public void complexSelectionScreenShotTest() throws InterruptedException, Throwable {
         setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 200);
         setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 200);
         setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, SelectionMode.MULTIPLE, Properties.selectionMode);
+        selectionHelper.setMultiple(true);
         setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, Orientation.HORIZONTAL, Properties.orientation);
 
         final int elementsCount = 50;
         addAndSelectElements(elementsCount);
         final int step = 5;

@@ -908,10 +884,12 @@
         for (Orientation orientation : Orientation.values()) {
             setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, orientation, Properties.orientation);
             Wrap<Text> cellWrap = getCellWrap((Integer) (0)); //mouse will be over the second item.
             cellWrap.as(Showable.class).shower().show();
             cellWrap.mouse().click(1, cellWrap.getClickPoint(), Mouse.MouseButtons.BUTTON1, CTRL_DOWN_MASK_OS);
+            selectionHelper.click(0, 0, KeyboardButtons.CONTROL);
+            checkSelection();
 
             KeyboardButtons lessKey = (orientation == Orientation.HORIZONTAL ? KeyboardButtons.LEFT : KeyboardButtons.UP);
             KeyboardButtons moreKey = (orientation == Orientation.HORIZONTAL ? KeyboardButtons.RIGHT : KeyboardButtons.DOWN);
 
             applyKeysPushing(2, KeyboardButtons.PAGE_DOWN, KeyboardModifiers.SHIFT_DOWN_MASK);