modules/graphics/src/test/java/test/javafx/stage/WindowTest.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.stage;
  27 
  28 import static junit.framework.Assert.assertEquals;
  29 import static junit.framework.Assert.assertTrue;
  30 import static junit.framework.Assert.assertNotNull;
  31 import javafx.beans.property.DoubleProperty;
  32 import javafx.beans.property.SimpleDoubleProperty;
  33 
  34 import org.junit.Before;
  35 import org.junit.Test;
  36 
  37 import com.sun.javafx.pgstub.StubStage;
  38 import com.sun.javafx.pgstub.StubToolkit;
  39 import com.sun.javafx.tk.TKStage;
  40 import com.sun.javafx.tk.Toolkit;


  41 
  42 public final class WindowTest {
  43     private StubToolkit toolkit;
  44     private Stage testWindow;
  45 
  46     @Before
  47     public void setUp() {
  48         toolkit = (StubToolkit) Toolkit.getToolkit();
  49         testWindow = new Stage();
  50     }
  51 
  52     @Test
  53     public void testOpacityBind() {
  54         final DoubleProperty variable = new SimpleDoubleProperty(0.5);
  55 
  56         testWindow.show();
  57         final StubStage peer = getPeer(testWindow);
  58 
  59         testWindow.opacityProperty().bind(variable);
  60         toolkit.fireTestPulse();




   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.stage;
  27 
  28 import static junit.framework.Assert.assertEquals;
  29 import static junit.framework.Assert.assertTrue;
  30 import static junit.framework.Assert.assertNotNull;
  31 import javafx.beans.property.DoubleProperty;
  32 import javafx.beans.property.SimpleDoubleProperty;
  33 
  34 import org.junit.Before;
  35 import org.junit.Test;
  36 
  37 import test.com.sun.javafx.pgstub.StubStage;
  38 import test.com.sun.javafx.pgstub.StubToolkit;
  39 import com.sun.javafx.tk.TKStage;
  40 import com.sun.javafx.tk.Toolkit;
  41 import javafx.stage.Stage;
  42 import javafx.stage.Window;
  43 
  44 public final class WindowTest {
  45     private StubToolkit toolkit;
  46     private Stage testWindow;
  47 
  48     @Before
  49     public void setUp() {
  50         toolkit = (StubToolkit) Toolkit.getToolkit();
  51         testWindow = new Stage();
  52     }
  53 
  54     @Test
  55     public void testOpacityBind() {
  56         final DoubleProperty variable = new SimpleDoubleProperty(0.5);
  57 
  58         testWindow.show();
  59         final StubStage peer = getPeer(testWindow);
  60 
  61         testWindow.opacityProperty().bind(variable);
  62         toolkit.fireTestPulse();