1 /*
   2  * Copyright (c) 2010, 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 
  26 package javafx.scene.control;
  27 
  28 import javafx.css.CssMetaData;
  29 import static com.sun.javafx.scene.control.infrastructure.ControlTestUtils.*;
  30 
  31 import test.com.sun.javafx.pgstub.StubToolkit;
  32 import com.sun.javafx.tk.Toolkit;
  33 import javafx.beans.property.BooleanProperty;
  34 import javafx.beans.property.DoubleProperty;
  35 import javafx.beans.property.ObjectProperty;
  36 import javafx.beans.property.SimpleBooleanProperty;
  37 import javafx.beans.property.SimpleDoubleProperty;
  38 import javafx.beans.property.SimpleObjectProperty;
  39 import javafx.beans.property.SimpleStringProperty;
  40 import javafx.beans.property.StringProperty;
  41 import javafx.css.StyleableProperty;
  42 import javafx.scene.Node;
  43 import javafx.scene.shape.Rectangle;
  44 import javafx.scene.text.Font;
  45 import javafx.scene.text.TextAlignment;
  46 import static org.junit.Assert.*;
  47 
  48 
  49 import org.junit.Before;
  50 import org.junit.Ignore;
  51 import org.junit.Test;
  52 
  53 /**
  54  *
  55  * @author srikalyc
  56  */
  57 public class TooltipTest {
  58     private Tooltip toolTip;//Empty string
  59     private Tooltip dummyToolTip;//Empty string
  60     private Toolkit tk;
  61 
  62     @Before public void setup() {
  63         tk = (StubToolkit)Toolkit.getToolkit();//This step is not needed (Just to make sure StubToolkit is loaded into VM)
  64         toolTip = new Tooltip();
  65         dummyToolTip = new Tooltip("dummy");
  66     }
  67     
  68    
  69 
  70     /*********************************************************************
  71      * Tests for the constructors                                        *
  72      ********************************************************************/
  73     
  74     @Test public void defaultConstructorShouldHaveNullString() {
  75         assertEquals(toolTip.getText(), "");
  76     }
  77     @Test public void oneStrArgConstructorShouldHaveString() {
  78         assertEquals("dummy", dummyToolTip.getText());
  79     }
  80 
  81     
  82     /*********************************************************************
  83      * Tests for default values                                         *
  84      ********************************************************************/
  85     
  86     @Test public void defaultConstructorShouldSetStyleClassTo_tooltip() {
  87         assertStyleClassContains(toolTip, "tooltip");
  88     }
  89     
  90     @Test public void oneStrArgConstructorShouldSetStyleClassTo_tooltip() {
  91         assertStyleClassContains(dummyToolTip, "tooltip");
  92     }
  93     
  94     @Test public void defaultActivationIsFalse() {
  95         assertFalse(toolTip.isActivated());
  96     }
  97 
  98     @Test public void canSetActivation() {
  99         toolTip.setActivated(true);//This call is not public method, not sure if makes sense.
 100         assertTrue(toolTip.isActivated());
 101     }
 102 
 103     @Test public void defaultTextAlignmentIsLeft() {
 104         assertNotNull(toolTip.getTextAlignment());
 105         assertSame(toolTip.getTextAlignment(), TextAlignment.LEFT);
 106     }
 107     
 108     @Test public void defaultTextOverrunIsEllipsis() {
 109         assertNotNull(toolTip.getTextOverrun());
 110         assertSame(toolTip.getTextOverrun(), OverrunStyle.ELLIPSIS);
 111     }
 112 
 113     @Test public void defaultWrapTextIsFalse() {
 114         assertFalse(toolTip.isWrapText());
 115     }
 116 
 117     @Test public void defaultFontIsnotNull() {
 118         System.out.println("toolTip.getFont() " + toolTip.getFont());
 119         assertNotNull(toolTip.getFont());
 120     }
 121 
 122     @Test public void checkDefaultGraphic() {
 123         assertNull(toolTip.getGraphic());
 124         assertNull(dummyToolTip.getGraphic());
 125     }
 126 
 127     @Test public void checkContentDisplay() {
 128         assertSame(toolTip.getContentDisplay(), ContentDisplay.LEFT);
 129         assertSame(dummyToolTip.getContentDisplay(), ContentDisplay.LEFT);
 130     }
 131 
 132     @Test public void checkDefaultGraphicTextGap() {
 133         assertEquals(toolTip.getGraphicTextGap(), 4.0, 0.0);
 134         assertEquals(dummyToolTip.getGraphicTextGap(), 4.0, 0.0);
 135     }
 136 
 137     /*********************************************************************
 138      * Tests for property binding                                        *
 139      ********************************************************************/
 140     @Test public void checkTextPropertyBind() {
 141         StringProperty strPr = new SimpleStringProperty("value");
 142         toolTip.textProperty().bind(strPr);
 143         assertTrue("Text cannot be bound", toolTip.textProperty().getValue().equals("value"));
 144         strPr.setValue("newvalue");
 145         assertTrue("Text cannot be bound", toolTip.textProperty().getValue().equals("newvalue"));
 146     }
 147     
 148     @Test public void checkTextAlignmentPropertyBind() {
 149         ObjectProperty objPr = new SimpleObjectProperty<TextAlignment>(TextAlignment.CENTER);
 150         toolTip.textAlignmentProperty().bind(objPr);
 151         assertSame("TextAlignment cannot be bound", toolTip.textAlignmentProperty().getValue(), TextAlignment.CENTER);
 152         objPr.setValue(TextAlignment.JUSTIFY);
 153         assertSame("TextAlignment cannot be bound", toolTip.textAlignmentProperty().getValue(), TextAlignment.JUSTIFY);
 154     }
 155     
 156     @Test public void checkTextOverrunPropertyBind() {
 157         ObjectProperty objPr = new SimpleObjectProperty<OverrunStyle>(OverrunStyle.CENTER_WORD_ELLIPSIS);
 158         toolTip.textOverrunProperty().bind(objPr);
 159         assertSame("TextOverrun cannot be bound", toolTip.textOverrunProperty().getValue(), OverrunStyle.CENTER_WORD_ELLIPSIS);
 160         objPr.setValue(OverrunStyle.LEADING_ELLIPSIS);
 161         assertSame("TextOverrun cannot be bound", toolTip.textOverrunProperty().getValue(), OverrunStyle.LEADING_ELLIPSIS);
 162     }
 163     
 164     @Test public void checkTextWrapPropertyBind() {
 165         ObjectProperty objPr = new SimpleObjectProperty<Boolean>(true);
 166         toolTip.wrapTextProperty().bind(objPr);
 167         assertEquals("TextWrap cannot be bound", toolTip.wrapTextProperty().getValue(), true);
 168         objPr.setValue(false);
 169         assertEquals("TextWrap cannot be bound", toolTip.wrapTextProperty().getValue(), false);
 170     }
 171     
 172     @Test public void checkFontPropertyBind() {
 173         ObjectProperty objPr = new SimpleObjectProperty<Font>(null);
 174         toolTip.fontProperty().bind(objPr);
 175         assertNull("Font cannot be bound", toolTip.fontProperty().getValue());
 176         objPr.setValue(Font.getDefault());
 177         assertSame("Font cannot be bound", toolTip.fontProperty().getValue(), Font.getDefault());
 178     }
 179     
 180     @Test public void checkGraphicPropertyBind() {
 181         ObjectProperty objPr = new SimpleObjectProperty<Node>(null);
 182         Rectangle rect = new Rectangle(10, 20);
 183         toolTip.graphicProperty().bind(objPr);
 184         assertNull("Graphic cannot be bound", toolTip.graphicProperty().getValue());
 185         objPr.setValue(rect);
 186         assertSame("Graphic cannot be bound", toolTip.graphicProperty().getValue(), rect);
 187     }
 188     
 189     @Test public void checkContentDisplayPropertyBind() {
 190         ObjectProperty objPr = new SimpleObjectProperty<ContentDisplay>(null);
 191         ContentDisplay cont = ContentDisplay.GRAPHIC_ONLY;
 192         toolTip.contentDisplayProperty().bind(objPr);
 193         assertNull("ContentDisplay cannot be bound", toolTip.contentDisplayProperty().getValue());
 194         objPr.setValue(cont);
 195         assertSame("ContentDisplay cannot be bound", toolTip.contentDisplayProperty().getValue(), cont);
 196     }
 197     
 198     @Test public void checkGraphicTextGapPropertyBind() {
 199         DoubleProperty objPr = new SimpleDoubleProperty(2.0);
 200         toolTip.graphicTextGapProperty().bind(objPr);
 201         assertEquals("GraphicTextGap cannot be bound", toolTip.graphicTextGapProperty().getValue(), 2.0, 0.0);
 202         objPr.setValue(5.0);
 203         assertEquals("GraphicTextGap cannot be bound", toolTip.graphicTextGapProperty().getValue(), 5.0, 0.0);
 204     }
 205     
 206     @Test public void textPropertyHasBeanReference() {
 207         assertSame(toolTip, toolTip.textProperty().getBean());
 208     }
 209 
 210     @Test public void textPropertyHasName() {
 211         assertEquals("text", toolTip.textProperty().getName());
 212     }
 213 
 214     @Test public void textAlignmentPropertyHasBeanReference() {
 215         assertSame(toolTip, toolTip.textAlignmentProperty().getBean());
 216     }
 217 
 218     @Test public void textAlignmentPropertyHasName() {
 219         assertEquals("textAlignment", toolTip.textAlignmentProperty().getName());
 220     }
 221 
 222     @Test public void textOverrunPropertyHasBeanReference() {
 223         assertSame(toolTip, toolTip.textOverrunProperty().getBean());
 224     }
 225 
 226     @Test public void textOverrunPropertyHasName() {
 227         assertEquals("textOverrun", toolTip.textOverrunProperty().getName());
 228     }
 229 
 230     @Test public void wrapTextPropertyHasBeanReference() {
 231         assertSame(toolTip, toolTip.wrapTextProperty().getBean());
 232     }
 233 
 234     @Test public void wrapTextPropertyHasName() {
 235         assertEquals("wrapText", toolTip.wrapTextProperty().getName());
 236     }
 237     
 238     @Test public void fontPropertyHasBeanReference() {
 239         assertSame(toolTip, toolTip.fontProperty().getBean());
 240     }
 241 
 242     @Test public void fontPropertyHasName() {
 243         assertEquals("font", toolTip.fontProperty().getName());
 244     }
 245 
 246     @Test public void graphicPropertyHasBeanReference() {
 247         assertSame(toolTip, toolTip.graphicProperty().getBean());
 248     }
 249 
 250     @Test public void graphicPropertyHasName() {
 251         assertEquals("graphic", toolTip.graphicProperty().getName());
 252     }
 253 
 254     @Test public void contentDisplayPropertyHasBeanReference() {
 255         assertSame(toolTip, toolTip.contentDisplayProperty().getBean());
 256     }
 257 
 258     @Test public void contentDisplayPropertyHasName() {
 259         assertEquals("contentDisplay", toolTip.contentDisplayProperty().getName());
 260     }
 261 
 262     @Test public void graphicTextGapPropertyHasBeanReference() {
 263         assertSame(toolTip, toolTip.graphicTextGapProperty().getBean());
 264     }
 265 
 266     @Test public void graphicTextGapPropertyHasName() {
 267         assertEquals("graphicTextGap", toolTip.graphicTextGapProperty().getName());
 268     }
 269 
 270     /*********************************************************************
 271      * CSS related Tests                                                 *
 272      ********************************************************************/
 273     @Test public void whenTextAlignmentIsBound_impl_cssSettable_ReturnsFalse() {
 274         CssMetaData styleable = ((StyleableProperty)toolTip.textAlignmentProperty()).getCssMetaData();
 275         assertTrue(styleable.isSettable(toolTip.bridge));
 276         ObjectProperty<TextAlignment> other = new SimpleObjectProperty<TextAlignment>(TextAlignment.JUSTIFY);
 277         toolTip.textAlignmentProperty().bind(other);
 278         assertFalse(styleable.isSettable(toolTip.bridge));
 279     }
 280 
 281     @Test public void whenTextAlignmentIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() {
 282         CssMetaData styleable = ((StyleableProperty)toolTip.textAlignmentProperty()).getCssMetaData();
 283         ((StyleableProperty)toolTip.textAlignmentProperty()).applyStyle(null, TextAlignment.RIGHT);
 284         assertTrue(styleable.isSettable(toolTip.bridge));
 285     }
 286 
 287     @Test public void canSpecifyTextAlignmentViaCSS() {
 288         ((StyleableProperty)toolTip.textAlignmentProperty()).applyStyle(null, TextAlignment.CENTER);
 289         assertSame(TextAlignment.CENTER, toolTip.getTextAlignment());
 290     }
 291   
 292     @Test public void whenTextOverrunIsBound_impl_cssSettable_ReturnsFalse() {
 293         CssMetaData styleable = ((StyleableProperty)toolTip.textOverrunProperty()).getCssMetaData();
 294         assertTrue(styleable.isSettable(toolTip.bridge));
 295         ObjectProperty<OverrunStyle> other = new SimpleObjectProperty<OverrunStyle>(OverrunStyle.LEADING_ELLIPSIS);
 296         toolTip.textOverrunProperty().bind(other);
 297         assertFalse(styleable.isSettable(toolTip.bridge));
 298     }
 299     
 300     @Test public void whenTextOverrunIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() {
 301         CssMetaData styleable = ((StyleableProperty)toolTip.textOverrunProperty()).getCssMetaData();
 302         ((StyleableProperty)toolTip.textOverrunProperty()).applyStyle(null, OverrunStyle.CENTER_ELLIPSIS);
 303         assertTrue(styleable.isSettable(toolTip.bridge));
 304     }
 305     
 306     @Test public void canSpecifyTextOverrunViaCSS() {
 307         ((StyleableProperty)toolTip.textOverrunProperty()).applyStyle(null, OverrunStyle.CLIP);
 308         assertSame(OverrunStyle.CLIP, toolTip.getTextOverrun());
 309     }
 310    
 311     @Test public void whenWrapTextIsBound_impl_cssSettable_ReturnsFalse() {
 312         CssMetaData styleable = ((StyleableProperty)toolTip.wrapTextProperty()).getCssMetaData();
 313         assertTrue(styleable.isSettable(toolTip.bridge));
 314         BooleanProperty other = new SimpleBooleanProperty();
 315         toolTip.wrapTextProperty().bind(other);
 316         assertFalse(styleable.isSettable(toolTip.bridge));
 317     }
 318     
 319     @Test public void whenWrapTextIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() {
 320         CssMetaData styleable = ((StyleableProperty)toolTip.wrapTextProperty()).getCssMetaData();
 321           assertTrue(styleable.isSettable(toolTip.bridge));
 322     }
 323     
 324     @Test public void canSpecifyWrapTextViaCSS() {
 325         ((StyleableProperty)toolTip.wrapTextProperty()).applyStyle(null, Boolean.TRUE);
 326         assertSame(true, toolTip.isWrapText());
 327     }
 328     
 329     @Test public void whenFontIsBound_impl_cssSettable_ReturnsFalse() {
 330         CssMetaData styleable = ((StyleableProperty)toolTip.fontProperty()).getCssMetaData();
 331           assertTrue(styleable.isSettable(toolTip.bridge));
 332         ObjectProperty<Font> other = new SimpleObjectProperty<Font>();
 333         toolTip.fontProperty().bind(other);
 334           assertFalse(styleable.isSettable(toolTip.bridge));
 335     }
 336     
 337     @Test public void whenFontIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() {
 338         CssMetaData styleable = ((StyleableProperty)toolTip.fontProperty()).getCssMetaData();
 339           assertTrue(styleable.isSettable(toolTip.bridge));
 340     }
 341     
 342     @Test public void canSpecifyFontViaCSS() {
 343         ((StyleableProperty)toolTip.fontProperty()).applyStyle(null, Font.getDefault());
 344         assertSame(Font.getDefault(), toolTip.getFont());
 345     }
 346     
 347     @Test public void whenGraphicIsBound_impl_cssSettable_ReturnsFalse() {
 348         CssMetaData styleable = ((StyleableProperty)toolTip.graphicProperty()).getCssMetaData();
 349         assertTrue(styleable.isSettable(toolTip.bridge));
 350         ObjectProperty<Node> other = new SimpleObjectProperty<Node>();
 351         toolTip.graphicProperty().bind(other);
 352           assertFalse(styleable.isSettable(toolTip.bridge));
 353     }
 354     
 355     @Test public void whenGraphicIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() {
 356         CssMetaData styleable = ((StyleableProperty)toolTip.graphicProperty()).getCssMetaData();
 357           assertTrue(styleable.isSettable(toolTip.bridge));
 358     }
 359 
 360     @Ignore("CSS sets graphicProperty indirectly")
 361     @Test public void canSpecifyGraphicViaCSS() {
 362         ((StyleableProperty)toolTip.graphicProperty())
 363                 .applyStyle(null , "../../../../build/classes/com/sun/javafx/scene/control/skin/caspian/menu-shadow.png");
 364         assertNotNull(toolTip.getGraphic());
 365     }
 366 
 367     @Test public void whenContentDisplayIsBound_impl_cssSettable_ReturnsFalse() {
 368         CssMetaData styleable = ((StyleableProperty)toolTip.contentDisplayProperty()).getCssMetaData();
 369           assertTrue(styleable.isSettable(toolTip.bridge));
 370         ObjectProperty<ContentDisplay> other = new SimpleObjectProperty<ContentDisplay>();
 371         toolTip.contentDisplayProperty().bind(other);
 372           assertFalse(styleable.isSettable(toolTip.bridge));
 373     }
 374      @Test public void whenContentDisplayIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() {
 375         CssMetaData styleable = ((StyleableProperty)toolTip.contentDisplayProperty()).getCssMetaData();
 376           assertTrue(styleable.isSettable(toolTip.bridge));
 377     }
 378     
 379     @Test public void canSpecifyContentDisplayViaCSS() {
 380         ((StyleableProperty)toolTip.contentDisplayProperty()).applyStyle(null, ContentDisplay.BOTTOM);
 381         assertSame(toolTip.getContentDisplay(), ContentDisplay.BOTTOM);
 382     }
 383     
 384     @Test public void whenGraphicTextGapIsBound_impl_cssSettable_ReturnsFalse() {
 385         CssMetaData styleable = ((StyleableProperty)toolTip.graphicTextGapProperty()).getCssMetaData();
 386           assertTrue(styleable.isSettable(toolTip.bridge));
 387         DoubleProperty other = new SimpleDoubleProperty();
 388         toolTip.graphicTextGapProperty().bind(other);
 389           assertFalse(styleable.isSettable(toolTip.bridge));
 390     }
 391 
 392     @Test public void whenGraphicTextGapIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() {
 393         CssMetaData styleable = ((StyleableProperty)toolTip.graphicTextGapProperty()).getCssMetaData();
 394           assertTrue(styleable.isSettable(toolTip.bridge));
 395     }
 396 
 397     @Test public void canSpecifyGraphicTextGapViaCSS() {
 398         ((StyleableProperty)toolTip.graphicTextGapProperty()).applyStyle(null, 56.0);
 399         assertEquals(56.0, toolTip.getGraphicTextGap(),0.0);
 400     }
 401 
 402     
 403 
 404     /*********************************************************************
 405      * Miscellaneous Tests                                         *
 406      ********************************************************************/
 407     @Test public void setTextAndSeeValueIsReflectedInModel() {
 408         toolTip.setText("tmp");
 409         assertEquals(toolTip.textProperty().getValue(), "tmp");
 410     }
 411     
 412     @Test public void setTextAndSeeValue() {
 413         toolTip.setText("tmp");
 414         assertEquals(toolTip.getText(), "tmp");
 415     }
 416     
 417     @Test public void setTextAlignmentAndSeeValueIsReflectedInModel() {
 418         toolTip.setTextAlignment(TextAlignment.JUSTIFY);
 419         assertEquals(toolTip.textAlignmentProperty().getValue(), TextAlignment.JUSTIFY);
 420     }
 421 
 422     @Test public void setTextAlignmentAndSeeValue() {
 423         toolTip.setTextAlignment(TextAlignment.JUSTIFY);
 424         assertEquals(toolTip.getTextAlignment(), TextAlignment.JUSTIFY);
 425     }
 426 
 427     @Test public void setTextOverrunAndSeeValueIsReflectedInModel() {
 428         toolTip.setTextOverrun(OverrunStyle.LEADING_ELLIPSIS);
 429         assertEquals(toolTip.textOverrunProperty().getValue(), OverrunStyle.LEADING_ELLIPSIS);
 430     }
 431     
 432     @Test public void setTextOverrunAndSeeValue() {
 433         toolTip.setTextOverrun(OverrunStyle.LEADING_ELLIPSIS);
 434         assertEquals(toolTip.getTextOverrun(), OverrunStyle.LEADING_ELLIPSIS);
 435     }
 436     
 437     @Test public void setWrapTextAndSeeValueIsReflectedInModel() {
 438         toolTip.setWrapText(true);
 439         assertEquals(toolTip.wrapTextProperty().getValue(), true);
 440     }
 441     
 442     @Test public void setWrapTextAndSeeValue() {
 443         toolTip.setWrapText(true);
 444         assertEquals(toolTip.isWrapText(), true);
 445     }
 446     
 447     @Test public void setFontAndSeeValueIsReflectedInModel() {
 448         toolTip.setFont(Font.getDefault());
 449         assertEquals(toolTip.fontProperty().getValue(), Font.getDefault());
 450     }
 451     
 452     @Test public void setFontAndSeeValue() {
 453         toolTip.setFont(Font.getDefault());
 454         assertEquals(toolTip.getFont(), Font.getDefault());
 455     }
 456     
 457     @Test public void setGraphicAndSeeValueIsReflectedInModel() {
 458         Rectangle rect = new Rectangle();
 459         toolTip.setGraphic(rect);
 460         assertEquals(toolTip.graphicProperty().getValue(), rect);
 461     }
 462     
 463     @Test public void setGraphicAndSeeValue() {
 464         Rectangle rect = new Rectangle();
 465         toolTip.setGraphic(rect);
 466         assertEquals(toolTip.getGraphic(), rect);
 467     }
 468     
 469     @Test public void setContentDiaplyAndSeeValueIsReflectedInModel() {
 470         ContentDisplay cont = ContentDisplay.BOTTOM;
 471         toolTip.setContentDisplay(cont);
 472         assertEquals(toolTip.contentDisplayProperty().getValue(), cont);
 473     }
 474     
 475     @Test public void setContentDisplayAndSeeValue() {
 476         ContentDisplay cont = ContentDisplay.TEXT_ONLY;
 477         toolTip.setContentDisplay(cont);
 478         assertEquals(toolTip.getContentDisplay(), cont);
 479     }
 480     
 481     @Test public void setGraphicTextGapAndSeeValueIsReflectedInModel() {
 482         toolTip.setGraphicTextGap(32.0);
 483         assertEquals(toolTip.graphicTextGapProperty().getValue(), 32.0, 0.0);
 484     }
 485     
 486     @Test public void setGraphicTextGapAndSeeValue() {
 487         toolTip.setGraphicTextGap(28.0);
 488         assertEquals(toolTip.getGraphicTextGap(), 28.0, 0.0);
 489     }
 490     
 491     @Test public void installOnSingleNode() {
 492         try {
 493             Rectangle rect = new Rectangle(0, 0, 100, 100);
 494             Tooltip.install(rect, toolTip);
 495         } catch (Exception e) {//Catch a generic Exception coz we dont know what
 496             fail("Could not install tooltip on a Node");
 497         }
 498     }
 499 
 500     @Test public void installSameTooltipOnManyNodes() {
 501         try {
 502             Rectangle rect1 = new Rectangle(0, 0, 100, 100);
 503             Rectangle rect2 = new Rectangle(0, 0, 100, 100);
 504             Tooltip.install(rect1, toolTip);
 505             Tooltip.install(rect2, toolTip);
 506         } catch (Exception e) {//Catch a generic Exception coz we dont know what
 507             fail("Could not install same tooltip on many Node");
 508         }
 509     }
 510 
 511     @Test public void uninstallOnSingleNode() {
 512         try {
 513             Rectangle rect = new Rectangle(0, 0, 100, 100);
 514             Tooltip.install(rect, toolTip);
 515             Tooltip.uninstall(rect, toolTip);
 516         } catch (Exception e) {//Catch a generic Exception coz we dont know what
 517             fail("Could not uninstall tooltip on a Node");
 518         }
 519     }
 520 
 521     @Test public void uninstallSameTooltipOnManyNodes() {
 522         try {
 523             Rectangle rect1 = new Rectangle(0, 0, 100, 100);
 524             Rectangle rect2 = new Rectangle(0, 0, 100, 100);
 525             Tooltip.install(rect1, toolTip);
 526             Tooltip.install(rect2, toolTip);
 527             Tooltip.uninstall(rect1, toolTip);
 528             Tooltip.uninstall(rect2, toolTip);
 529         } catch (Exception e) {//Catch a generic Exception coz we dont know what
 530             fail("Could not uninstall same tooltip on many Node");
 531         }
 532     }
 533     
 534     
 535 }