private void TestClearWithChildDestructorForGC(YogaNode parent, int instanceCount) { YogaNode child = new YogaNode(); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); parent.Insert(0, child); }
private void TestDestructorForGC(int instanceCount) { YogaNode node = new YogaNode(); Assert.IsNotNull(node); Assert.AreEqual(instanceCount + 1, YogaNode.GetInstanceCount()); node = null; }
public void TestDestructorWithChildren() { ForceGC(); int instanceCount = YogaNode.GetInstanceCount(); TestDestructorWithChildrenForGC1(instanceCount); ForceGC(); Assert.AreEqual(instanceCount, YogaNode.GetInstanceCount()); }
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()); }
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()); }
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; }
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); }
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()); }
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()); }
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; }
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); }
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()); }