modules/controls/src/test/java/com/sun/javafx/scene/control/LabeledImplTestOther.java

Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization


   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 com.sun.javafx.scene.control.skin;
  27 
  28 import javafx.css.StyleConverter;
  29 import javafx.css.CssMetaData;
  30 import java.net.URL;
  31 import java.util.ArrayList;
  32 
  33 import java.util.Arrays;
  34 import java.util.Collection;
  35 import java.util.List;
  36 import javafx.beans.value.WritableValue;
  37 import javafx.geometry.Insets;
  38 import javafx.geometry.Pos;
  39 import javafx.scene.Cursor;
  40 import javafx.scene.Scene;
  41 import javafx.scene.control.*;
  42 import javafx.scene.effect.BlendMode;


  43 import javafx.scene.image.Image;
  44 import javafx.scene.image.ImageView;
  45 import javafx.scene.layout.VBox;
  46 import javafx.scene.paint.Color;
  47 import javafx.scene.text.Font;
  48 import javafx.scene.text.TextAlignment;
  49 import javafx.stage.Stage;
  50 import javax.swing.GroupLayout;
  51 
  52 import org.junit.runner.RunWith;
  53 import org.junit.runners.Parameterized;
  54 import org.junit.runners.Parameterized.Parameters;
  55 
  56 import org.junit.Before;
  57 import org.junit.Ignore;
  58 import org.junit.Test;
  59 import static org.junit.Assert.*;
  60 
  61 public class LabeledImplTestOther {
  62     
  63     
  64     @Test public void test_RT_21357() {
  65         
  66         final Labeled labeled = new Label("label");
  67         final LabeledImpl labeledImpl = new LabeledImpl(labeled);
  68         
  69         URL url = LabeledSkinBase.class.getResource("caspian/center-btn.png");
  70         Image img = new Image(url.toExternalForm());
  71         assertNotNull(img);
  72         
  73         ImageView iView = new ImageView(img);
  74         labeled.setGraphic(iView);  
  75         
  76         assertEquals(labeled.getGraphic(), labeledImpl.getGraphic());
  77         assertNotNull(labeled.getGraphic());
  78     }
  79 
  80     @Test public void test_RT_21617() {
  81         
  82         MenuButton mb = new MenuButton();
  83         mb.setText("SomeText"); 
  84         MenuButtonSkin mbs = new MenuButtonSkin(mb);
  85         mb.setSkin(mbs);
  86          
  87         mb.setTranslateX(100);mb.setTranslateY(100); 
  88         
  89         Scene scene = new Scene(mb, 300, 300); 


   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 com.sun.javafx.scene.control;
  27 
  28 import com.sun.javafx.scene.control.LabeledImpl;
  29 import com.sun.javafx.scene.control.skin.Utils;










  30 import javafx.scene.Scene;
  31 import javafx.scene.control.Label;
  32 import javafx.scene.control.Labeled;
  33 import javafx.scene.control.MenuButton;
  34 import javafx.scene.control.skin.MenuButtonSkin;
  35 import javafx.scene.image.Image;
  36 import javafx.scene.image.ImageView;




  37 import javafx.stage.Stage;
  38 import org.junit.Test;
  39 
  40 import java.net.URL;


  41 
  42 import static org.junit.Assert.assertEquals;
  43 import static org.junit.Assert.assertNotNull;


  44 
  45 public class LabeledImplTestOther {
  46     
  47     
  48     @Test public void test_RT_21357() {
  49         
  50         final Labeled labeled = new Label("label");
  51         final LabeledImpl labeledImpl = new LabeledImpl(labeled);
  52         
  53         URL url = Utils.class.getResource("caspian/center-btn.png");
  54         Image img = new Image(url.toExternalForm());
  55         assertNotNull(img);
  56         
  57         ImageView iView = new ImageView(img);
  58         labeled.setGraphic(iView);  
  59         
  60         assertEquals(labeled.getGraphic(), labeledImpl.getGraphic());
  61         assertNotNull(labeled.getGraphic());
  62     }
  63 
  64     @Test public void test_RT_21617() {
  65         
  66         MenuButton mb = new MenuButton();
  67         mb.setText("SomeText"); 
  68         MenuButtonSkin mbs = new MenuButtonSkin(mb);
  69         mb.setSkin(mbs);
  70          
  71         mb.setTranslateX(100);mb.setTranslateY(100); 
  72         
  73         Scene scene = new Scene(mb, 300, 300);