/* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package test.css.controls.api.styles; import javafx.css.CssMetaData; import java.util.Map; import java.util.Set; import javafx.scene.Node; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.scene.chart.*; import javafx.scene.shape.*; import javafx.scene.web.*; import javafx.scene.image.*; import javafx.scene.text.*; import javafx.scene.*; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.jemmy.fx.Root; import org.jemmy.action.GetAction; import client.test.Keywords; import com.sun.javafx.scene.control.skin.*; import javafx.scene.paint.Paint; import javafx.geometry.Insets; import com.sun.javafx.scene.layout.region.RepeatStruct; import com.sun.javafx.scene.layout.region.BorderImageSlices; import org.jemmy.interfaces.Focus; /** * Generation test * @author sergey.lugovoy@oracle.com */ public class StylesNumberAxisTest extends BaseStyleNodeTest { @Override Node getControl() { return new GetAction() { @Override public void run(Object... os) throws Exception { NumberAxis control = new NumberAxis(); setResult(control); } }.dispatch(Root.ROOT.getEnvironment()); } @Test public void testfxbackgroundcolor () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-background-color")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-background-color"); Assert.assertArrayEquals((Paint[])data.getInitialValue(getControl()), new Paint[]{Paint.valueOf("transparent")}); } @Test public void testfxbackgroundimage () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-background-image")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-background-image"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxbackgroundinsets () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-background-insets")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-background-insets"); Assert.assertArrayEquals((Insets[])data.getInitialValue(getControl()), new Insets[]{new Insets(0.0, 0.0, 0.0, 0.0)}); } @Test public void testfxbackgroundposition () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-background-position")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-background-position"); Assert.assertTrue(checkBackgroundPosition((BackgroundPosition[]) data.getInitialValue(getControl()), new BackgroundPosition[]{new BackgroundPosition(javafx.geometry.Side.LEFT,0.0,true,javafx.geometry.Side.TOP,0.0,true)})); } @Test public void testfxbackgroundradius () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-background-radius")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-background-radius"); Assert.assertArrayEquals((CornerRadii[])data.getInitialValue(getControl()), new CornerRadii[]{new CornerRadii(0.0)}); } @Test public void testfxbackgroundrepeat () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-background-repeat")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-background-repeat"); Assert.assertTrue(checkRepeatStruct((RepeatStruct[]) data.getInitialValue(getControl()), new RepeatStruct[]{new RepeatStruct(javafx.scene.layout.BackgroundRepeat.REPEAT,javafx.scene.layout.BackgroundRepeat.REPEAT)})); } @Test public void testfxbackgroundsize () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-background-size")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-background-size"); Assert.assertArrayEquals((BackgroundSize[])data.getInitialValue(getControl()), new BackgroundSize[]{new BackgroundSize(-1.0,-1.0,true,true,false,false)}); } @Test public void testfxblendmode () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-blend-mode")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-blend-mode"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxbordercolor () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-border-color")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-border-color"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxborderimageinsets () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-border-image-insets")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-border-image-insets"); Assert.assertArrayEquals((Insets[])data.getInitialValue(getControl()), new Insets[]{new Insets(0.0, 0.0, 0.0, 0.0)}); } @Test public void testfxborderimagerepeat () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-border-image-repeat")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-border-image-repeat"); Assert.assertTrue(checkRepeatStruct((RepeatStruct[]) data.getInitialValue(getControl()), new RepeatStruct[]{new RepeatStruct(javafx.scene.layout.BackgroundRepeat.REPEAT,javafx.scene.layout.BackgroundRepeat.REPEAT)})); } @Test public void testfxborderimageslice () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-border-image-slice")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-border-image-slice"); Assert.assertTrue(checkBorderImageSlices((BorderImageSlices[]) data.getInitialValue(getControl()), new BorderImageSlices[]{new BorderImageSlices(new BorderWidths(1.0,1.0,1.0,1.0,true,true,true,true),false)})); } @Test public void testfxborderimagesource () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-border-image-source")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-border-image-source"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxborderimagewidth () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-border-image-width")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-border-image-width"); Assert.assertArrayEquals((BorderWidths[])data.getInitialValue(getControl()), DEFAULT_WIDTHS); } @Test public void testfxborderinsets () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-border-insets")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-border-insets"); Assert.assertArrayEquals((Insets[])data.getInitialValue(getControl()), null); } @Test public void testfxborderradius () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-border-radius")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-border-radius"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxborderstyle () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-border-style")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-border-style"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxborderwidth () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-border-width")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-border-width"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxcursor () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-cursor")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-cursor"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxeffect () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-effect")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-effect"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxminortickcount () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-minor-tick-count")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-minor-tick-count"); Assert.assertEquals(data.getInitialValue(getControl()), 5); } @Test public void testfxminorticklength () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-minor-tick-length")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-minor-tick-length"); Assert.assertEquals(data.getInitialValue(getControl()), 5.0); } @Test public void testfxminortickvisible () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-minor-tick-visible")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-minor-tick-visible"); Assert.assertEquals(data.getInitialValue(getControl()), true); } @Test public void testfxopacity () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-opacity")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-opacity"); Assert.assertEquals(data.getInitialValue(getControl()), 1.0); } @Test public void testfxpadding () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-padding")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-padding"); Assert.assertEquals(data.getInitialValue(getControl()), new javafx.geometry.Insets(0.0,0.0,0.0,0.0)); } @Test public void testfxpositionshape () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-position-shape")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-position-shape"); Assert.assertEquals(data.getInitialValue(getControl()), true); } @Test public void testfxregionbackground () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-region-background")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-region-background"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxregionborder () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-region-border")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-region-border"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxrotate () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-rotate")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-rotate"); Assert.assertEquals(data.getInitialValue(getControl()), 0.0); } @Test public void testfxscaleshape () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-scale-shape")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-scale-shape"); Assert.assertEquals(data.getInitialValue(getControl()), true); } @Test public void testfxscalex () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-scale-x")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-scale-x"); Assert.assertEquals(data.getInitialValue(getControl()), 1.0); } @Test public void testfxscaley () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-scale-y")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-scale-y"); Assert.assertEquals(data.getInitialValue(getControl()), 1.0); } @Test public void testfxscalez () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-scale-z")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-scale-z"); Assert.assertEquals(data.getInitialValue(getControl()), 1.0); } @Test public void testfxshape () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-shape")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-shape"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxside () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-side")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-side"); Assert.assertEquals(data.getInitialValue(getControl()), null); } @Test public void testfxsnaptopixel () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-snap-to-pixel")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-snap-to-pixel"); Assert.assertEquals(data.getInitialValue(getControl()), true); } @Test public void testfxticklabelfill () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-tick-label-fill")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-tick-label-fill"); Assert.assertEquals(data.getInitialValue(getControl()), javafx.scene.paint.Color.valueOf("0x000000ff")); } @Test public void testfxticklabelfont () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-tick-label-font")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-tick-label-font"); Assert.assertEquals(data.getInitialValue(getControl()), new Font("System", 8)); } @Test public void testfxticklabelgap () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-tick-label-gap")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-tick-label-gap"); Assert.assertEquals(data.getInitialValue(getControl()), 3.0); } @Test public void testfxticklabelsvisible () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-tick-labels-visible")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-tick-labels-visible"); Assert.assertEquals(data.getInitialValue(getControl()), true); } @Test public void testfxticklength () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-tick-length")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-tick-length"); Assert.assertEquals(data.getInitialValue(getControl()), 8.0); } @Test public void testfxtickmarkvisible () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-tick-mark-visible")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-tick-mark-visible"); Assert.assertEquals(data.getInitialValue(getControl()), true); } @Test public void testfxtickunit () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-tick-unit")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-tick-unit"); Assert.assertEquals(data.getInitialValue(getControl()), 5.0); } @Test public void testfxtranslatex () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-translate-x")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-translate-x"); Assert.assertEquals(data.getInitialValue(getControl()), 0.0); } @Test public void testfxtranslatey () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-translate-y")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-translate-y"); Assert.assertEquals(data.getInitialValue(getControl()), 0.0); } @Test public void testfxtranslatez () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("-fx-translate-z")); Map styles = getStyles(); CssMetaData data = styles.get("-fx-translate-z"); Assert.assertEquals(data.getInitialValue(getControl()), 0.0); } @Test public void testvisibility () { Set styleNames = getStyleNames(); Assert.assertNotNull(styleNames); Assert.assertTrue(styleNames.contains("visibility")); Map styles = getStyles(); CssMetaData data = styles.get("visibility"); Assert.assertEquals(data.getInitialValue(getControl()), true); } }