modules/controls/src/test/java/javafx/scene/control/skin/SeparatorSkinTest.java
Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization
*** 21,35 ****
* 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 com.sun.javafx.scene.control.skin;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.geometry.VPos;
import javafx.scene.control.Separator;
--- 21,37 ----
* 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 javafx.scene.control.skin;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+
+ import javafx.beans.value.ObservableValue;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.geometry.VPos;
import javafx.scene.control.Separator;
*** 65,88 ****
--- 67,93 ----
* Tests for change notification *
* *
***************************************************************************/
@Test public void orientationChangesOnSeparatorShouldInvoke_handleControlPropertyChanged() {
+ skin.addWatchedProperty(separator.orientationProperty());
assertFalse(skin.propertyChanged); // sanity check
separator.setOrientation(Orientation.VERTICAL);
assertTrue(skin.propertyChanged);
assertEquals(1, skin.propertyChangeCount); // sanity check
}
@Test public void halignmentChangesOnSeparatorShouldInvoke_handleControlPropertyChanged() {
+ skin.addWatchedProperty(separator.halignmentProperty());
assertFalse(skin.propertyChanged); // sanity check
separator.setHalignment(HPos.RIGHT);
assertTrue(skin.propertyChanged);
assertEquals(1, skin.propertyChangeCount); // sanity check
}
@Test public void valignmentChangesOnSeparatorShouldInvoke_handleControlPropertyChanged() {
+ skin.addWatchedProperty(separator.valignmentProperty());
assertFalse(skin.propertyChanged); // sanity check
separator.setValignment(VPos.BASELINE);
assertTrue(skin.propertyChanged);
assertEquals(1, skin.propertyChangeCount); // sanity check
}
*** 221,234 ****
int propertyChangeCount = 0;
public SeparatorSkinMock(Separator sep) {
super(sep);
}
! @Override protected void handleControlPropertyChanged(String p) {
! super.handleControlPropertyChanged(p);
propertyChanged = true;
propertyChangeCount++;
}
}
}
--- 226,240 ----
int propertyChangeCount = 0;
public SeparatorSkinMock(Separator sep) {
super(sep);
}
! public void addWatchedProperty(ObservableValue<?> p) {
! p.addListener(o -> {
propertyChanged = true;
propertyChangeCount++;
+ });
}
}
}