1 /* 2 * Copyright (c) 2014, 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 package test.css.controls.api.styles; 26 27 import javafx.css.CssMetaData; 28 import java.util.Map; 29 import java.util.Set; 30 import javafx.scene.Node; 31 import javafx.scene.control.*; 32 import javafx.scene.layout.*; 33 import javafx.scene.chart.*; 34 import javafx.scene.shape.*; 35 import javafx.scene.web.*; 36 import javafx.scene.image.*; 37 import javafx.scene.text.*; 38 import javafx.scene.*; 39 import org.junit.Assert; 40 import org.junit.BeforeClass; 41 import org.junit.Test; 42 import org.jemmy.fx.Root; 43 import org.jemmy.action.GetAction; 44 import client.test.Keywords; 45 import com.sun.javafx.scene.control.skin.*; 46 import javafx.scene.paint.Paint; 47 import javafx.geometry.Insets; 48 import com.sun.javafx.scene.layout.region.RepeatStruct; 49 import com.sun.javafx.scene.layout.region.BorderImageSlices; 50 51 52 /** 53 * Generation test 54 * @author sergey.lugovoy@oracle.com 55 */ 56 public class StylesCategoryAxisTest extends BaseStyleNodeTest { 57 58 @Override 59 Node getControl() { 60 return new GetAction<Node>() { 61 @Override 62 public void run(Object... os) throws Exception { 63 CategoryAxis control = new CategoryAxis(); 64 setResult(control); 65 } 66 }.dispatch(Root.ROOT.getEnvironment()); 67 } 68 69 @Test 70 public void testfxbackgroundcolor () { 71 Set<String> styleNames = getStyleNames(); 72 Assert.assertNotNull(styleNames); 73 Assert.assertTrue(styleNames.contains("-fx-background-color")); 74 Map<String, CssMetaData> styles = getStyles(); 75 CssMetaData data = styles.get("-fx-background-color"); 76 Assert.assertArrayEquals((Paint[])data.getInitialValue(getControl()), new Paint[]{Paint.valueOf("transparent")}); 77 } 78 79 @Test 80 public void testfxbackgroundimage () { 81 Set<String> styleNames = getStyleNames(); 82 Assert.assertNotNull(styleNames); 83 Assert.assertTrue(styleNames.contains("-fx-background-image")); 84 Map<String, CssMetaData> styles = getStyles(); 85 CssMetaData data = styles.get("-fx-background-image"); 86 Assert.assertEquals(data.getInitialValue(getControl()), null); 87 } 88 89 @Test 90 public void testfxbackgroundinsets () { 91 Set<String> styleNames = getStyleNames(); 92 Assert.assertNotNull(styleNames); 93 Assert.assertTrue(styleNames.contains("-fx-background-insets")); 94 Map<String, CssMetaData> styles = getStyles(); 95 CssMetaData data = styles.get("-fx-background-insets"); 96 Assert.assertArrayEquals((Insets[])data.getInitialValue(getControl()), new Insets[]{new Insets(0.0, 0.0, 0.0, 0.0)}); 97 } 98 99 @Test 100 public void testfxbackgroundposition () { 101 Set<String> styleNames = getStyleNames(); 102 Assert.assertNotNull(styleNames); 103 Assert.assertTrue(styleNames.contains("-fx-background-position")); 104 Map<String, CssMetaData> styles = getStyles(); 105 CssMetaData data = styles.get("-fx-background-position"); 106 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)})); 107 } 108 109 @Test 110 public void testfxbackgroundradius () { 111 Set<String> styleNames = getStyleNames(); 112 Assert.assertNotNull(styleNames); 113 Assert.assertTrue(styleNames.contains("-fx-background-radius")); 114 Map<String, CssMetaData> styles = getStyles(); 115 CssMetaData data = styles.get("-fx-background-radius"); 116 Assert.assertArrayEquals((CornerRadii[])data.getInitialValue(getControl()), 117 new CornerRadii[]{new CornerRadii(0.0)}); 118 } 119 120 @Test 121 public void testfxbackgroundrepeat () { 122 Set<String> styleNames = getStyleNames(); 123 Assert.assertNotNull(styleNames); 124 Assert.assertTrue(styleNames.contains("-fx-background-repeat")); 125 Map<String, CssMetaData> styles = getStyles(); 126 CssMetaData data = styles.get("-fx-background-repeat"); 127 Assert.assertTrue(checkRepeatStruct((RepeatStruct[]) data.getInitialValue(getControl()), new RepeatStruct[]{new RepeatStruct(javafx.scene.layout.BackgroundRepeat.REPEAT,javafx.scene.layout.BackgroundRepeat.REPEAT)})); 128 } 129 130 @Test 131 public void testfxbackgroundsize () { 132 Set<String> styleNames = getStyleNames(); 133 Assert.assertNotNull(styleNames); 134 Assert.assertTrue(styleNames.contains("-fx-background-size")); 135 Map<String, CssMetaData> styles = getStyles(); 136 CssMetaData data = styles.get("-fx-background-size"); 137 Assert.assertArrayEquals((BackgroundSize[])data.getInitialValue(getControl()), new BackgroundSize[]{new BackgroundSize(-1.0,-1.0,true,true,false,false)}); 138 } 139 140 @Test 141 public void testfxblendmode () { 142 Set<String> styleNames = getStyleNames(); 143 Assert.assertNotNull(styleNames); 144 Assert.assertTrue(styleNames.contains("-fx-blend-mode")); 145 Map<String, CssMetaData> styles = getStyles(); 146 CssMetaData data = styles.get("-fx-blend-mode"); 147 Assert.assertEquals(data.getInitialValue(getControl()), null); 148 } 149 150 @Test 151 public void testfxbordercolor () { 152 Set<String> styleNames = getStyleNames(); 153 Assert.assertNotNull(styleNames); 154 Assert.assertTrue(styleNames.contains("-fx-border-color")); 155 Map<String, CssMetaData> styles = getStyles(); 156 CssMetaData data = styles.get("-fx-border-color"); 157 Assert.assertEquals(data.getInitialValue(getControl()), null); 158 } 159 160 @Test 161 public void testfxborderimageinsets () { 162 Set<String> styleNames = getStyleNames(); 163 Assert.assertNotNull(styleNames); 164 Assert.assertTrue(styleNames.contains("-fx-border-image-insets")); 165 Map<String, CssMetaData> styles = getStyles(); 166 CssMetaData data = styles.get("-fx-border-image-insets"); 167 Assert.assertArrayEquals((Insets[])data.getInitialValue(getControl()), new Insets[]{new Insets(0.0, 0.0, 0.0, 0.0)}); 168 } 169 170 @Test 171 public void testfxborderimagerepeat () { 172 Set<String> styleNames = getStyleNames(); 173 Assert.assertNotNull(styleNames); 174 Assert.assertTrue(styleNames.contains("-fx-border-image-repeat")); 175 Map<String, CssMetaData> styles = getStyles(); 176 CssMetaData data = styles.get("-fx-border-image-repeat"); 177 Assert.assertTrue(checkRepeatStruct((RepeatStruct[]) data.getInitialValue(getControl()), new RepeatStruct[]{new RepeatStruct(javafx.scene.layout.BackgroundRepeat.REPEAT,javafx.scene.layout.BackgroundRepeat.REPEAT)})); 178 } 179 180 @Test 181 public void testfxborderimageslice () { 182 Set<String> styleNames = getStyleNames(); 183 Assert.assertNotNull(styleNames); 184 Assert.assertTrue(styleNames.contains("-fx-border-image-slice")); 185 Map<String, CssMetaData> styles = getStyles(); 186 CssMetaData data = styles.get("-fx-border-image-slice"); 187 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)})); 188 } 189 190 @Test 191 public void testfxborderimagesource () { 192 Set<String> styleNames = getStyleNames(); 193 Assert.assertNotNull(styleNames); 194 Assert.assertTrue(styleNames.contains("-fx-border-image-source")); 195 Map<String, CssMetaData> styles = getStyles(); 196 CssMetaData data = styles.get("-fx-border-image-source"); 197 Assert.assertEquals(data.getInitialValue(getControl()), null); 198 } 199 200 @Test 201 public void testfxborderimagewidth () { 202 Set<String> styleNames = getStyleNames(); 203 Assert.assertNotNull(styleNames); 204 Assert.assertTrue(styleNames.contains("-fx-border-image-width")); 205 Map<String, CssMetaData> styles = getStyles(); 206 CssMetaData data = styles.get("-fx-border-image-width"); 207 Assert.assertArrayEquals((BorderWidths[])data.getInitialValue(getControl()), new BorderWidths[]{new BorderWidths(0, 0, 0, 0)}); 208 } 209 210 @Test 211 public void testfxborderinsets () { 212 Set<String> styleNames = getStyleNames(); 213 Assert.assertNotNull(styleNames); 214 Assert.assertTrue(styleNames.contains("-fx-border-insets")); 215 Map<String, CssMetaData> styles = getStyles(); 216 CssMetaData data = styles.get("-fx-border-insets"); 217 Assert.assertArrayEquals((Insets[])data.getInitialValue(getControl()), null); 218 } 219 220 @Test 221 public void testfxborderradius () { 222 Set<String> styleNames = getStyleNames(); 223 Assert.assertNotNull(styleNames); 224 Assert.assertTrue(styleNames.contains("-fx-border-radius")); 225 Map<String, CssMetaData> styles = getStyles(); 226 CssMetaData data = styles.get("-fx-border-radius"); 227 Assert.assertEquals(data.getInitialValue(getControl()), null); 228 } 229 230 @Test 231 public void testfxborderstyle () { 232 Set<String> styleNames = getStyleNames(); 233 Assert.assertNotNull(styleNames); 234 Assert.assertTrue(styleNames.contains("-fx-border-style")); 235 Map<String, CssMetaData> styles = getStyles(); 236 CssMetaData data = styles.get("-fx-border-style"); 237 Assert.assertEquals(data.getInitialValue(getControl()), null); 238 } 239 240 @Test 241 public void testfxborderwidth () { 242 Set<String> styleNames = getStyleNames(); 243 Assert.assertNotNull(styleNames); 244 Assert.assertTrue(styleNames.contains("-fx-border-width")); 245 Map<String, CssMetaData> styles = getStyles(); 246 CssMetaData data = styles.get("-fx-border-width"); 247 Assert.assertEquals(data.getInitialValue(getControl()), null); 248 } 249 250 @Test 251 public void testfxcursor () { 252 Set<String> styleNames = getStyleNames(); 253 Assert.assertNotNull(styleNames); 254 Assert.assertTrue(styleNames.contains("-fx-cursor")); 255 Map<String, CssMetaData> styles = getStyles(); 256 CssMetaData data = styles.get("-fx-cursor"); 257 Assert.assertEquals(data.getInitialValue(getControl()), null); 258 } 259 260 @Test 261 public void testfxeffect () { 262 Set<String> styleNames = getStyleNames(); 263 Assert.assertNotNull(styleNames); 264 Assert.assertTrue(styleNames.contains("-fx-effect")); 265 Map<String, CssMetaData> styles = getStyles(); 266 CssMetaData data = styles.get("-fx-effect"); 267 Assert.assertEquals(data.getInitialValue(getControl()), null); 268 } 269 270 @Test 271 public void testfxendmargin () { 272 Set<String> styleNames = getStyleNames(); 273 Assert.assertNotNull(styleNames); 274 Assert.assertTrue(styleNames.contains("-fx-end-margin")); 275 Map<String, CssMetaData> styles = getStyles(); 276 CssMetaData data = styles.get("-fx-end-margin"); 277 Assert.assertEquals(data.getInitialValue(getControl()), 5.0); 278 } 279 280 @Test 281 public void testfxgapstartandend () { 282 Set<String> styleNames = getStyleNames(); 283 Assert.assertNotNull(styleNames); 284 Assert.assertTrue(styleNames.contains("-fx-gap-start-and-end")); 285 Map<String, CssMetaData> styles = getStyles(); 286 CssMetaData data = styles.get("-fx-gap-start-and-end"); 287 Assert.assertEquals(data.getInitialValue(getControl()), true); 288 } 289 290 @Test 291 public void testfxopacity () { 292 Set<String> styleNames = getStyleNames(); 293 Assert.assertNotNull(styleNames); 294 Assert.assertTrue(styleNames.contains("-fx-opacity")); 295 Map<String, CssMetaData> styles = getStyles(); 296 CssMetaData data = styles.get("-fx-opacity"); 297 Assert.assertEquals(data.getInitialValue(getControl()), 1.0); 298 } 299 300 @Test 301 public void testfxpadding () { 302 Set<String> styleNames = getStyleNames(); 303 Assert.assertNotNull(styleNames); 304 Assert.assertTrue(styleNames.contains("-fx-padding")); 305 Map<String, CssMetaData> styles = getStyles(); 306 CssMetaData data = styles.get("-fx-padding"); 307 Assert.assertEquals(data.getInitialValue(getControl()), new javafx.geometry.Insets(0.0,0.0,0.0,0.0)); 308 } 309 310 @Test 311 public void testfxpositionshape () { 312 Set<String> styleNames = getStyleNames(); 313 Assert.assertNotNull(styleNames); 314 Assert.assertTrue(styleNames.contains("-fx-position-shape")); 315 Map<String, CssMetaData> styles = getStyles(); 316 CssMetaData data = styles.get("-fx-position-shape"); 317 Assert.assertEquals(data.getInitialValue(getControl()), true); 318 } 319 320 @Test 321 public void testfxregionbackground () { 322 Set<String> styleNames = getStyleNames(); 323 Assert.assertNotNull(styleNames); 324 Assert.assertTrue(styleNames.contains("-fx-region-background")); 325 Map<String, CssMetaData> styles = getStyles(); 326 CssMetaData data = styles.get("-fx-region-background"); 327 Assert.assertEquals(data.getInitialValue(getControl()), null); 328 } 329 330 @Test 331 public void testfxregionborder () { 332 Set<String> styleNames = getStyleNames(); 333 Assert.assertNotNull(styleNames); 334 Assert.assertTrue(styleNames.contains("-fx-region-border")); 335 Map<String, CssMetaData> styles = getStyles(); 336 CssMetaData data = styles.get("-fx-region-border"); 337 Assert.assertEquals(data.getInitialValue(getControl()), null); 338 } 339 340 @Test 341 public void testfxrotate () { 342 Set<String> styleNames = getStyleNames(); 343 Assert.assertNotNull(styleNames); 344 Assert.assertTrue(styleNames.contains("-fx-rotate")); 345 Map<String, CssMetaData> styles = getStyles(); 346 CssMetaData data = styles.get("-fx-rotate"); 347 Assert.assertEquals(data.getInitialValue(getControl()), 0.0); 348 } 349 350 @Test 351 public void testfxscaleshape () { 352 Set<String> styleNames = getStyleNames(); 353 Assert.assertNotNull(styleNames); 354 Assert.assertTrue(styleNames.contains("-fx-scale-shape")); 355 Map<String, CssMetaData> styles = getStyles(); 356 CssMetaData data = styles.get("-fx-scale-shape"); 357 Assert.assertEquals(data.getInitialValue(getControl()), true); 358 } 359 360 @Test 361 public void testfxscalex () { 362 Set<String> styleNames = getStyleNames(); 363 Assert.assertNotNull(styleNames); 364 Assert.assertTrue(styleNames.contains("-fx-scale-x")); 365 Map<String, CssMetaData> styles = getStyles(); 366 CssMetaData data = styles.get("-fx-scale-x"); 367 Assert.assertEquals(data.getInitialValue(getControl()), 1.0); 368 } 369 370 @Test 371 public void testfxscaley () { 372 Set<String> styleNames = getStyleNames(); 373 Assert.assertNotNull(styleNames); 374 Assert.assertTrue(styleNames.contains("-fx-scale-y")); 375 Map<String, CssMetaData> styles = getStyles(); 376 CssMetaData data = styles.get("-fx-scale-y"); 377 Assert.assertEquals(data.getInitialValue(getControl()), 1.0); 378 } 379 380 @Test 381 public void testfxscalez () { 382 Set<String> styleNames = getStyleNames(); 383 Assert.assertNotNull(styleNames); 384 Assert.assertTrue(styleNames.contains("-fx-scale-z")); 385 Map<String, CssMetaData> styles = getStyles(); 386 CssMetaData data = styles.get("-fx-scale-z"); 387 Assert.assertEquals(data.getInitialValue(getControl()), 1.0); 388 } 389 390 @Test 391 public void testfxshape () { 392 Set<String> styleNames = getStyleNames(); 393 Assert.assertNotNull(styleNames); 394 Assert.assertTrue(styleNames.contains("-fx-shape")); 395 Map<String, CssMetaData> styles = getStyles(); 396 CssMetaData data = styles.get("-fx-shape"); 397 Assert.assertEquals(data.getInitialValue(getControl()), null); 398 } 399 400 @Test 401 public void testfxside () { 402 Set<String> styleNames = getStyleNames(); 403 Assert.assertNotNull(styleNames); 404 Assert.assertTrue(styleNames.contains("-fx-side")); 405 Map<String, CssMetaData> styles = getStyles(); 406 CssMetaData data = styles.get("-fx-side"); 407 Assert.assertEquals(data.getInitialValue(getControl()), null); 408 } 409 410 @Test 411 public void testfxsnaptopixel () { 412 Set<String> styleNames = getStyleNames(); 413 Assert.assertNotNull(styleNames); 414 Assert.assertTrue(styleNames.contains("-fx-snap-to-pixel")); 415 Map<String, CssMetaData> styles = getStyles(); 416 CssMetaData data = styles.get("-fx-snap-to-pixel"); 417 Assert.assertEquals(data.getInitialValue(getControl()), true); 418 } 419 420 @Test 421 public void testfxstartmargin () { 422 Set<String> styleNames = getStyleNames(); 423 Assert.assertNotNull(styleNames); 424 Assert.assertTrue(styleNames.contains("-fx-start-margin")); 425 Map<String, CssMetaData> styles = getStyles(); 426 CssMetaData data = styles.get("-fx-start-margin"); 427 Assert.assertEquals(data.getInitialValue(getControl()), 5.0); 428 } 429 430 @Test 431 public void testfxticklabelfill () { 432 Set<String> styleNames = getStyleNames(); 433 Assert.assertNotNull(styleNames); 434 Assert.assertTrue(styleNames.contains("-fx-tick-label-fill")); 435 Map<String, CssMetaData> styles = getStyles(); 436 CssMetaData data = styles.get("-fx-tick-label-fill"); 437 Assert.assertEquals(data.getInitialValue(getControl()), javafx.scene.paint.Color.valueOf("0x000000ff")); 438 } 439 440 @Test 441 public void testfxticklabelfont () { 442 Set<String> styleNames = getStyleNames(); 443 Assert.assertNotNull(styleNames); 444 Assert.assertTrue(styleNames.contains("-fx-tick-label-font")); 445 Map<String, CssMetaData> styles = getStyles(); 446 CssMetaData data = styles.get("-fx-tick-label-font"); 447 Assert.assertEquals(data.getInitialValue(getControl()), new Font("System", 8)); 448 } 449 450 @Test 451 public void testfxticklabelgap () { 452 Set<String> styleNames = getStyleNames(); 453 Assert.assertNotNull(styleNames); 454 Assert.assertTrue(styleNames.contains("-fx-tick-label-gap")); 455 Map<String, CssMetaData> styles = getStyles(); 456 CssMetaData data = styles.get("-fx-tick-label-gap"); 457 Assert.assertEquals(data.getInitialValue(getControl()), 3.0); 458 } 459 460 @Test 461 public void testfxticklabelsvisible () { 462 Set<String> styleNames = getStyleNames(); 463 Assert.assertNotNull(styleNames); 464 Assert.assertTrue(styleNames.contains("-fx-tick-labels-visible")); 465 Map<String, CssMetaData> styles = getStyles(); 466 CssMetaData data = styles.get("-fx-tick-labels-visible"); 467 Assert.assertEquals(data.getInitialValue(getControl()), true); 468 } 469 470 @Test 471 public void testfxticklength () { 472 Set<String> styleNames = getStyleNames(); 473 Assert.assertNotNull(styleNames); 474 Assert.assertTrue(styleNames.contains("-fx-tick-length")); 475 Map<String, CssMetaData> styles = getStyles(); 476 CssMetaData data = styles.get("-fx-tick-length"); 477 Assert.assertEquals(data.getInitialValue(getControl()), 8.0); 478 } 479 480 @Test 481 public void testfxtickmarkvisible () { 482 Set<String> styleNames = getStyleNames(); 483 Assert.assertNotNull(styleNames); 484 Assert.assertTrue(styleNames.contains("-fx-tick-mark-visible")); 485 Map<String, CssMetaData> styles = getStyles(); 486 CssMetaData data = styles.get("-fx-tick-mark-visible"); 487 Assert.assertEquals(data.getInitialValue(getControl()), true); 488 } 489 490 @Test 491 public void testfxtranslatex () { 492 Set<String> styleNames = getStyleNames(); 493 Assert.assertNotNull(styleNames); 494 Assert.assertTrue(styleNames.contains("-fx-translate-x")); 495 Map<String, CssMetaData> styles = getStyles(); 496 CssMetaData data = styles.get("-fx-translate-x"); 497 Assert.assertEquals(data.getInitialValue(getControl()), 0.0); 498 } 499 500 @Test 501 public void testfxtranslatey () { 502 Set<String> styleNames = getStyleNames(); 503 Assert.assertNotNull(styleNames); 504 Assert.assertTrue(styleNames.contains("-fx-translate-y")); 505 Map<String, CssMetaData> styles = getStyles(); 506 CssMetaData data = styles.get("-fx-translate-y"); 507 Assert.assertEquals(data.getInitialValue(getControl()), 0.0); 508 } 509 510 @Test 511 public void testfxtranslatez () { 512 Set<String> styleNames = getStyleNames(); 513 Assert.assertNotNull(styleNames); 514 Assert.assertTrue(styleNames.contains("-fx-translate-z")); 515 Map<String, CssMetaData> styles = getStyles(); 516 CssMetaData data = styles.get("-fx-translate-z"); 517 Assert.assertEquals(data.getInitialValue(getControl()), 0.0); 518 } 519 520 @Test 521 public void testvisibility () { 522 Set<String> styleNames = getStyleNames(); 523 Assert.assertNotNull(styleNames); 524 Assert.assertTrue(styleNames.contains("visibility")); 525 Map<String, CssMetaData> styles = getStyles(); 526 CssMetaData data = styles.get("visibility"); 527 Assert.assertEquals(data.getInitialValue(getControl()), true); 528 } 529 530 531 }