changeset 2387:98e5c590c68b

Fix for RT-27845: Node Orientation - Limit effective node orientation change propagation
author Lubomir Nerad <lubomir.nerad@oracle.com>
date Mon, 28 Jan 2013 17:40:59 +0100
parents 9eb16f567526
children 90db22b31775
files javafx-ui-common/src/com/sun/javafx/scene/SceneHelper.java javafx-ui-common/src/javafx/scene/Node.java javafx-ui-common/src/javafx/scene/Parent.java javafx-ui-common/src/javafx/scene/Scene.java javafx-ui-common/src/javafx/stage/PopupWindow.java javafx-ui-common/src/javafx/stage/Stage.java javafx-ui-common/test/unit/com/sun/javafx/test/NodeOrientationTestBase.java javafx-ui-common/test/unit/com/sun/javafx/test/OrientationHelper.java javafx-ui-common/test/unit/javafx/scene/Node_effectiveOrientation_Test.java javafx-ui-common/test/unit/javafx/scene/Node_hasMirroring_Test.java
diffstat 10 files changed, 286 insertions(+), 270 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/com/sun/javafx/scene/SceneHelper.java	Sun Jan 27 15:09:27 2013 +0200
+++ b/javafx-ui-common/src/com/sun/javafx/scene/SceneHelper.java	Mon Jan 28 17:40:59 2013 +0100
@@ -44,8 +44,9 @@
         sceneAccessor.setPaused(paused);
     }
 
