public void TextBoxClearedAfterLoadXml() { treeViewContainer.ShowTextContent("test"); treeViewContainer.LoadXml("<html/>", provider); Assert.AreEqual(String.Empty, textBox.Text); AttributesGridOnTop(); }
public void SetUp() { treeViewContainerControl = new DerivedXmlTreeViewContainerControl(); treeView = treeViewContainerControl.TreeView; string xml = "<root><top>text</top><bottom><child>text</child></bottom></root>"; treeViewContainerControl.LoadXml(xml); doc = treeViewContainerControl.Document; ExtTreeNode rootNode = (ExtTreeNode)treeView.Nodes[0]; rootNode.Expanding(); topElementTreeNode = (XmlElementTreeNode)rootNode.Nodes[0]; topElementTreeNode.Expanding(); topTextTreeNode = (XmlTextTreeNode)topElementTreeNode.Nodes[0]; ExtTreeNode bottomNode = (ExtTreeNode)rootNode.Nodes[1]; bottomNode.Expanding(); childElementTreeNode = (XmlElementTreeNode)bottomNode.Nodes[0]; childElementTreeNode.Expanding(); }
public void SetUp() { treeViewContainer = new DerivedXmlTreeViewContainerControl(); string xml = "<!-- Root comment --><root><!-- Child comment --><child></child></root>"; treeViewContainer.LoadXml(xml); doc = treeViewContainer.Document; treeView = treeViewContainer.TreeView; // Get the root comment node in the tree. rootCommentNode = (XmlComment)doc.FirstChild; rootCommentTreeNode = treeView.Nodes[0] as XmlCommentTreeNode; // Get the child comment node in the tree. rootElementTreeNode = (XmlElementTreeNode)treeView.Nodes[1]; rootElementTreeNode.Expanding(); rootElement = rootElementTreeNode.XmlElement; childCommentTreeNode = rootElementTreeNode.Nodes[0] as XmlCommentTreeNode; childCommentNode = (XmlComment)rootElementTreeNode.XmlElement.FirstChild; childElementTreeNode = rootElementTreeNode.Nodes[1] as XmlElementTreeNode; childElement = childElementTreeNode.XmlElement; }
public void SetUp() { treeViewContainerControl = new DerivedXmlTreeViewContainerControl(); treeView = treeViewContainerControl.TreeView; treeViewContainerControl.LoadXml("<root><child></child></root>"); doc = treeViewContainerControl.Document; }
public void SetUp() { XmlCompletionDataProvider completionDataProvider = new XmlCompletionDataProvider(new XmlSchemaCompletionDataCollection(), null, String.Empty); treeViewContainer = new DerivedXmlTreeViewContainerControl(); treeViewContainer.LoadXml("<!-- Root comment --><root><!-- Child comment --><child></child></root>", completionDataProvider); doc = treeViewContainer.Document; treeView = treeViewContainer.TreeView; // Get the root comment node in the tree. rootCommentNode = (XmlComment)doc.FirstChild; rootCommentTreeNode = treeView.Nodes[0] as XmlCommentTreeNode; // Get the child comment node in the tree. rootElementTreeNode = (XmlElementTreeNode)treeView.Nodes[1]; rootElementTreeNode.Expanding(); rootElement = rootElementTreeNode.XmlElement; childCommentTreeNode = rootElementTreeNode.Nodes[0] as XmlCommentTreeNode; childCommentNode = (XmlComment)rootElementTreeNode.XmlElement.FirstChild; childElementTreeNode = rootElementTreeNode.Nodes[1] as XmlElementTreeNode; childElement = childElementTreeNode.XmlElement; }
public void Init() { treeViewContainer = new DerivedXmlTreeViewContainerControl(); treeViewContainer.DirtyChanged += TreeViewContainerDirtyChanged; XmlTextReader reader = ResourceManager.GetXhtmlStrictSchema(); XmlSchemaCompletionData xhtmlSchema = new XmlSchemaCompletionData(reader); XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection(); provider = new XmlCompletionDataProvider(schemas, xhtmlSchema, String.Empty); treeViewContainer.LoadXml("<html id='a'>text<body></body></html>", provider); doc = treeViewContainer.Document; treeView = treeViewContainer.TreeView; htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[0]; htmlTreeNode.Expanding(); textTreeNode = (XmlTextTreeNode)htmlTreeNode.Nodes[0]; splitContainer = (SplitContainer)treeViewContainer.Controls["splitContainer"]; textBox = (RichTextBox)splitContainer.Panel2.Controls["textBox"]; errorMessageTextBox = (RichTextBox)splitContainer.Panel2.Controls["errorMessageTextBox"]; attributesGrid = (PropertyGrid)splitContainer.Panel2.Controls["attributesGrid"]; }
public void Init() { treeViewContainer = new DerivedXmlTreeViewContainerControl(); treeViewContainer.LoadXml("<html><body></body></html>"); doc = treeViewContainer.Document; treeView = treeViewContainer.TreeView; htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[0]; htmlTreeNode.Expanding(); bodyTreeNode = (XmlElementTreeNode)htmlTreeNode.Nodes[0]; bodyElement = (XmlElement)doc.SelectSingleNode("/html/body"); }
public void Init() { treeViewContainer = new DerivedXmlTreeViewContainerControl(); XmlTextReader reader = ResourceManager.GetXhtmlStrictSchema(); XmlSchemaCompletionData xhtmlSchema = new XmlSchemaCompletionData(reader); XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection(); XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xhtmlSchema, String.Empty); treeViewContainer.LoadXml("<html><body></body></html>", provider); doc = treeViewContainer.Document; treeView = treeViewContainer.TreeView; htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[0]; htmlTreeNode.Expanding(); bodyTreeNode = (XmlElementTreeNode)htmlTreeNode.Nodes[0]; bodyElement = (XmlElement)doc.SelectSingleNode("/html/body"); }
public void Init() { treeViewContainer = new DerivedXmlTreeViewContainerControl(); treeViewContainer.LoadXml("<!-- comment --><html><body class='a'><p>Text</p></body></html>"); doc = treeViewContainer.Document; treeView = treeViewContainer.TreeView; commentTreeNode = (XmlCommentTreeNode)treeView.Nodes[0]; htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[1]; htmlTreeNode.Expanding(); bodyTreeNode = (XmlElementTreeNode)htmlTreeNode.Nodes[0]; bodyTreeNode.Expanding(); paraTreeNode = (XmlElementTreeNode)bodyTreeNode.Nodes[0]; paraTreeNode.Expanding(); textTreeNode = (XmlTextTreeNode)paraTreeNode.Nodes[0]; }
public void Init() { treeViewContainer = new DerivedXmlTreeViewContainerControl(); treeViewContainer.DirtyChanged += TreeViewContainerDirtyChanged; treeViewContainer.LoadXml("<html id='a'>text<body></body></html>"); doc = treeViewContainer.Document; treeView = treeViewContainer.TreeView; htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[0]; htmlTreeNode.Expanding(); textTreeNode = (XmlTextTreeNode)htmlTreeNode.Nodes[0]; splitContainer = (SplitContainer)treeViewContainer.Controls["splitContainer"]; textBox = (RichTextBox)splitContainer.Panel2.Controls["textBox"]; errorMessageTextBox = (RichTextBox)splitContainer.Panel2.Controls["errorMessageTextBox"]; attributesGrid = (PropertyGrid)splitContainer.Panel2.Controls["attributesGrid"]; }
public override void FixtureSetUp() { base.FixtureSetUp(); using (DerivedXmlTreeViewContainerControl treeViewContainer = new DerivedXmlTreeViewContainerControl()) { treeViewContainer.LoadXml("<root/>"); doc = treeViewContainer.Document; XmlTreeViewControl treeView = treeViewContainer.TreeView; rootNode = (XmlElementTreeNode)treeView.Nodes[0]; // No node selected in treeview - adding a child // node should do nothing. treeView.SelectedNode = null; XmlElement testElement = doc.CreateElement("test"); treeViewContainer.AppendChildElement(testElement); treeView.SelectedNode = rootNode; XmlElement childElement = doc.CreateElement("child"); treeViewContainer.AppendChildElement(childElement); // No node selected in treeview - inserting a node // node should do nothing. treeView.SelectedNode = null; treeViewContainer.AppendChildElement(testElement); XmlElementTreeNode childNode = (XmlElementTreeNode)rootNode.Nodes[0]; treeView.SelectedNode = childNode; XmlElement beforeElement = doc.CreateElement("before"); treeViewContainer.InsertElementBefore(beforeElement); // No node selected in treeview - inserting a node // node should do nothing. treeView.SelectedNode = null; treeViewContainer.AppendChildElement(testElement); treeView.SelectedNode = childNode; XmlElement afterElement = doc.CreateElement("after"); treeViewContainer.InsertElementAfter(afterElement); } }
public void SetUpFixture() { using (DerivedXmlTreeViewContainerControl treeViewContainer = new DerivedXmlTreeViewContainerControl()) { treeViewContainer.LoadXml("<test/>"); doc = treeViewContainer.Document; XmlTreeViewControl treeView = treeViewContainer.TreeView; treeViewContainer.Document = doc; initialElementSelected = treeView.SelectedElement; initialIsElementSelected = treeView.IsElementSelected; // Set the document element again to make sure the existing node // is removed. doc.LoadXml("<root/>"); treeViewContainer.Document = null; treeViewContainer.Document = doc; documentElement = treeViewContainer.Document.DocumentElement; rootNode = (XmlElementTreeNode)treeView.Nodes[0]; nodeCount = treeView.Nodes.Count; } }
public void SetUp() { treeViewContainerControl = new DerivedXmlTreeViewContainerControl(); treeView = treeViewContainerControl.TreeView; treeViewContainerControl.LoadXml(GetXml()); doc = treeViewContainerControl.Document; clipboardHandler = treeViewContainerControl as IClipboardHandler; htmlElement = doc.DocumentElement; bodyElement = htmlElement.FirstChild as XmlElement; paragraphElement = bodyElement.SelectSingleNode("p") as XmlElement; paragraphText = paragraphElement.SelectSingleNode("text()") as XmlText; bodyComment = bodyElement.SelectSingleNode("comment()") as XmlComment; htmlTreeNode = treeView.Nodes[0] as XmlElementTreeNode; htmlTreeNode.PerformInitialization(); bodyTreeNode = htmlTreeNode.FirstNode as XmlElementTreeNode; bodyTreeNode.PerformInitialization(); bodyCommentTreeNode = bodyTreeNode.FirstNode as XmlCommentTreeNode; paragraphTreeNode = bodyTreeNode.LastNode as XmlElementTreeNode; paragraphTreeNode.PerformInitialization(); paragraphTextTreeNode = paragraphTreeNode.FirstNode as XmlTextTreeNode; }