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

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

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

            TestDestructorWithChildrenForGC1(instanceCount);
            ForceGC();
            Assert.AreEqual(instanceCount, YogaNode.GetInstanceCount());
        }
Example #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());
        }
Example #5
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);
        }
Example #6
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());
        }
Example #7
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());
        }
Example #8
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;
        }
Example #9
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());
        }