-    public static void parentEffectiveOrientationChanged(final Scene scene) {
-        sceneAccessor.parentEffectiveOrientationChanged(scene);
+    public static void parentEffectiveOrientationInvalidated(
+            final Scene scene) {
+        sceneAccessor.parentEffectiveOrientationInvalidated(scene);
     }
 
     public static void setSceneAccessor(final SceneAccessor newAccessor) {
@@ -59,7 +60,7 @@
     public interface SceneAccessor {
         void setPaused(boolean paused);
 
-        void parentEffectiveOrientationChanged(Scene scene);
+        void parentEffectiveOrientationInvalidated(Scene scene);
     }
 
     private static void forceInit(final Class<?> classToInit) {
--- a/javafx-ui-common/src/javafx/scene/Node.java	Sun Jan 27 15:09:27 2013 +0200
+++ b/javafx-ui-common/src/javafx/scene/Node.java	Mon Jan 28 17:40:59 2013 +0100
@@ -705,7 +705,7 @@
                     updateTreeVisible();
                     oldParent = newParent;
                     invalidateLocalToSceneTransform();
-                    parentEffectiveOrientationChanged();
+                    parentResolvedOrientationInvalidated();
                 }
 
                 @Override
@@ -775,7 +775,7 @@
             }
             if (getParent() == null) {
                 // if we are the root we need to handle scene change
-                parentEffectiveOrientationChanged();
+                parentResolvedOrientationInvalidated();
             }
 
             oldScene = _scene;
@@ -5195,8 +5195,10 @@
     private ObjectProperty<NodeOrientation> nodeOrientation;
     private EffectiveOrientationProperty effectiveNodeOrientationProperty;
 
-    private NodeOrientation effectiveNodeOrientation;
-    private NodeOrientation automaticNodeOrientation;
+    private NodeOrientation effectiveNodeOrientation =
+            NodeOrientation.LEFT_TO_RIGHT;
+    private NodeOrientation automaticNodeOrientation =
+            NodeOrientation.LEFT_TO_RIGHT;
 
     public final void setNodeOrientation(NodeOrientation orientation) {
         nodeOrientationProperty().set(orientation);
@@ -5222,7 +5224,7 @@
             nodeOrientation = new StyleableObjectProperty<NodeOrientation>(NodeOrientation.INHERIT) {
                 @Override
                 protected void invalidated() {
-                    nodeEffectiveOrientationChanged();
+                    nodeResolvedOrientationInvalidated();
                 }
                 
                 @Override
@@ -5247,10 +5249,6 @@
     }
 
     public final NodeOrientation getEffectiveNodeOrientation() {
-        if (effectiveNodeOrientation == null) {
-            effectiveNodeOrientation = calcEffectiveNodeOrientation();
-        }
-
         return effectiveNodeOrientation;
     }
 
@@ -5285,32 +5283,44 @@
     }
 
     NodeOrientation getAutomaticNodeOrientation() {
-        if (automaticNodeOrientation == null) {
-            automaticNodeOrientation = calcAutomaticNodeOrientation();
-        }
-
         return automaticNodeOrientation;
     }
 
-    final void parentEffectiveOrientationChanged() {
+    final void parentResolvedOrientationInvalidated() {
         if (getNodeOrientation() == NodeOrientation.INHERIT) {
-            nodeEffectiveOrientationChanged();
+            nodeResolvedOrientationInvalidated();
         } else {
             // mirroring changed
             impl_transformsChanged();
         }
     }
 
-    void nodeEffectiveOrientationChanged() {
-        effectiveNodeOrientation = null;
-        automaticNodeOrientation = null;
-
-        if (effectiveNodeOrientationProperty != null) {
+    final void nodeResolvedOrientationInvalidated() {
+        final NodeOrientation oldEffectiveNodeOrientation =
+                effectiveNodeOrientation;
+        final NodeOrientation oldAutomaticNodeOrientation =
+                automaticNodeOrientation;
+
+        effectiveNodeOrientation = calcEffectiveNodeOrientation();
+        automaticNodeOrientation = calcAutomaticNodeOrientation();
+
+        if ((effectiveNodeOrientationProperty != null)
+                && (effectiveNodeOrientation != oldEffectiveNodeOrientation)) {
             effectiveNodeOrientationProperty.invalidate();
         }
 
         // mirroring changed
         impl_transformsChanged();
+
+        if ((effectiveNodeOrientation
+                    != oldEffectiveNodeOrientation)
+                || (automaticNodeOrientation != oldAutomaticNodeOrientation)) {
+            nodeResolvedOrientationChanged();
+        }
+    }
+
+    void nodeResolvedOrientationChanged() {
+        // overriden in Parent
     }
 
     private NodeOrientation calcEffectiveNodeOrientation() {
--- a/javafx-ui-common/src/javafx/scene/Parent.java	Sun Jan 27 15:09:27 2013 +0200
+++ b/javafx-ui-common/src/javafx/scene/Parent.java	Mon Jan 28 17:40:59 2013 +0100
@@ -1223,11 +1223,9 @@
     }
 
     @Override
-    void nodeEffectiveOrientationChanged() {
-        super.nodeEffectiveOrientationChanged();
-
+    void nodeResolvedOrientationChanged() {
         for (int i = 0, max = children.size(); i < max; ++i) {
-            children.get(i).parentEffectiveOrientationChanged();
+            children.get(i).parentResolvedOrientationInvalidated();
         }
     }
 
--- a/javafx-ui-common/src/javafx/scene/Scene.java	Sun Jan 27 15:09:27 2013 +0200
+++ b/javafx-ui-common/src/javafx/scene/Scene.java	Mon Jan 28 17:40:59 2013 +0100
@@ -342,9 +342,9 @@
                         }
                         
                         @Override
-                        public void parentEffectiveOrientationChanged(
+                        public void parentEffectiveOrientationInvalidated(
                                 final Scene scene) {
-                            scene.parentEffectiveOrientationChanged();
+                            scene.parentEffectiveOrientationInvalidated();
                         }
                     });
         }
@@ -610,7 +610,7 @@
                     if (newWindow != null) {
                         impl_initPeer();
                     }
-                    parentEffectiveOrientationChanged();
+                    parentEffectiveOrientationInvalidated();
 
                     oldWindow = newWindow;
                 }
@@ -5615,7 +5615,7 @@
             nodeOrientation = new StyleableObjectProperty<NodeOrientation>(defaultNodeOrientation) {
                 @Override
                 protected void invalidated() {
-                    sceneEffectiveOrientationChanged();
+                    sceneEffectiveOrientationInvalidated();
                 }
 
                 @Override
@@ -5660,20 +5660,20 @@
         return effectiveNodeOrientationProperty;
     }
 
-    private void parentEffectiveOrientationChanged() {
+    private void parentEffectiveOrientationInvalidated() {
         if (getNodeOrientation() == NodeOrientation.INHERIT) {
-            sceneEffectiveOrientationChanged();
-        }
-    }
-
-    private void sceneEffectiveOrientationChanged() {
+            sceneEffectiveOrientationInvalidated();
+        }
+    }
+
+    private void sceneEffectiveOrientationInvalidated() {
         effectiveNodeOrientation = null;
 
         if (effectiveNodeOrientationProperty != null) {
             effectiveNodeOrientationProperty.invalidate();
         }
 
-        getRoot().parentEffectiveOrientationChanged();
+        getRoot().parentResolvedOrientationInvalidated();
     }
 
     private NodeOrientation calcEffectiveNodeOrientation() {
--- a/javafx-ui-common/src/javafx/stage/PopupWindow.java	Sun Jan 27 15:09:27 2013 +0200
+++ b/javafx-ui-common/src/javafx/stage/PopupWindow.java	Mon Jan 28 17:40:59 2013 +0100
@@ -363,7 +363,7 @@
 
         final Scene sceneValue = getScene();
         if (sceneValue != null) {
-            SceneHelper.parentEffectiveOrientationChanged(sceneValue);
+            SceneHelper.parentEffectiveOrientationInvalidated(sceneValue);
         }
 
         // It is required that the root window exist and be visible to show the popup.
--- a/javafx-ui-common/src/javafx/stage/Stage.java	Sun Jan 27 15:09:27 2013 +0200
+++ b/javafx-ui-common/src/javafx/stage/Stage.java	Mon Jan 28 17:40:59 2013 +0100
@@ -502,7 +502,7 @@
         
         final Scene sceneValue = getScene();
         if (sceneValue != null) {
-            SceneHelper.parentEffectiveOrientationChanged(sceneValue);
+            SceneHelper.parentEffectiveOrientationInvalidated(sceneValue);
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/test/unit/com/sun/javafx/test/NodeOrientationTestBase.java	Mon Jan 28 17:40:59 2013 +0100
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * 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.test;
+
+import java.util.List;
+import javafx.geometry.NodeOrientation;
+import javafx.scene.Group;
+import javafx.scene.Node;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+
+public abstract class NodeOrientationTestBase {
+    protected NodeOrientationTestBase() {
+    }
+
+    public interface StateEncoder {
+        char map(Scene scene);
+        char map(Node node);
+    }
+
+    protected static Scene ltrScene(final Parent rootNode) {
+        final Scene scene = new Scene(rootNode);
+        scene.setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
+        return scene;
+    }
+
+    protected static Group ltrAutGroup(final Node... childNodes) {
+        return autGroup(NodeOrientation.LEFT_TO_RIGHT, childNodes);
+    }
+
+    protected static Group rtlAutGroup(final Node... childNodes) {
+        return autGroup(NodeOrientation.RIGHT_TO_LEFT, childNodes);
+    }
+
+    protected static Group inhAutGroup(final Node... childNodes) {
+        return autGroup(NodeOrientation.INHERIT, childNodes);
+    }
+
+    protected static Group ltrManGroup(final Node... childNodes) {
+        return manGroup(NodeOrientation.LEFT_TO_RIGHT, childNodes);
+    }
+
+    protected static Group rtlManGroup(final Node... childNodes) {
+        return manGroup(NodeOrientation.RIGHT_TO_LEFT, childNodes);
+    }
+
+    protected static Group inhManGroup(final Node... childNodes) {
+        return manGroup(NodeOrientation.INHERIT, childNodes);
+    }
+
+    protected static void updateOrientation(final Scene scene,
+                                            final String updateString) {
+        final NodeOrientation update =
+                decode(updateString.charAt(0));
+        if (update != null) {
+            scene.setNodeOrientation(update);
+        }
+
+        final Node rootNode = scene.getRoot();
+        if (rootNode != null) {
+            updateOrientation(rootNode, updateString, 1);
+        }
+    }
+
+    protected static String collectState(final Scene scene,
+                                         final StateEncoder encoder) {
+        final StringBuilder dest = new StringBuilder();
+        collectState(dest, scene, encoder);
+        return dest.toString();
+    }
+
+    protected static String collectState(final Node node,
+                                         final StateEncoder encoder) {
+        final StringBuilder dest = new StringBuilder();
+        collectState(dest, node, encoder);
+        return dest.toString();
+    }
+
+    private static Group autGroup(final NodeOrientation nodeOrientation,
+                                  final Node... childNodes) {
+        final Group group = new Group();
+        group.setNodeOrientation(nodeOrientation);
+        group.getChildren().setAll(childNodes);
+
+        return group;
+    }
+
+    private static Group manGroup(final NodeOrientation nodeOrientation,
+                                  final Node... childNodes) {
+        final Group group = new Group() {
+                                    @Override
+                                    public boolean isAutomaticallyMirrored() {
+                                        return false;
+                                    }
+                                };
+        group.setNodeOrientation(nodeOrientation);
+        group.getChildren().setAll(childNodes);
+
+        return group;
+    }
+
+    private static int updateOrientation(final Node node,
+                                         final String updateString,
+                                         final int index) {
+        final NodeOrientation update =
+                decode(updateString.charAt(index));
+        if (update != null) {
+            node.setNodeOrientation(update);
+        }
+
+        int nextIndex = index + 1;
+        if (node instanceof Parent) {
+            final List<Node> childNodes =
+                    ((Parent) node).getChildrenUnmodifiable();
+            for (final Node childNode: childNodes) {
+                nextIndex = updateOrientation(childNode, updateString,
+                                              nextIndex);
+            }
+        }
+
+        return nextIndex;
+    }
+
+    private static NodeOrientation decode(final char updateChar) {
+        switch (updateChar) {
+            case '.':
+                return null;
+            case 'L':
+                return NodeOrientation.LEFT_TO_RIGHT;
+            case 'R':
+                return NodeOrientation.RIGHT_TO_LEFT;
+            case 'I':
+                return NodeOrientation.INHERIT;
+            default:
+                throw new IllegalArgumentException("Invalid update character");
+        }
+    }
+
+    private static void collectState(final StringBuilder dest,
+                                     final Scene scene,
+                                     final StateEncoder encoder) {
+        dest.append(encoder.map(scene));
+        final Node rootNode = scene.getRoot();
+        if (rootNode != null) {
+            collectState(dest, rootNode, encoder);
+        }
+    }
+
+    private static void collectState(final StringBuilder dest,
+                                     final Node node,
+                                     final StateEncoder encoder) {
+        dest.append(encoder.map(node));
+        if (node instanceof Parent) {
+            final List<Node> childNodes =
+                    ((Parent) node).getChildrenUnmodifiable();
+            for (final Node childNode: childNodes) {
+                collectState(dest, childNode, encoder);
+            }
+        }
+    }
+}
--- a/javafx-ui-common/test/unit/com/sun/javafx/test/OrientationHelper.java	Sun Jan 27 15:09:27 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * 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.test;
-
-import java.util.List;
-import javafx.geometry.NodeOrientation;
-import javafx.scene.Node;
-import javafx.scene.Parent;
-import javafx.scene.Scene;
-
-public final class OrientationHelper {
-    private OrientationHelper() {
-    }
-
-    public interface StateEncoder {
-        char map(Scene scene);
-        char map(Node node);
-    }
-
-    public static void updateOrientation(final Scene scene,
-                                         final String updateString) {
-        final NodeOrientation update =
-                decode(updateString.charAt(0));
-        if (update != null) {
-            scene.setNodeOrientation(update);
-        }
-
-        final Node rootNode = scene.getRoot();
-        if (rootNode != null) {
-            updateOrientation(rootNode, updateString, 1);
-        }
-    }
-
-    public static String collectState(final Scene scene,
-                                      final StateEncoder encoder) {
-        final StringBuilder dest = new StringBuilder();
-        collectState(dest, scene, encoder);
-        return dest.toString();
-    }
-
-    public static String collectState(final Node node,
-                                      final StateEncoder encoder) {
-        final StringBuilder dest = new StringBuilder();
-        collectState(dest, node, encoder);
-        return dest.toString();
-    }
-
-    private static int updateOrientation(final Node node,
-                                         final String updateString,
-                                         final int index) {
-        final NodeOrientation update =
-                decode(updateString.charAt(index));
-        if (update != null) {
-            node.setNodeOrientation(update);
-        }
-
-        int nextIndex = index + 1;
-        if (node instanceof Parent) {
-            final List<Node> childNodes =
-                    ((Parent) node).getChildrenUnmodifiable();
-            for (final Node childNode: childNodes) {
-                nextIndex = updateOrientation(childNode, updateString,
-                                              nextIndex);
-            }
-        }
-
-        return nextIndex;
-    }
-
-    private static NodeOrientation decode(final char updateChar) {
-        switch (updateChar) {
-            case '.':
-                return null;
-            case 'L':
-                return NodeOrientation.LEFT_TO_RIGHT;
-            case 'R':
-                return NodeOrientation.RIGHT_TO_LEFT;
-            case 'I':
-                return NodeOrientation.INHERIT;
-            default:
-                throw new IllegalArgumentException("Invalid update character");
-        }
-    }
-
-    private static void collectState(final StringBuilder dest,
-                                     final Scene scene,
-                                     final StateEncoder encoder) {
-        dest.append(encoder.map(scene));
-        final Node rootNode = scene.getRoot();
-        if (rootNode != null) {
-            collectState(dest, rootNode, encoder);
-        }
-    }
-
-    private static void collectState(final StringBuilder dest,
-                                     final Node node,
-                                     final StateEncoder encoder) {
-        dest.append(encoder.map(node));
-        if (node instanceof Parent) {
-            final List<Node> childNodes =
-                    ((Parent) node).getChildrenUnmodifiable();
-            for (final Node childNode: childNodes) {
-                collectState(dest, childNode, encoder);
-            }
-        }
-    }
-
-}
--- a/javafx-ui-common/test/unit/javafx/scene/Node_effectiveOrientation_Test.java	Sun Jan 27 15:09:27 2013 +0200
+++ b/javafx-ui-common/test/unit/javafx/scene/Node_effectiveOrientation_Test.java	Mon Jan 28 17:40:59 2013 +0100
@@ -25,8 +25,7 @@
 
 package javafx.scene;
 
-import com.sun.javafx.test.OrientationHelper;
-import com.sun.javafx.test.OrientationHelper.StateEncoder;
+import com.sun.javafx.test.NodeOrientationTestBase;
 import java.util.Arrays;
 import java.util.Collection;
 import javafx.geometry.NodeOrientation;
@@ -37,18 +36,29 @@
 import org.junit.runners.Parameterized.Parameters;
 
 @RunWith(Parameterized.class)
-public final class Node_effectiveOrientation_Test {
+public final class Node_effectiveOrientation_Test
+        extends NodeOrientationTestBase {
     private final Scene testScene;
     private final String orientationUpdate;
     private final String expectedOrientation;
 
     private static Scene lriiliScene() {
-        return ltrScene(rtlGroup(inhGroup(inhGroup(ltrGroup(inhGroup())))));
+        return ltrScene(
+                   rtlAutGroup(
+                       inhAutGroup(
+                           inhAutGroup(
+                               ltrAutGroup(
+                                   inhAutGroup())))));
     }
 
     private static Scene liirliPrecachedScene() {
         final Scene scene =
-                ltrScene(inhGroup(inhGroup(rtlGroup(ltrGroup(inhGroup())))));
+                ltrScene(
+                    inhAutGroup(
+                        inhAutGroup(
+                            rtlAutGroup(
+                                ltrAutGroup(
+                                    inhAutGroup())))));
         // force caching
         collectOrientation(scene);
         return scene;
@@ -56,7 +66,11 @@
 
     private static Scene riirliPlugedPrecachedScenegraphScene() {
         final Group root =
-                inhGroup(inhGroup(rtlGroup(ltrGroup(inhGroup()))));
+                inhAutGroup(
+                    inhAutGroup(
+                        rtlAutGroup(
+                            ltrAutGroup(
+                                inhAutGroup()))));
         // force caching
         collectOrientation(root);
 
@@ -67,6 +81,15 @@
         return scene;
     }
 
+    private static Scene lrIiilScene() {
+        return ltrScene(
+                   rtlAutGroup(
+                       inhManGroup(
+                           inhAutGroup(
+                               inhAutGroup(
+                                   ltrAutGroup())))));
+    }
+
     /*
      * Parameters: [testScene], [orientationUpdate], [expectedOrientation]
      */
@@ -88,7 +111,10 @@
                         {
                             riirliPlugedPrecachedScenegraphScene(),
                             "......", "RRRRLL"
-                        }
+                        },
+
+                        { lrIiilScene(), "......", "LRRRRL" },
+                        { lrIiilScene(), ".L....", "LLLLLL" }
                     });
     }
 
@@ -103,37 +129,10 @@
 
     @Test
     public void effectiveOrientationTest() {
-        OrientationHelper.updateOrientation(testScene, orientationUpdate);
+        updateOrientation(testScene, orientationUpdate);
         assertOrientation(testScene, expectedOrientation);
     }
 
-    private static Scene ltrScene(final Parent rootNode) {
-        final Scene scene = new Scene(rootNode);
-        scene.setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
-        return scene;
-    }
-
-    private static Group ltrGroup(final Node... childNodes) {
-        return group(NodeOrientation.LEFT_TO_RIGHT, childNodes);
-    }
-
-    private static Group rtlGroup(final Node... childNodes) {
-        return group(NodeOrientation.RIGHT_TO_LEFT, childNodes);
-    }
-
-    private static Group inhGroup(final Node... childNodes) {
-        return group(NodeOrientation.INHERIT, childNodes);
-    }
-
-    private static Group group(final NodeOrientation nodeOrientation,
-                               final Node... childNodes) {
-        final Group group = new Group();
-        group.setNodeOrientation(nodeOrientation);
-        group.getChildren().setAll(childNodes);
-
-        return group;
-    }
-
     private static void assertOrientation(
             final Scene scene,
             final String expectedOrientation) {
@@ -168,13 +167,11 @@
             };
 
     private static String collectOrientation(final Scene scene) {
-        return OrientationHelper.collectState(scene,
-                                              EFFECTIVE_ORIENTATION_ENCODER);
+        return collectState(scene, EFFECTIVE_ORIENTATION_ENCODER);
     }
 
     private static String collectOrientation(final Node node) {
-        return OrientationHelper.collectState(node,
-                                              EFFECTIVE_ORIENTATION_ENCODER);
+        return collectState(node, EFFECTIVE_ORIENTATION_ENCODER);
     }
 
 }
--- a/javafx-ui-common/test/unit/javafx/scene/Node_hasMirroring_Test.java	Sun Jan 27 15:09:27 2013 +0200
+++ b/javafx-ui-common/test/unit/javafx/scene/Node_hasMirroring_Test.java	Mon Jan 28 17:40:59 2013 +0100
@@ -25,11 +25,9 @@
 
 package javafx.scene;
 
-import com.sun.javafx.test.OrientationHelper;
-import com.sun.javafx.test.OrientationHelper.StateEncoder;
+import com.sun.javafx.test.NodeOrientationTestBase;
 import java.util.Arrays;
 import java.util.Collection;
-import javafx.geometry.NodeOrientation;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -37,7 +35,7 @@
 import org.junit.runners.Parameterized.Parameters;
 
 @RunWith(Parameterized.class)
-public final class Node_hasMirroring_Test {
+public final class Node_hasMirroring_Test extends NodeOrientationTestBase {
     private final Scene testScene;
     private final String orientationUpdate;
     private final String expectedMirroring;
@@ -69,6 +67,15 @@
                                    rtlAutGroup())))));
     }
 
