[Adapdev-commits] Adapdev/src/Adapdev.Windows.Forms.Tests SmartTreeViewTest.cs,1.2,1.3
Status: Beta
Brought to you by:
intesar66
From: Sean M. <int...@us...> - 2005-06-05 08:50:41
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31410/src/Adapdev.Windows.Forms.Tests Modified Files: SmartTreeViewTest.cs Log Message: Fixed several bugs with SmartTreeView Fixed bugs with TestRunner Index: SmartTreeViewTest.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms.Tests/SmartTreeViewTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SmartTreeViewTest.cs 2 Jun 2005 03:26:00 -0000 1.2 --- SmartTreeViewTest.cs 5 Jun 2005 08:50:32 -0000 1.3 *************** *** 150,167 **** public void GetState() { this.GetNode1().Checked = false; Assert.IsTrue(this.GetNode1().Checked == false, "Node1 should not be checked initially"); // Check it - checked state should be saved this.GetNode1().Checked = true; // Remove it this.GetNode1().Remove(); // Readd it this.GetRoot().Nodes.Add("Node1"); ! this.GetNode1().Checked = false; ! Assert.IsTrue(this.GetNode1().Checked == false, "Node1 should not be checked after being added"); // Load the state this.tree.LoadState(); Assert.IsTrue(this.GetNode1().Checked == true, "Node1 should be checked."); // Clear the state and reload --- 150,184 ---- public void GetState() { + this.tree.StateChanged += new StateChangedEventHandler(tree_StateChanged); ; + this.GetRoot().Checked = false; this.GetNode1().Checked = false; Assert.IsTrue(this.GetNode1().Checked == false, "Node1 should not be checked initially"); + // Check it - checked state should be saved this.GetNode1().Checked = true; + Assert.IsTrue(tree.GetState(this.GetNode1()), "State wasn't saved for Node1"); + + string node1a = tree.GetUniqueNodeName(this.GetNode1()); + // Remove it + this.GetNode2().Remove(); this.GetNode1().Remove(); + // Readd it this.GetRoot().Nodes.Add("Node1"); ! this.GetRoot().Nodes.Add("Node2"); ! string node2a = tree.GetUniqueNodeName(this.GetNode1()); ! Assert.AreEqual(node1a, node2a, "Nodes should be the same for state monitoring."); ! ! Assert.IsFalse(this.GetNode1().Checked, "Node1 should not be checked after being added"); ! Assert.IsFalse(this.GetNode2().Checked, "Node2 should not be checked before LoadState."); ! Assert.IsTrue(tree.HasState(this.GetNode1()), "State no longer exists for Node1"); ! Assert.IsTrue(tree.GetState(this.GetNode1()), "State should still be true."); ! // Load the state this.tree.LoadState(); Assert.IsTrue(this.GetNode1().Checked == true, "Node1 should be checked."); + Assert.IsTrue(this.GetNode2().Checked == false, "Node1 should not be checked after LoadState."); // Clear the state and reload *************** *** 209,212 **** --- 226,234 ---- } #endregion + + private void tree_StateChanged(TreeNode node, bool state) + { + //Console.WriteLine("{0} changed to {1}", node.Text, state); + } } } |