modules/graphics/src/test/java/com/sun/javafx/css/Node_cssStateTransition_Test.java

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


   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.css;
  27 

  28 import com.sun.javafx.css.converters.FontConverter;
  29 import com.sun.javafx.css.converters.SizeConverter;
  30 import com.sun.javafx.css.parser.CSSParser;
  31 import com.sun.javafx.tk.Toolkit;
  32 
  33 import java.io.IOException;
  34 import java.util.ArrayList;
  35 import java.util.Collections;
  36 import java.util.HashMap;
  37 import java.util.List;
  38 import java.util.Map;
  39 import javafx.collections.FXCollections;
  40 import javafx.collections.MapChangeListener;
  41 import javafx.css.CssMetaData;
  42 import javafx.css.ParsedValue;
  43 import javafx.css.PseudoClass;
  44 import javafx.css.StyleOrigin;
  45 import javafx.css.Styleable;
  46 import javafx.css.StyleableProperty;
  47 import javafx.scene.Group;
  48 import javafx.scene.Scene;
  49 import javafx.scene.paint.Color;
  50 import javafx.scene.paint.Paint;
  51 import javafx.scene.shape.Rectangle;
  52 import javafx.scene.text.Font;
  53 import javafx.scene.text.Text;
  54 import javafx.stage.Stage;
  55 import static org.junit.Assert.*;
  56 
  57 import org.junit.Ignore;

  58 import org.junit.Test;
  59 
  60 public class Node_cssStateTransition_Test {
  61     



  62     public Node_cssStateTransition_Test() {
  63     }
  64 
  65 
  66     @Test
  67     public void testPropertiesResetOnStyleclassChange() {
  68 
  69         Rectangle rect = new Rectangle(50,50);
  70         Paint defaultFill = rect.getFill();
  71         Paint defaultStroke = rect.getStroke();
  72         Double defaultStrokeWidth = Double.valueOf(rect.getStrokeWidth());
  73 
  74         CssMetaData metaData = ((StyleableProperty)rect.fillProperty()).getCssMetaData();
  75         assertEquals(defaultFill, metaData.getInitialValue(rect));
  76         metaData = ((StyleableProperty)rect.strokeProperty()).getCssMetaData();
  77         assertEquals(defaultStroke, metaData.getInitialValue(rect));
  78         metaData = ((StyleableProperty)rect.strokeWidthProperty()).getCssMetaData();
  79         assertEquals(defaultStrokeWidth, metaData.getInitialValue(rect));
  80 
  81         Stylesheet stylesheet = null;




   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.css;
  27 
  28 import com.sun.javafx.FXUnit;
  29 import com.sun.javafx.css.converters.FontConverter;
  30 import com.sun.javafx.css.converters.SizeConverter;
  31 import com.sun.javafx.css.parser.CSSParser;
  32 import com.sun.javafx.tk.Toolkit;
  33 
  34 import java.io.IOException;
  35 import java.util.ArrayList;
  36 import java.util.Collections;
  37 import java.util.HashMap;
  38 import java.util.List;
  39 import java.util.Map;
  40 import javafx.collections.FXCollections;
  41 import javafx.collections.MapChangeListener;
  42 import javafx.css.CssMetaData;
  43 import javafx.css.ParsedValue;
  44 import javafx.css.PseudoClass;
  45 import javafx.css.StyleOrigin;
  46 import javafx.css.Styleable;
  47 import javafx.css.StyleableProperty;
  48 import javafx.scene.Group;
  49 import javafx.scene.Scene;
  50 import javafx.scene.paint.Color;
  51 import javafx.scene.paint.Paint;
  52 import javafx.scene.shape.Rectangle;
  53 import javafx.scene.text.Font;
  54 import javafx.scene.text.Text;
  55 import javafx.stage.Stage;
  56 import static org.junit.Assert.*;
  57 
  58 import org.junit.Ignore;
  59 import org.junit.Rule;
  60 import org.junit.Test;
  61 
  62 public class Node_cssStateTransition_Test {
  63 
  64     @org.junit.Rule
  65     public FXUnit fx= new FXUnit();
  66 
  67     public Node_cssStateTransition_Test() {
  68     }
  69 
  70 
  71     @Test
  72     public void testPropertiesResetOnStyleclassChange() {
  73 
  74         Rectangle rect = new Rectangle(50,50);
  75         Paint defaultFill = rect.getFill();
  76         Paint defaultStroke = rect.getStroke();
  77         Double defaultStrokeWidth = Double.valueOf(rect.getStrokeWidth());
  78 
  79         CssMetaData metaData = ((StyleableProperty)rect.fillProperty()).getCssMetaData();
  80         assertEquals(defaultFill, metaData.getInitialValue(rect));
  81         metaData = ((StyleableProperty)rect.strokeProperty()).getCssMetaData();
  82         assertEquals(defaultStroke, metaData.getInitialValue(rect));
  83         metaData = ((StyleableProperty)rect.strokeWidthProperty()).getCssMetaData();
  84         assertEquals(defaultStrokeWidth, metaData.getInitialValue(rect));
  85 
  86         Stylesheet stylesheet = null;