本文整理汇总了C#中CSSNode.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# CSSNode.Clear方法的具体用法?C# CSSNode.Clear怎么用?C# CSSNode.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSSNode
的用法示例。
在下文中一共展示了CSSNode.Clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestChildren
public void TestChildren()
{
CSSNode parent = new CSSNode();
foreach (CSSNode node in parent) {
Assert.Fail(node.ToString());
}
CSSNode child0 = new CSSNode();
Assert.AreEqual(-1, parent.IndexOf(child0));
parent.Insert(0, child0);
foreach (CSSNode node in parent) {
Assert.AreEqual(0, parent.IndexOf(node));
}
CSSNode child1 = new CSSNode();
parent.Insert(1, child1);
int index = 0;
foreach (CSSNode node in parent) {
Assert.AreEqual(index++, parent.IndexOf(node));
}
parent.RemoveAt(0);
Assert.AreEqual(-1, parent.IndexOf(child0));
Assert.AreEqual(0, parent.IndexOf(child1));
parent.Clear();
Assert.AreEqual(0, parent.Count);
parent.Clear();
Assert.AreEqual(0, parent.Count);
}
示例2: TestClear
public void TestClear()
{
int instanceCount = CSSNode.GetInstanceCount();
CSSNode parent = new CSSNode();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
CSSNode child = new CSSNode();
Assert.AreEqual(instanceCount + 2, CSSNode.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, CSSNode.GetInstanceCount());
}
示例3: TestClearWithChildDestructor
public void TestClearWithChildDestructor()
{
ForceGC();
int instanceCount = CSSNode.GetInstanceCount();
CSSNode node = new CSSNode();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
TestClearWithChildDestructorForGC(node, instanceCount + 1);
ForceGC();
Assert.AreEqual(instanceCount + 2, CSSNode.GetInstanceCount());
node.Clear();
Assert.AreEqual(0, node.Count);
ForceGC();
Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
}