Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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,6 +118,7 @@ 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() {
Stylesheet stylesheet = new CssParser().parse(
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,6 +162,7 @@ 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() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While here, can we fix the typo in test_Compoun -> test_Compound here and some other tests aswell

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the 2 Compun - couldn't find another spelling error.

Stylesheet stylesheet = new CssParser().parse(
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 testCssUpdates() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should name it similar as what you wrote in your description - maybe testChangeNodeOrientationWillReapplyCss or testChangeNodeOrientationWillBatchReapplyCss

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's now named 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());
}

}