modules/graphics/src/test/java/com/sun/javafx/scene/layout/RegionTest.java

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


  62 //
  63 //         Paint[] expectedColors = new Paint[] {
  64 //            Color.web("#ff0000"),
  65 //            Color.web("#00ff00"),
  66 //            Color.web("#0000ff")
  67 //         };
  68 //
  69 //        Insets[] expectedInsets = {
  70 //            new Insets(-1,-1,-1,-1),
  71 //            new Insets(0,0,0,0),
  72 //            new Insets(1,1,1,1),
  73 //        };
  74 //
  75 //        Insets[] expectedRadii = {
  76 //            new Insets(-1,-1,-1,-1),
  77 //            new Insets(0,0,0,0),
  78 //            new Insets(1,1,1,1),
  79 //        };
  80 //
  81 //
  82 //        Stylesheet stylesheet = CSSParser.getInstance().parse(
  83 //                    "* { " +
  84 //                        "-fx-background-color: #ff0000, #00ff00, #0000ff;" +
  85 //                        "-fx-background-radius: -1, 0, 1; " +
  86 //                        "-fx-background-insets: -1, 0, 1; " +
  87 //                    "}");
  88 //
  89 //        Map<CSSProperty,Object> keyValues = new HashMap<CSSProperty,Object>();
  90 //
  91 //        ParsedValue cssColorValue = getValueFor(stylesheet, "-fx-background-color");
  92 //        CSSProperty cssColorProperty = getCssMetaDataByName("-fx-background-color", BackgroundFill.getClassCssMetaData());
  93 //        Object value = cssColorProperty.getConverter().convert(cssColorValue,Font.getDefault());
  94 //        assertTrue(value instanceof Paint[]);
  95 //        Paint[] cssPaints = (Paint[])value;
  96 //        keyValues.put(cssColorProperty, cssPaints);
  97 //
  98 //        ParsedValue cssRadiusValue = getValueFor(stylesheet, "-fx-background-radius");
  99 //        CSSProperty cssRadiusProperty = getCssMetaDataByName("-fx-background-radius", BackgroundFill.getClassCssMetaData());
 100 //        value = cssRadiusProperty.getConverter().convert(cssRadiusValue,Font.getDefault());
 101 //        assertTrue(value instanceof Insets[]);
 102 //        keyValues.put(cssRadiusProperty, (Insets[])value);


 165 //                10.0,
 166 //                0.0,
 167 //                new double[] { 5.0, 3.0 }
 168 //        );
 169 //
 170 //        BorderStyle dotted = new BorderStyle(
 171 //                StrokeType.CENTERED,
 172 //                StrokeLineJoin.MITER,
 173 //                StrokeLineCap.BUTT,
 174 //                10.0,
 175 //                0.0,
 176 //                new double[] { 1.0f, 3.0f }
 177 //        );
 178 //
 179 //        BorderStyle[][] expectedBorderStyles = {
 180 //            {dashed, dotted, BorderStyle.SOLID, BorderStyle.NONE},
 181 //            {dashed, dotted, BorderStyle.SOLID, BorderStyle.NONE},
 182 //            {dashed, dotted, BorderStyle.SOLID, BorderStyle.NONE},
 183 //        };
 184 //
 185 //        Stylesheet stylesheet = CSSParser.getInstance().parse(
 186 //                    "* { " +
 187 //                        "-fx-border-color: red, " +
 188 //                            "yellow blue green red," +
 189 //                            "#d0d0d0 #0d0d0d;" +
 190 //                        "-fx-border-width: 1 2 3 4; " +
 191 //                        "-fx-border-radius: 5, 1 2; " +
 192 //                        "-fx-border-insets: -1, 0, 1;" +
 193 //                        "-fx-border-style: dashed dotted solid none;" +
 194 //                    "}");
 195 //
 196 //        Map<CSSProperty,Object> keyValues = new HashMap<CSSProperty,Object>();
 197 //        ParsedValue cssColorValue = getValueFor(stylesheet, "-fx-border-color");
 198 //        CSSProperty cssColorProperty = getCssMetaDataByName("-fx-border-color", StrokeBorder.getClassCssMetaData());
 199 //        Object value = cssColorProperty.getConverter().convert(cssColorValue,Font.getDefault());
 200 //        assertTrue(value instanceof Paint[][]);
 201 //        Paint[][] cssPaints = (Paint[][])value;
 202 //        keyValues.put(cssColorProperty, cssPaints);
 203 //
 204 //        ParsedValue cssInsetsValue = getValueFor(stylesheet, "-fx-border-insets");
 205 //        CSSProperty cssInsetsProperty = getCssMetaDataByName("-fx-border-insets", StrokeBorder.getClassCssMetaData());


 269 //         String[] expectedUrls = new String[] {
 270 //            "http://sipi.usc.edu/database/misc/4.2.04.tiff",
 271 //            Region.class.getResource("../image/doc-files/imageview.png").toExternalForm()
 272 //         };
 273 //
 274 //        RepeatStruct[] expectedRepeats = {
 275 //            new RepeatStruct(BackgroundRepeat.REPEAT,BackgroundRepeat.NO_REPEAT),
 276 //            new RepeatStruct(BackgroundRepeat.NO_REPEAT,BackgroundRepeat.NO_REPEAT),
 277 //        };
 278 //
 279 //        BackgroundPosition[] expectedPositions = {
 280 //            new BackgroundPosition(0.5f,0.3f,0f,0f,true, true),
 281 //            new BackgroundPosition(0f,0f,0.1f,0.2f,true, true),
 282 //        };
 283 //
 284 //        BackgroundSize[] expectedSizes = {
 285 //            BackgroundSize.AUTO_SIZE,
 286 //            BackgroundSize.COVER,
 287 //        };
 288 //
 289 //        Stylesheet stylesheet = CSSParser.getInstance().parse(
 290 //                    "* { " +
 291 //                        "-fx-background-image: url(\"http://sipi.usc.edu/database/misc/4.2.04.tiff\"), url(\"javafx/scene/image/doc-files/imageview.png\");" +
 292 //                        "-fx-background-repeat: repeat no-repeat, no-repeat;" +
 293 //                        "-fx-background-position: right 30% center, left 20% bottom 10%; " +
 294 //                        "-fx-background-size: AUTO, cover; " +
 295 //                    "}");
 296 //
 297 //        Map<CSSProperty,Object> keyValues = new HashMap<CSSProperty,Object>();
 298 //
 299 //        ParsedValue cssBackgroundImageValue = getValueFor(stylesheet, "-fx-background-image");
 300 //        CSSProperty cssBackgroundImageProperty = getCssMetaDataByName("-fx-background-image", BackgroundImage.getClassCssMetaData());
 301 //        Object value = cssBackgroundImageProperty.getConverter().convert(cssBackgroundImageValue,Font.getDefault());
 302 //        assertTrue(value instanceof String[]);
 303 //        String[] cssBackgroundImages = (String[])value;
 304 //        keyValues.put(cssBackgroundImageProperty, cssBackgroundImages);
 305 //
 306 //        ParsedValue cssBackgroundRepeatValue = getValueFor(stylesheet, "-fx-background-repeat");
 307 //        CSSProperty cssBackgroundRepeatProperty = getCssMetaDataByName("-fx-background-repeat", BackgroundImage.getClassCssMetaData());
 308 //        value = cssBackgroundRepeatProperty.getConverter().convert(cssBackgroundRepeatValue,Font.getDefault());
 309 //        assertTrue(value instanceof RepeatStruct[]);


 376 //        BorderImageRepeat[] expectedRepeats = {
 377 //            new BorderImageRepeat(BackgroundRepeat.REPEAT,BackgroundRepeat.NO_REPEAT),
 378 //            new BorderImageRepeat(BackgroundRepeat.NO_REPEAT,BackgroundRepeat.NO_REPEAT)
 379 //        };
 380 //
 381 //        BorderImageSlices[] expectedSlices = {
 382 //            new BorderImageSlices(0.3f, 0.2f, 0.3f,   0.2f,   true, true),
 383 //            new BorderImageSlices(0f,   0f,   10f, 10f, false, false)
 384 //        };
 385 //
 386 //        Margins[] expectedWidths = {
 387 //            new Margins(.05f, .05f, .05f, .05f, true),
 388 //            new Margins(10f, 10f, 10f, 10f, false)
 389 //        };
 390 //
 391 //        Insets[] expectedInsets = {
 392 //            new Insets(-1f, -1f, -1f, -1f),
 393 //            new Insets(1f, 1f, 1f, 1f)
 394 //        };
 395 //
 396 //        Stylesheet stylesheet = CSSParser.getInstance().parse(
 397 //                    "* { " +
 398 ////                        "-fx-border-image-source: url(\"http://sipi.usc.edu/database/misc/4.2.04.tiff\"), url(\"scenic-view.png\");" +
 399 //                        "-fx-border-image-source: url(\"http://sipi.usc.edu/database/misc/4.2.04.tiff\"), url(\"http://sipi.usc.edu/database/misc/4.2.03.tiff\");" +
 400 //                        "-fx-border-image-repeat: repeat no-repeat, no-repeat;" +
 401 //                        "-fx-border-image-slice: 30% 20% fill, 0 0 10 10; " +
 402 //                        "-fx-border-image-width: 5%, 10; " +
 403 //                        "-fx-border-image-insets: -1, 1; " +
 404 //                    "}");
 405 //
 406 //        Map<CSSProperty,Object> keyValues = new HashMap<CSSProperty,Object>();
 407 //
 408 //        ParsedValue cssImageBorderValue = getValueFor(stylesheet, "-fx-border-image-source");
 409 //        CSSProperty cssImageBorderProperty = getCssMetaDataByName("-fx-border-image-source", BorderImage.getClassCssMetaData());
 410 //        Object value = cssImageBorderProperty.getConverter().convert(cssImageBorderValue,Font.getDefault());
 411 //        assertTrue(value instanceof String[]);
 412 //        String[] cssImageBorders = (String[])value;
 413 //        keyValues.put(cssImageBorderProperty,cssImageBorders);
 414 //
 415 //        ParsedValue cssImageRepeatValue = getValueFor(stylesheet, "-fx-border-image-repeat");
 416 //        CSSProperty cssImageRepeatProperty = getCssMetaDataByName("-fx-border-image-repeat", BorderImage.getClassCssMetaData());




  62 //
  63 //         Paint[] expectedColors = new Paint[] {
  64 //            Color.web("#ff0000"),
  65 //            Color.web("#00ff00"),
  66 //            Color.web("#0000ff")
  67 //         };
  68 //
  69 //        Insets[] expectedInsets = {
  70 //            new Insets(-1,-1,-1,-1),
  71 //            new Insets(0,0,0,0),
  72 //            new Insets(1,1,1,1),
  73 //        };
  74 //
  75 //        Insets[] expectedRadii = {
  76 //            new Insets(-1,-1,-1,-1),
  77 //            new Insets(0,0,0,0),
  78 //            new Insets(1,1,1,1),
  79 //        };
  80 //
  81 //
  82 //        Stylesheet stylesheet = new CssParser().parse(
  83 //                    "* { " +
  84 //                        "-fx-background-color: #ff0000, #00ff00, #0000ff;" +
  85 //                        "-fx-background-radius: -1, 0, 1; " +
  86 //                        "-fx-background-insets: -1, 0, 1; " +
  87 //                    "}");
  88 //
  89 //        Map<CSSProperty,Object> keyValues = new HashMap<CSSProperty,Object>();
  90 //
  91 //        ParsedValue cssColorValue = getValueFor(stylesheet, "-fx-background-color");
  92 //        CSSProperty cssColorProperty = getCssMetaDataByName("-fx-background-color", BackgroundFill.getClassCssMetaData());
  93 //        Object value = cssColorProperty.getConverter().convert(cssColorValue,Font.getDefault());
  94 //        assertTrue(value instanceof Paint[]);
  95 //        Paint[] cssPaints = (Paint[])value;
  96 //        keyValues.put(cssColorProperty, cssPaints);
  97 //
  98 //        ParsedValue cssRadiusValue = getValueFor(stylesheet, "-fx-background-radius");
  99 //        CSSProperty cssRadiusProperty = getCssMetaDataByName("-fx-background-radius", BackgroundFill.getClassCssMetaData());
 100 //        value = cssRadiusProperty.getConverter().convert(cssRadiusValue,Font.getDefault());
 101 //        assertTrue(value instanceof Insets[]);
 102 //        keyValues.put(cssRadiusProperty, (Insets[])value);


 165 //                10.0,
 166 //                0.0,
 167 //                new double[] { 5.0, 3.0 }
 168 //        );
 169 //
 170 //        BorderStyle dotted = new BorderStyle(
 171 //                StrokeType.CENTERED,
 172 //                StrokeLineJoin.MITER,
 173 //                StrokeLineCap.BUTT,
 174 //                10.0,
 175 //                0.0,
 176 //                new double[] { 1.0f, 3.0f }
 177 //        );
 178 //
 179 //        BorderStyle[][] expectedBorderStyles = {
 180 //            {dashed, dotted, BorderStyle.SOLID, BorderStyle.NONE},
 181 //            {dashed, dotted, BorderStyle.SOLID, BorderStyle.NONE},
 182 //            {dashed, dotted, BorderStyle.SOLID, BorderStyle.NONE},
 183 //        };
 184 //
 185 //        Stylesheet stylesheet = new CssParser().parse(
 186 //                    "* { " +
 187 //                        "-fx-border-color: red, " +
 188 //                            "yellow blue green red," +
 189 //                            "#d0d0d0 #0d0d0d;" +
 190 //                        "-fx-border-width: 1 2 3 4; " +
 191 //                        "-fx-border-radius: 5, 1 2; " +
 192 //                        "-fx-border-insets: -1, 0, 1;" +
 193 //                        "-fx-border-style: dashed dotted solid none;" +
 194 //                    "}");
 195 //
 196 //        Map<CSSProperty,Object> keyValues = new HashMap<CSSProperty,Object>();
 197 //        ParsedValue cssColorValue = getValueFor(stylesheet, "-fx-border-color");
 198 //        CSSProperty cssColorProperty = getCssMetaDataByName("-fx-border-color", StrokeBorder.getClassCssMetaData());
 199 //        Object value = cssColorProperty.getConverter().convert(cssColorValue,Font.getDefault());
 200 //        assertTrue(value instanceof Paint[][]);
 201 //        Paint[][] cssPaints = (Paint[][])value;
 202 //        keyValues.put(cssColorProperty, cssPaints);
 203 //
 204 //        ParsedValue cssInsetsValue = getValueFor(stylesheet, "-fx-border-insets");
 205 //        CSSProperty cssInsetsProperty = getCssMetaDataByName("-fx-border-insets", StrokeBorder.getClassCssMetaData());


 269 //         String[] expectedUrls = new String[] {
 270 //            "http://sipi.usc.edu/database/misc/4.2.04.tiff",
 271 //            Region.class.getResource("../image/doc-files/imageview.png").toExternalForm()
 272 //         };
 273 //
 274 //        RepeatStruct[] expectedRepeats = {
 275 //            new RepeatStruct(BackgroundRepeat.REPEAT,BackgroundRepeat.NO_REPEAT),
 276 //            new RepeatStruct(BackgroundRepeat.NO_REPEAT,BackgroundRepeat.NO_REPEAT),
 277 //        };
 278 //
 279 //        BackgroundPosition[] expectedPositions = {
 280 //            new BackgroundPosition(0.5f,0.3f,0f,0f,true, true),
 281 //            new BackgroundPosition(0f,0f,0.1f,0.2f,true, true),
 282 //        };
 283 //
 284 //        BackgroundSize[] expectedSizes = {
 285 //            BackgroundSize.AUTO_SIZE,
 286 //            BackgroundSize.COVER,
 287 //        };
 288 //
 289 //        Stylesheet stylesheet = new CssParser().parse(
 290 //                    "* { " +
 291 //                        "-fx-background-image: url(\"http://sipi.usc.edu/database/misc/4.2.04.tiff\"), url(\"javafx/scene/image/doc-files/imageview.png\");" +
 292 //                        "-fx-background-repeat: repeat no-repeat, no-repeat;" +
 293 //                        "-fx-background-position: right 30% center, left 20% bottom 10%; " +
 294 //                        "-fx-background-size: AUTO, cover; " +
 295 //                    "}");
 296 //
 297 //        Map<CSSProperty,Object> keyValues = new HashMap<CSSProperty,Object>();
 298 //
 299 //        ParsedValue cssBackgroundImageValue = getValueFor(stylesheet, "-fx-background-image");
 300 //        CSSProperty cssBackgroundImageProperty = getCssMetaDataByName("-fx-background-image", BackgroundImage.getClassCssMetaData());
 301 //        Object value = cssBackgroundImageProperty.getConverter().convert(cssBackgroundImageValue,Font.getDefault());
 302 //        assertTrue(value instanceof String[]);
 303 //        String[] cssBackgroundImages = (String[])value;
 304 //        keyValues.put(cssBackgroundImageProperty, cssBackgroundImages);
 305 //
 306 //        ParsedValue cssBackgroundRepeatValue = getValueFor(stylesheet, "-fx-background-repeat");
 307 //        CSSProperty cssBackgroundRepeatProperty = getCssMetaDataByName("-fx-background-repeat", BackgroundImage.getClassCssMetaData());
 308 //        value = cssBackgroundRepeatProperty.getConverter().convert(cssBackgroundRepeatValue,Font.getDefault());
 309 //        assertTrue(value instanceof RepeatStruct[]);


 376 //        BorderImageRepeat[] expectedRepeats = {
 377 //            new BorderImageRepeat(BackgroundRepeat.REPEAT,BackgroundRepeat.NO_REPEAT),
 378 //            new BorderImageRepeat(BackgroundRepeat.NO_REPEAT,BackgroundRepeat.NO_REPEAT)
 379 //        };
 380 //
 381 //        BorderImageSlices[] expectedSlices = {
 382 //            new BorderImageSlices(0.3f, 0.2f, 0.3f,   0.2f,   true, true),
 383 //            new BorderImageSlices(0f,   0f,   10f, 10f, false, false)
 384 //        };
 385 //
 386 //        Margins[] expectedWidths = {
 387 //            new Margins(.05f, .05f, .05f, .05f, true),
 388 //            new Margins(10f, 10f, 10f, 10f, false)
 389 //        };
 390 //
 391 //        Insets[] expectedInsets = {
 392 //            new Insets(-1f, -1f, -1f, -1f),
 393 //            new Insets(1f, 1f, 1f, 1f)
 394 //        };
 395 //
 396 //        Stylesheet stylesheet = new CssParser().parse(
 397 //                    "* { " +
 398 ////                        "-fx-border-image-source: url(\"http://sipi.usc.edu/database/misc/4.2.04.tiff\"), url(\"scenic-view.png\");" +
 399 //                        "-fx-border-image-source: url(\"http://sipi.usc.edu/database/misc/4.2.04.tiff\"), url(\"http://sipi.usc.edu/database/misc/4.2.03.tiff\");" +
 400 //                        "-fx-border-image-repeat: repeat no-repeat, no-repeat;" +
 401 //                        "-fx-border-image-slice: 30% 20% fill, 0 0 10 10; " +
 402 //                        "-fx-border-image-width: 5%, 10; " +
 403 //                        "-fx-border-image-insets: -1, 1; " +
 404 //                    "}");
 405 //
 406 //        Map<CSSProperty,Object> keyValues = new HashMap<CSSProperty,Object>();
 407 //
 408 //        ParsedValue cssImageBorderValue = getValueFor(stylesheet, "-fx-border-image-source");
 409 //        CSSProperty cssImageBorderProperty = getCssMetaDataByName("-fx-border-image-source", BorderImage.getClassCssMetaData());
 410 //        Object value = cssImageBorderProperty.getConverter().convert(cssImageBorderValue,Font.getDefault());
 411 //        assertTrue(value instanceof String[]);
 412 //        String[] cssImageBorders = (String[])value;
 413 //        keyValues.put(cssImageBorderProperty,cssImageBorders);
 414 //
 415 //        ParsedValue cssImageRepeatValue = getValueFor(stylesheet, "-fx-border-image-repeat");
 416 //        CSSProperty cssImageRepeatProperty = getCssMetaDataByName("-fx-border-image-repeat", BorderImage.getClassCssMetaData());