modules/graphics/src/test/java/test/javafx/scene/layout/RegionPickTest.java

Print this page
rev 9250 : 8134762: Refactor Javafx graphics module tests for clear separation of tests
Reviewed-by:


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  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.layout;
  27 
  28 import java.util.EnumSet;
  29 import javafx.geometry.Insets;








  30 import javafx.scene.paint.Color;
  31 import javafx.scene.shape.Circle;
  32 import org.junit.Before;
  33 import org.junit.Test;
  34 
  35 import static org.junit.Assert.*;
  36 
  37 /**
  38  * Tests for Region picking. By default, Region has pickOnBounds set to true, so picking
  39  * anything within the bounds of the region will return true, anything outside the bounds
  40  * false. However, due to RT-25066, the bounds of a region defined by a shape will be 0x0,
  41  * in which case it will never be picked.
  42  *
  43  * If pickOnBounds is false, then an entire different code path is executed. We don't care
  44  * whether a fill is transparent or not (transparent fills can still cause the region to
  45  * pick), but we do care about picking within the "shape" and picking within the rounded
  46  * rectangle which is created as a result of background fills / background images.
  47  *
  48  * In the case of background images, we don't care about whether we are picking a transparent
  49  * pixel or not, but just based on the insets etc (since we don't have a good means for testing




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  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 test.javafx.scene.layout;
  27 
  28 import java.util.EnumSet;
  29 import javafx.geometry.Insets;
  30 import javafx.scene.layout.Background;
  31 import javafx.scene.layout.BackgroundFill;
  32 import javafx.scene.layout.Border;
  33 import javafx.scene.layout.BorderStroke;
  34 import javafx.scene.layout.BorderStrokeStyle;
  35 import javafx.scene.layout.BorderWidths;
  36 import javafx.scene.layout.CornerRadii;
  37 import javafx.scene.layout.Region;
  38 import javafx.scene.paint.Color;
  39 import javafx.scene.shape.Circle;
  40 import org.junit.Before;
  41 import org.junit.Test;
  42 
  43 import static org.junit.Assert.*;
  44 
  45 /**
  46  * Tests for Region picking. By default, Region has pickOnBounds set to true, so picking
  47  * anything within the bounds of the region will return true, anything outside the bounds
  48  * false. However, due to RT-25066, the bounds of a region defined by a shape will be 0x0,
  49  * in which case it will never be picked.
  50  *
  51  * If pickOnBounds is false, then an entire different code path is executed. We don't care
  52  * whether a fill is transparent or not (transparent fills can still cause the region to
  53  * pick), but we do care about picking within the "shape" and picking within the rounded
  54  * rectangle which is created as a result of background fills / background images.
  55  *
  56  * In the case of background images, we don't care about whether we are picking a transparent
  57  * pixel or not, but just based on the insets etc (since we don't have a good means for testing