1 /*
   2  * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   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.layout;
  27 
  28 import org.junit.Test;
  29 
  30 public class RegionTest {
  31 
  32     public RegionTest() {
  33     }
  34 
  35     @Test public void dummy() { }
  36 //    CSSProperty getCssMetaDataByName(String name, List<CSSProperty> keys) {
  37 //        CSSProperty keyForName = null;
  38 //        for (CSSProperty k : keys) {
  39 //            if (k.getProperty().equals(name)) {
  40 //                keyForName = k;
  41 //                break;
  42 //            }
  43 //        }
  44 //        assertNotNull(keyForName);
  45 //        return keyForName;
  46 //    }
  47 //
  48 //    ParsedValue getValueFor(Stylesheet stylesheet, String property ) {
  49 //        for (Rule rule : stylesheet.getRules()) {
  50 //            for (Declaration decl : rule.getDeclarations()) {
  51 //                if (property.equals(decl.getProperty())) {
  52 //                    return decl.getParsedValue();
  53 //                }
  54 //            }
  55 //        }
  56 //        fail("getValueFor " + property);
  57 //        return null;
  58 //    }
  59 //
  60 //     @Test
  61 //     public void testConvertCSSPropertysToBackgroundFills() {
  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);
 103 //
 104 //        ParsedValue cssInsetsValue = getValueFor(stylesheet, "-fx-background-insets");
 105 //        CSSProperty cssInsetsProperty = getCssMetaDataByName("-fx-background-insets", BackgroundFill.getClassCssMetaData());
 106 //        value = cssInsetsProperty.getConverter().convert(cssInsetsValue,Font.getDefault());
 107 //        assertTrue(value instanceof Insets[]);
 108 //        keyValues.put(cssInsetsProperty, (Insets[])value);
 109 //
 110 //
 111 //        List<BackgroundFill> fills = BackgroundFillConverter.BACKGROUND_FILLS_CONVERTER.convert(keyValues);
 112 //
 113 //        assertEquals(cssPaints.length, fills.size());
 114 //
 115 //        for (int f=0; f<fills.size(); f++) {
 116 //            BackgroundFill cssFill = fills.get(f);
 117 //
 118 //            assertEquals(expectedColors[f], cssFill.getFill());
 119 //            assertEquals(expectedInsets[f], cssFill.getOffsets());
 120 //            assertEquals(expectedRadii[f].getTop(), cssFill.getTopLeftCornerRadius(), 0.01);
 121 //            assertEquals(expectedRadii[f].getRight(), cssFill.getTopRightCornerRadius(), 0.01);
 122 //            assertEquals(expectedRadii[f].getBottom(), cssFill.getBottomRightCornerRadius(), 0.01);
 123 //            assertEquals(expectedRadii[f].getLeft(), cssFill.getBottomLeftCornerRadius(), 0.01);
 124 //        }
 125 //
 126 //        try {
 127 //            CSSProperty styleable = getCssMetaDataByName("-fx-background-fills", Region.getClassCssMetaData());
 128 //            styleable.set(new Region(), fills);
 129 //        } catch (Exception e) {
 130 //            fail(e.toString());
 131 //        }
 132 //     }
 133 //
 134 //     @Test
 135 //     public void testConvertCSSPropertysToStrokeBorders() {
 136 //
 137 //        Paint[][] expectedBorderColors = {
 138 //            {Color.RED, Color.RED, Color.RED, Color.RED},
 139 //            {Color.YELLOW, Color.BLUE, Color.GREEN, Color.RED},
 140 //            {Color.web("#d0d0d0"), Color.web("#0d0d0d"), Color.web("#d0d0d0"), Color.web("#0d0d0d") }
 141 //        };
 142 //
 143 //        Insets[] expectedBorderWidths = {
 144 //            new Insets(1,2,3,4),
 145 //            new Insets(1,2,3,4),
 146 //            new Insets(1,2,3,4)
 147 //        };
 148 //
 149 //        Insets[] expectedBorderRadii = {
 150 //            new Insets(5,5,5,5),
 151 //            new Insets(1,2,1,2),
 152 //            new Insets(1,2,1,2)
 153 //        };
 154 //
 155 //        Insets[] expectedBorderInsets = {
 156 //            new Insets(-1,-1,-1,-1),
 157 //            new Insets(0,0,0,0),
 158 //            new Insets(1,1,1,1),
 159 //        };
 160 //
 161 //        BorderStyle dashed = new BorderStyle(
 162 //                StrokeType.CENTERED,
 163 //                StrokeLineJoin.MITER,
 164 //                StrokeLineCap.BUTT,
 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());
 206 //        value = cssInsetsProperty.getConverter().convert(cssInsetsValue,Font.getDefault());
 207 //        assertTrue(value instanceof Insets[]);
 208 //        Insets[] cssInsets = (Insets[])value;
 209 //        keyValues.put(cssInsetsProperty, cssInsets);
 210 //
 211 //        ParsedValue cssRadiusValue = getValueFor(stylesheet, "-fx-border-radius");
 212 //        CSSProperty cssRadiusProperty = getCssMetaDataByName("-fx-border-radius", StrokeBorder.getClassCssMetaData());
 213 //        value = cssRadiusProperty.getConverter().convert(cssRadiusValue,Font.getDefault());
 214 //        assertTrue(value instanceof Margins[]);
 215 //        Margins[] cssRadii = (Margins[])value;
 216 //        keyValues.put(cssRadiusProperty, cssRadii);
 217 //
 218 //        ParsedValue cssWidthValue = getValueFor(stylesheet, "-fx-border-width");
 219 //        CSSProperty cssWidthProperty = getCssMetaDataByName("-fx-border-width", StrokeBorder.getClassCssMetaData());
 220 //        value = cssWidthProperty.getConverter().convert(cssWidthValue,Font.getDefault());
 221 //        assertTrue(value instanceof Margins[]);
 222 //        Margins[] cssWidth = (Margins[])value;
 223 //        keyValues.put(cssWidthProperty, cssWidth);
 224 //
 225 //        ParsedValue cssStyleValue = getValueFor(stylesheet, "-fx-border-style");
 226 //        CSSProperty cssStyleProperty = getCssMetaDataByName("-fx-border-style", StrokeBorder.getClassCssMetaData());
 227 //        value = cssStyleProperty.getConverter().convert(cssStyleValue,Font.getDefault());
 228 //        assertTrue(value instanceof BorderStyle[][]);
 229 //        BorderStyle[][] cssStyle = (BorderStyle[][])value;
 230 //        keyValues.put(cssStyleProperty, cssStyle);
 231 //
 232 //
 233 //        List<StrokeBorder> strokeBorders = StrokeBorderConverter.getInstance().convert(keyValues);
 234 //
 235 //        assertEquals(cssPaints.length, strokeBorders.size());
 236 //
 237 //        for (int f=0; f<strokeBorders.size(); f++) {
 238 //            StrokeBorder border = strokeBorders.get(f);
 239 //            assertEquals(expectedBorderColors[f][0], border.getTopFill());
 240 //            assertEquals(expectedBorderColors[f][1], border.getRightFill());
 241 //            assertEquals(expectedBorderColors[f][2], border.getBottomFill());
 242 //            assertEquals(expectedBorderColors[f][3], border.getLeftFill());
 243 //            assertEquals(expectedBorderInsets[f], border.getOffsets());
 244 //            assertEquals(expectedBorderWidths[f].getTop(), border.getTopWidth(), 0.01);
 245 //            assertEquals(expectedBorderWidths[f].getRight(), border.getRightWidth(), 0.01);
 246 //            assertEquals(expectedBorderWidths[f].getBottom(), border.getBottomWidth(), 0.01);
 247 //            assertEquals(expectedBorderWidths[f].getLeft(), border.getLeftWidth(), 0.01);
 248 //            assertEquals(expectedBorderRadii[f].getTop(), border.getTopLeftCornerRadius(), 0.01);
 249 //            assertEquals(expectedBorderRadii[f].getRight(), border.getTopRightCornerRadius(), 0.01);
 250 //            assertEquals(expectedBorderRadii[f].getBottom(), border.getBottomRightCornerRadius(), 0.01);
 251 //            assertEquals(expectedBorderRadii[f].getLeft(), border.getBottomLeftCornerRadius(), 0.01);
 252 //            assertEquals(expectedBorderStyles[f][0], border.getTopStyle());
 253 //            assertEquals(expectedBorderStyles[f][1], border.getRightStyle());
 254 //            assertEquals(expectedBorderStyles[f][2], border.getBottomStyle());
 255 //            assertEquals(expectedBorderStyles[f][3], border.getLeftStyle());
 256 //        }
 257 //
 258 //        try {
 259 //            CSSProperty styleable = getCssMetaDataByName("-fx-stroke-borders",Region.getClassCssMetaData());
 260 //            styleable.set(new Region(), strokeBorders);
 261 //        } catch (Exception e) {
 262 //            fail(e.toString());
 263 //        }
 264 //     }
 265 //
 266 //     @Test
 267 //     public void testConvertStyleablePropertiesToBackgroundImages() {
 268 //
 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[]);
 310 //        RepeatStruct[] cssBackgroundRepeats = (RepeatStruct[])value;
 311 //        keyValues.put(cssBackgroundRepeatProperty, cssBackgroundRepeats);
 312 //
 313 //        ParsedValue cssBackgroundPositionValue = getValueFor(stylesheet, "-fx-background-position");
 314 //        CSSProperty cssBackgroundPositionProperty = getCssMetaDataByName("-fx-background-position", BackgroundImage.getClassCssMetaData());
 315 //        value = cssBackgroundPositionProperty.getConverter().convert(cssBackgroundPositionValue,Font.getDefault());
 316 //        assertTrue(value instanceof BackgroundPosition[]);
 317 //        BackgroundPosition[] cssBackgroundPositions = (BackgroundPosition[])value;
 318 //        keyValues.put(cssBackgroundPositionProperty, cssBackgroundPositions);
 319 //
 320 //        ParsedValue cssBackgroundSizeValue = getValueFor(stylesheet, "-fx-background-size");
 321 //        CSSProperty cssBackgroundSizeProperty = getCssMetaDataByName("-fx-background-size", BackgroundImage.getClassCssMetaData());
 322 //        value = cssBackgroundSizeProperty.getConverter().convert(cssBackgroundSizeValue,Font.getDefault());
 323 //        assertTrue(value instanceof BackgroundSize[]);
 324 //        BackgroundSize[] cssBackgroundSizes = (BackgroundSize[])value;
 325 //        keyValues.put(cssBackgroundSizeProperty, cssBackgroundSizes);
 326 //
 327 //        List<BackgroundImage> images = BackgroundImageConverter.getInstance().convert(keyValues);
 328 //
 329 //        assertEquals(cssBackgroundImages.length, images.size());
 330 //
 331 //        for (int i=0; i<images.size(); i++) {
 332 //            BackgroundImage image = images.get(i);
 333 ////             TODO: fix this - expected is file:/... actual is jar:file:/...
 334 ////            assertEquals(expectedUrls[i], image.getImage().impl_getUrl());
 335 //            assertEquals(expectedRepeats[i].getRepeatX(), image.getRepeatX());
 336 //            assertEquals(expectedRepeats[i].getRepeatY(), image.getRepeatY());
 337 //            assertEquals(expectedPositions[i].getTop(), image.getTop(), 0.01);
 338 //            assertEquals(expectedPositions[i].getRight(), image.getRight(), 0.01);
 339 //            assertEquals(expectedPositions[i].getBottom(), image.getBottom(), 0.01);
 340 //            assertEquals(expectedPositions[i].getLeft(), image.getLeft(), 0.01);
 341 //            assertEquals(expectedSizes[i].getWidth(), image.getWidth(), 0.01);
 342 //            assertEquals(expectedSizes[i].getHeight(), image.getHeight(), 0.01);
 343 //            assertEquals(expectedSizes[i].isCover(), image.isCover());
 344 //            assertEquals(expectedSizes[i].isContain(), image.isContain());
 345 //        }
 346 //
 347 //        try {
 348 //            CSSProperty prop = getCssMetaDataByName("-fx-background-images",Region.getClassCssMetaData());
 349 //            prop.set(new Region(), images);
 350 //        } catch (Exception e) {
 351 //            fail(e.toString());
 352 //        }
 353 //     }
 354 //
 355 //     @Test
 356 //     public void testConvertCSSPropertysToImageBorder() {
 357 //
 358 ////        URI CODEBASE = null;
 359 ////        try {
 360 ////            CODEBASE = URI.create(System.getProperty("javafx.application.codebase"));
 361 ////                //System.out.println("CODEBASE: " + cb);
 362 ////        } catch (Exception e) {
 363 ////            try {
 364 ////                CODEBASE = URI.create(System.getProperty("user.dir"));
 365 ////            } catch (Exception x) {
 366 ////                fail("could not set CODEBASE: " + x.toString());
 367 ////            }
 368 ////        }
 369 //
 370 //         String[] expectedUrls = new String[] {
 371 //            "http://sipi.usc.edu/database/misc/4.2.04.tiff",
 372 //            "http://sipi.usc.edu/database/misc/4.2.03.tiff",
 373 ////            CODEBASE.resolve("scenic-view.png").toString()
 374 //         };
 375 //
 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());
 417 //        value = cssImageRepeatProperty.getConverter().convert(cssImageRepeatValue,Font.getDefault());
 418 //        assertTrue(value instanceof BorderImageRepeat[]);
 419 //        BorderImageRepeat[] cssBorderImageRepeats = (BorderImageRepeat[])value;
 420 //        keyValues.put(cssImageRepeatProperty, cssBorderImageRepeats);
 421 //
 422 //        ParsedValue cssSliceValue = getValueFor(stylesheet, "-fx-border-image-slice");
 423 //        CSSProperty cssSliceProperty = getCssMetaDataByName("-fx-border-image-slice", BorderImage.getClassCssMetaData());
 424 //        value = cssSliceProperty.getConverter().convert(cssSliceValue,Font.getDefault());
 425 //        assertTrue(value instanceof BorderImageSlices[]);
 426 //        BorderImageSlices[] cssBorderImageSlices = (BorderImageSlices[])value;
 427 //        keyValues.put(cssSliceProperty, cssBorderImageSlices);
 428 //
 429 //        ParsedValue cssWidthValue = getValueFor(stylesheet, "-fx-border-image-width");
 430 //        CSSProperty cssWidthProperty = getCssMetaDataByName("-fx-border-image-width", BorderImage.getClassCssMetaData());
 431 //        value = cssWidthProperty.getConverter().convert(cssWidthValue,Font.getDefault());
 432 //        assertTrue(value instanceof Margins[]);
 433 //        Margins[] cssBorderImageWidths = (Margins[])value;
 434 //        keyValues.put(cssWidthProperty, cssBorderImageWidths);
 435 //
 436 //        ParsedValue cssInsetsValue = getValueFor(stylesheet, "-fx-border-image-insets");
 437 //        CSSProperty cssInsetsProperty = getCssMetaDataByName("-fx-border-image-insets", BorderImage.getClassCssMetaData());
 438 //        value = cssInsetsProperty.getConverter().convert(cssInsetsValue,Font.getDefault());
 439 //        assertTrue(value instanceof Insets[]);
 440 //        Insets[] cssBorderImageInsets = (Insets[])value;
 441 //        keyValues.put(cssInsetsProperty, cssBorderImageInsets);
 442 //
 443 //        List<BorderImage> images = BorderImageConverter.getInstance().convert(keyValues);
 444 //
 445 //        assertEquals(cssImageBorders.length, images.size());
 446 //
 447 //        for (int i=0; i<images.size(); i++) {
 448 //            BorderImage image = images.get(i);
 449 //            assertEquals(expectedUrls[i], image.getImage().impl_getUrl());
 450 //            assertEquals(expectedRepeats[i].getRepeatX(), image.getRepeatX());
 451 //            assertEquals(expectedRepeats[i].getRepeatY(), image.getRepeatY());
 452 //            assertEquals(expectedSlices[i].getTop(), image.getTopSlice(),0.01);
 453 //            assertEquals(expectedSlices[i].getRight(), image.getRightSlice(),0.01);
 454 //            assertEquals(expectedSlices[i].getBottom(), image.getBottomSlice(),0.01);
 455 //            assertEquals(expectedSlices[i].getLeft(), image.getLeftSlice(),0.01);
 456 //            assertEquals(expectedWidths[i].getTop(), image.getTopWidth(),0.01);
 457 //            assertEquals(expectedWidths[i].getRight(), image.getRightWidth(),0.01);
 458 //            assertEquals(expectedWidths[i].getBottom(), image.getBottomWidth(),0.01);
 459 //            assertEquals(expectedWidths[i].getLeft(), image.getLeftWidth(),0.01);
 460 //            assertEquals(expectedInsets[i].getTop(), image.getOffsets().getTop(),0.01);
 461 //            assertEquals(expectedInsets[i].getRight(), image.getOffsets().getRight(),0.01);
 462 //            assertEquals(expectedInsets[i].getBottom(), image.getOffsets().getBottom(),0.01);
 463 //            assertEquals(expectedInsets[i].getLeft(), image.getOffsets().getLeft(),0.01);
 464 //        }
 465 //
 466 //        try {
 467 //            CSSProperty styleable = getCssMetaDataByName("-fx-image-borders", Region.getClassCssMetaData());
 468 //            styleable.set(new Region(), images);
 469 //        } catch (Exception e) {
 470 //            fail(e.toString());
 471 //        }
 472 //     }
 473 
 474 }