modules/graphics/src/test/java/javafx/scene/PickAndContainsTest.java

Print this page
rev 6167 : RT-35330 [Monocle] Remove StubToolkit and replace it with headless glass implementation


  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene;
  27 
  28 import static org.junit.Assert.assertFalse;
  29 import static org.junit.Assert.assertNull;
  30 import static org.junit.Assert.assertSame;
  31 import static org.junit.Assert.assertTrue;


  32 import javafx.scene.shape.Circle;
  33 import javafx.scene.shape.Rectangle;
  34 

  35 import org.junit.Test;
  36 
  37 /**
  38  * Tests various aspects of Picking.
  39  *
  40  */
  41 public class PickAndContainsTest {
  42 



  43     /***************************************************************************
  44      *                                                                         *
  45      *                              Picking Tests                              *
  46      *                                                                         *
  47      **************************************************************************/
  48     @Test
  49     public void testScenePickingRect() {
  50         Rectangle rect = new Rectangle(50, 25, 100, 50);
  51         Group g = new Group();
  52         g.getChildren().add(rect);
  53         Scene scene = new Scene(g);
  54 
  55         assertSame(rect, scene.test_pick(100, 50));
  56         assertNull(scene.test_pick(0, 0));
  57         assertNull(scene.test_pick(160, 50));
  58     }
  59 
  60     @Test
  61     public void testScenePickingCircle() {
  62         Circle circle = new Circle(60, 60, 50);




  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene;
  27 
  28 import static org.junit.Assert.assertFalse;
  29 import static org.junit.Assert.assertNull;
  30 import static org.junit.Assert.assertSame;
  31 import static org.junit.Assert.assertTrue;
  32 
  33 import com.sun.javafx.FXUnit;
  34 import javafx.scene.shape.Circle;
  35 import javafx.scene.shape.Rectangle;
  36 
  37 import org.junit.Rule;
  38 import org.junit.Test;
  39 
  40 /**
  41  * Tests various aspects of Picking.
  42  *
  43  */
  44 public class PickAndContainsTest {
  45 
  46     @Rule
  47     public FXUnit fx = new FXUnit();
  48 
  49     /***************************************************************************
  50      *                                                                         *
  51      *                              Picking Tests                              *
  52      *                                                                         *
  53      **************************************************************************/
  54     @Test
  55     public void testScenePickingRect() {
  56         Rectangle rect = new Rectangle(50, 25, 100, 50);
  57         Group g = new Group();
  58         g.getChildren().add(rect);
  59         Scene scene = new Scene(g);
  60 
  61         assertSame(rect, scene.test_pick(100, 50));
  62         assertNull(scene.test_pick(0, 0));
  63         assertNull(scene.test_pick(160, 50));
  64     }
  65 
  66     @Test
  67     public void testScenePickingCircle() {
  68         Circle circle = new Circle(60, 60, 50);