modules/graphics/src/test/java/test/javafx/scene/ImageCursorTest.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;
  27 
  28 import static javafx.scene.image.TestImages.TEST_IMAGE_0x100;
  29 import static javafx.scene.image.TestImages.TEST_IMAGE_100x0;
  30 import static javafx.scene.image.TestImages.TEST_IMAGE_100x200;
  31 import static javafx.scene.image.TestImages.TEST_IMAGE_200x100;
  32 import static javafx.scene.image.TestImages.TEST_IMAGE_32x32;
  33 import static org.junit.Assert.assertEquals;
  34 import static org.junit.Assert.assertSame;
  35 
  36 import javafx.beans.InvalidationListener;
  37 import javafx.beans.Observable;
  38 import javafx.geometry.Dimension2D;
  39 import javafx.scene.image.Image;
  40 import javafx.scene.image.TestImages;
  41 
  42 import org.junit.AfterClass;
  43 import org.junit.BeforeClass;
  44 import org.junit.Test;
  45 
  46 import com.sun.javafx.pgstub.CursorSizeConverter;
  47 import com.sun.javafx.pgstub.StubAsyncImageLoader;
  48 import com.sun.javafx.pgstub.StubImageLoaderFactory;
  49 import com.sun.javafx.pgstub.StubPlatformImageInfo;
  50 import com.sun.javafx.pgstub.StubToolkit;
  51 import com.sun.javafx.test.PropertyInvalidationCounter;
  52 import com.sun.javafx.tk.Toolkit;

  53 
  54 public final class ImageCursorTest {
  55     private static StubToolkit toolkit;
  56 
  57     private static CursorSizeConverter oldCursorSizeConverter;
  58     private static int oldMaximumCursorColors;
  59 
  60     @BeforeClass
  61     public static void setUpClass() {
  62         toolkit = (StubToolkit) Toolkit.getToolkit();
  63 
  64         oldCursorSizeConverter = toolkit.getCursorSizeConverter();
  65         oldMaximumCursorColors = toolkit.getMaximumCursorColors();
  66     }
  67 
  68     @AfterClass
  69     public static void tearDownClass() {
  70         toolkit.setCursorSizeConverter(oldCursorSizeConverter);
  71         toolkit.setMaximumCursorColors(oldMaximumCursorColors);
  72     }




   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;
  27 
  28 import static test.javafx.scene.image.TestImages.TEST_IMAGE_0x100;
  29 import static test.javafx.scene.image.TestImages.TEST_IMAGE_100x0;
  30 import static test.javafx.scene.image.TestImages.TEST_IMAGE_100x200;
  31 import static test.javafx.scene.image.TestImages.TEST_IMAGE_200x100;
  32 import static test.javafx.scene.image.TestImages.TEST_IMAGE_32x32;
  33 import static org.junit.Assert.assertEquals;
  34 import static org.junit.Assert.assertSame;
  35 
  36 import javafx.beans.InvalidationListener;
  37 import javafx.beans.Observable;
  38 import javafx.geometry.Dimension2D;
  39 import javafx.scene.image.Image;
  40 import test.javafx.scene.image.TestImages;
  41 
  42 import org.junit.AfterClass;
  43 import org.junit.BeforeClass;
  44 import org.junit.Test;
  45 
  46 import test.com.sun.javafx.pgstub.CursorSizeConverter;
  47 import test.com.sun.javafx.pgstub.StubAsyncImageLoader;
  48 import test.com.sun.javafx.pgstub.StubImageLoaderFactory;
  49 import test.com.sun.javafx.pgstub.StubPlatformImageInfo;
  50 import test.com.sun.javafx.pgstub.StubToolkit;
  51 import test.com.sun.javafx.test.PropertyInvalidationCounter;
  52 import com.sun.javafx.tk.Toolkit;
  53 import javafx.scene.ImageCursor;
  54 
  55 public final class ImageCursorTest {
  56     private static StubToolkit toolkit;
  57 
  58     private static CursorSizeConverter oldCursorSizeConverter;
  59     private static int oldMaximumCursorColors;
  60 
  61     @BeforeClass
  62     public static void setUpClass() {
  63         toolkit = (StubToolkit) Toolkit.getToolkit();
  64 
  65         oldCursorSizeConverter = toolkit.getCursorSizeConverter();
  66         oldMaximumCursorColors = toolkit.getMaximumCursorColors();
  67     }
  68 
  69     @AfterClass
  70     public static void tearDownClass() {
  71         toolkit.setCursorSizeConverter(oldCursorSizeConverter);
  72         toolkit.setMaximumCursorColors(oldMaximumCursorColors);
  73     }