Add z-reordering support to OpReorderer

Change-Id: I3fa969fe53cf648d145810f69fa7dada376c0b9a
diff --git a/libs/hwui/unit_tests/TestUtils.h b/libs/hwui/unit_tests/TestUtils.h
index 0cf8040..28e0fd8 100644
--- a/libs/hwui/unit_tests/TestUtils.h
+++ b/libs/hwui/unit_tests/TestUtils.h
@@ -17,6 +17,7 @@
 #define TEST_UTILS_H
 
 #include <DeviceInfo.h>
+#include <DisplayList.h>
 #include <Matrix.h>
 #include <Rect.h>
 #include <RenderNode.h>
@@ -24,6 +25,12 @@
 #include <renderthread/RenderThread.h>
 #include <Snapshot.h>
 
+#if HWUI_NEW_OPS
+#include <RecordedOp.h>
+#else
+#include <DisplayListOp.h>
+#endif
+
 #include <memory>
 
 namespace android {
@@ -117,9 +124,8 @@
         return node;
     }
 
-    static void syncNodePropertiesAndDisplayList(sp<RenderNode>& node) {
-        node->syncProperties();
-        node->syncDisplayList();
+    static void syncHierarchyPropertiesAndDisplayList(sp<RenderNode>& node) {
+        syncHierarchyPropertiesAndDisplayListImpl(node.get());
     }
 
     typedef std::function<void(renderthread::RenderThread& thread)> RtCallback;
@@ -147,6 +153,18 @@
         TestTask task(rtCallback);
         renderthread::RenderThread::getInstance().queueAndWait(&task);
     }
+private:
+    static void syncHierarchyPropertiesAndDisplayListImpl(RenderNode* node) {
+        node->syncProperties();
+        node->syncDisplayList();
+        auto displayList = node->getDisplayList();
+        if (displayList) {
+            for (auto&& childOp : displayList->getChildren()) {
+                syncHierarchyPropertiesAndDisplayListImpl(childOp->renderNode);
+            }
+        }
+    }
+
 }; // class TestUtils
 
 } /* namespace uirenderer */