Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5876,7 +5876,7 @@ public final ObjectProperty<NodeOrientation> nodeOrientationProperty() {
@Override
protected void invalidated() {
sceneEffectiveOrientationInvalidated();
getRoot().applyCss();
getRoot().reapplyCSS();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
/**
* Test :dir functional pseudo-class
*/
@Disabled("JDK-8234152")
public class Node_effectiveOrientation_Css_Test {

private Group root;
Expand Down Expand Up @@ -119,8 +118,9 @@ public void test_SimpleSelector_dir_pseudoClass_with_scene_effective_orientation
assertEquals(Color.web("#ff0000"), rect.getFill());
}

@Disabled("JDK-8234152")
@Test
public void test_CompounSelector_dir_pseudoClass_on_parent_with_scene_effective_orientation_ltr() {
public void test_CompoundSelector_dir_pseudoClass_on_parent_with_scene_effective_orientation_ltr() {
Stylesheet stylesheet = new CssParser().parse(
".root:dir(rtl) .rect { -fx-fill: #ff0000; }" +
".root:dir(ltr) .rect { -fx-fill: #00ff00; }" +
Expand All @@ -139,6 +139,8 @@ public void test_CompounSelector_dir_pseudoClass_on_parent_with_scene_effective_
assertEquals(Color.web("#00ff00"), rect.getFill());
}


@Disabled("JDK-8234152")
@Test
public void test_CompoundSelector_dir_pseudoClass_on_parent_with_scene_effective_orientation_rtl() {
Stylesheet stylesheet = new CssParser().parse(
Expand All @@ -160,8 +162,9 @@ public void test_CompoundSelector_dir_pseudoClass_on_parent_with_scene_effective
assertEquals(Color.web("#ff0000"), rect.getFill());
}

@Disabled("JDK-8234152")
@Test
public void test_CompounSelector_dir_pseudoClass_on_child_with_scene_effective_orientation_ltr() {
public void test_CompoundSelector_dir_pseudoClass_on_child_with_scene_effective_orientation_ltr() {
Stylesheet stylesheet = new CssParser().parse(
".root .rect:dir(rtl) { -fx-fill: #ff0000; }" +
".root .rect:dir(ltr) { -fx-fill: #00ff00; }" +
Expand All @@ -180,6 +183,7 @@ public void test_CompounSelector_dir_pseudoClass_on_child_with_scene_effective_o
assertEquals(Color.web("#00ff00"), rect.getFill());
}

@Disabled("JDK-8234152")
@Test
public void test_CompoundSelector_dir_pseudoClass_on_child_with_scene_effective_orientation_rtl() {
Stylesheet stylesheet = new CssParser().parse(
Expand Down Expand Up @@ -236,4 +240,35 @@ public void test_dir_pseudoClass_functions_on_scene_effective_orientation_not_no

}

@Test
public void testChangeNodeOrientationWillReapplyCss() {
Group root = new Group();
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.setScene(scene);
stage.show();

Stylesheet stylesheet = new CssParser().parse(
".rect:dir(rtl) { -fx-fill: #ff0000; }" +
".rect:dir(ltr) { -fx-fill: #00ff00; }" +
".rect { -fx-fill: #0000ff; }"
);
StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);

Rectangle rect = new Rectangle();
rect.getStyleClass().add("rect");
root.getChildren().add(rect);

root.applyCss();
assertEquals(Color.web("#00ff00"), rect.getFill());

scene.setNodeOrientation(RIGHT_TO_LEFT);
root.applyCss();
assertEquals(Color.web("#ff0000"), rect.getFill());

scene.setNodeOrientation(LEFT_TO_RIGHT);
root.applyCss();
assertEquals(Color.web("#00ff00"), rect.getFill());
}

}