Beispiel #1
0
        private void TestClearWithChildDestructorForGC(YogaNode parent, int instanceCount)
        {
            YogaNode child = new YogaNode();

            Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
            parent.Insert(0, child);
        }
Beispiel #2
0
        private void TestDestructorForGC(int instanceCount)
        {
            YogaNode node = new YogaNode();

            Assert.IsNotNull(node);
            Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
            node = null;
        }
Beispiel #3
0
        public void TestDestructorWithChildren()
        {
            ForceGC();
            int instanceCount = YogaNode.GetInstanceCount();

            TestDestructorWithChildrenForGC1(instanceCount);
            ForceGC();
            Assert.AreEqual(instanceCount, YogaNode.GetInstanceCount());
        }
Beispiel #4
0
        public void TestReset()
        {
            int      instanceCount = YogaNode.GetInstanceCount();
            YogaNode node          = new YogaNode();

            Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
            node.Reset();
            Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
        }
Beispiel #5
0
        public void TestRetainConfig()
        {
            ForceGC();
            int nodeInstanceCount   = YogaNode.GetInstanceCount();
            int configInstanceCount = YogaConfig.GetInstanceCount();

            TestRetainConfigForGC(nodeInstanceCount, configInstanceCount);
            ForceGC();

            Assert.AreEqual(nodeInstanceCount, YogaNode.GetInstanceCount());
            Assert.AreEqual(configInstanceCount, YogaConfig.GetInstanceCount());
        }
Beispiel #6
0
        private void TestRetainConfigForGC(int nodeInstanceCount, int configInstanceCount)
        {
            ForceGC();
            Assert.AreEqual(nodeInstanceCount, YogaNode.GetInstanceCount());
            Assert.AreEqual(configInstanceCount, YogaConfig.GetInstanceCount());
            YogaNode node = TestRetainConfigForGC2(nodeInstanceCount, configInstanceCount);

            ForceGC();
            Assert.IsNotNull(node);
            Assert.AreEqual(configInstanceCount + 1, YogaConfig.GetInstanceCount());
            Assert.AreEqual(nodeInstanceCount + 1, YogaNode.GetInstanceCount());
            node = null;
        }
Beispiel #7
0
        public void TestMeasureFuncWithDestructor()
        {
            ForceGC();
            int      instanceCount = YogaNode.GetInstanceCount();
            YogaNode parent        = new YogaNode();

            Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
            TestMeasureFuncWithDestructorForGC(parent);
            ForceGC();
            Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount());
            parent.CalculateLayout();
            Assert.AreEqual(120, (int)parent.LayoutWidth);
            Assert.AreEqual(130, (int)parent.LayoutHeight);
        }
Beispiel #8
0
        public void TestParentDestructor()
        {
            ForceGC();
            int      instanceCount = YogaNode.GetInstanceCount();
            YogaNode child         = new YogaNode();

            Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());

            TestParentDestructorForGC(child, instanceCount + 1);
            ForceGC();

            Assert.IsNull(child.Parent);
            Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
        }
Beispiel #9
0
        public void TestClearWithChildDestructor()
        {
            ForceGC();
            int      instanceCount = YogaNode.GetInstanceCount();
            YogaNode node          = new YogaNode();

            Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
            TestClearWithChildDestructorForGC(node, instanceCount + 1);
            ForceGC();
            Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount());
            node.Clear();
            Assert.AreEqual(0, node.Count);
            ForceGC();
            Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
        }
Beispiel #10
0
        private void TestDestructorWithChildrenForGC1(int instanceCount)
        {
            YogaNode node = new YogaNode();

            Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());

            TestDestructorWithChildrenForGC2(node, instanceCount + 1);
            ForceGC();
            Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount());

            TestDestructorWithChildrenForGC2(node, instanceCount + 2);
            ForceGC();
            Assert.AreEqual(instanceCount + 3, YogaNode.GetInstanceCount());

            node = null;
        }
Beispiel #11
0
        private YogaNode TestRetainConfigForGC2(int nodeInstanceCount, int configInstanceCount)
        {
            YogaConfig config = new YogaConfig();

            Assert.IsNotNull(config);
            Assert.AreEqual(configInstanceCount + 1, YogaConfig.GetInstanceCount());

            YogaNode node = new YogaNode(config);

            Assert.IsNotNull(node);
            Assert.AreEqual(nodeInstanceCount + 1, YogaNode.GetInstanceCount());

            config = null;

            return(node);
        }
Beispiel #12
0
        public void TestClear()
        {
            int      instanceCount = YogaNode.GetInstanceCount();
            YogaNode parent        = new YogaNode();

            Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount());
            YogaNode child = new YogaNode();

            Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount());
            parent.Insert(0, child);
            Assert.AreEqual(1, parent.Count);
            Assert.AreEqual(parent, child.Parent);
            parent.Clear();
            Assert.AreEqual(0, parent.Count);
            Assert.IsNull(child.Parent);
            Assert.AreEqual(instanceCount + 2, YogaNode.GetInstanceCount());
        }