+    private static Scene lrIiilScene() {
+        return ltrScene(
+                   rtlAutGroup(
+                       inhManGroup(
+                           inhAutGroup(
+                               inhAutGroup(
+                                   ltrAutGroup())))));
+    }
+
     /*
      * Parameters: [testScene], [orientationUpdate], [expectedMirroring]
      */
@@ -85,7 +92,10 @@
                         /* effective: LRRRLL, automatic: LRLLLL */
                         { lrIiliScene(), "......", ".MM..." },
                         /* effective: LRLRLR, automatic: LRLLLR */
-                        { lrLRlrScene(), "......", ".MM..M" }
+                        { lrLRlrScene(), "......", ".MM..M" },
+
+                        /* effective: LRRRRL, automatic: LRLRRL */
+                        { lrIiilScene(), "...R..", ".MMM.M" },
                     });
     }
 
@@ -100,63 +110,10 @@
 
     @Test
     public void hasMirroringTest() {
-        OrientationHelper.updateOrientation(testScene, orientationUpdate);
+        updateOrientation(testScene, orientationUpdate);
         assertMirroring(testScene, expectedMirroring);
     }
 
-    private static Scene ltrScene(final Parent rootNode) {
-        final Scene scene = new Scene(rootNode);
-        scene.setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
-        return scene;
-    }
-
-    private static Group ltrAutGroup(final Node... childNodes) {
-        return autGroup(NodeOrientation.LEFT_TO_RIGHT, childNodes);
-    }
-
-    private static Group rtlAutGroup(final Node... childNodes) {
-        return autGroup(NodeOrientation.RIGHT_TO_LEFT, childNodes);
-    }
-
-    private static Group inhAutGroup(final Node... childNodes) {
-        return autGroup(NodeOrientation.INHERIT, childNodes);
-    }
-
-    private static Group ltrManGroup(final Node... childNodes) {
-        return manGroup(NodeOrientation.LEFT_TO_RIGHT, childNodes);
-    }
-
-    private static Group rtlManGroup(final Node... childNodes) {
-        return manGroup(NodeOrientation.RIGHT_TO_LEFT, childNodes);
-    }
-
-    private static Group inhManGroup(final Node... childNodes) {
-        return manGroup(NodeOrientation.INHERIT, childNodes);
-    }
-
-    private static Group autGroup(final NodeOrientation nodeOrientation,
-                                  final Node... childNodes) {
-        final Group group = new Group();
-        group.setNodeOrientation(nodeOrientation);
-        group.getChildren().setAll(childNodes);
-
-        return group;
-    }
-
-    private static Group manGroup(final NodeOrientation nodeOrientation,
-                                  final Node... childNodes) {
-        final Group group = new Group() {
-                                    @Override
-                                    public boolean isAutomaticallyMirrored() {
-                                        return false;
-                                    }
-                                };
-        group.setNodeOrientation(nodeOrientation);
-        group.getChildren().setAll(childNodes);
-
-        return group;
-    }
-
     private static void assertMirroring(
             final Scene scene,
             final String expectedMirroring) {
@@ -184,6 +141,6 @@
             };
 
     private static String collectMirroring(final Scene scene) {
-        return OrientationHelper.collectState(scene, HAS_MIRRORING_ENCODER);
+        return collectState(scene, HAS_MIRRORING_ENCODER);
     }
 }