[Mono-dev] Fix for failing TreeNodeTest.FullPathTest

Dieter Bremes dbjobs at snafu.de
Tue Dec 13 07:23:10 EST 2005


Jackson Harper wrote:
> On Mon, 2005-12-12 at 21:54 +0100, Dieter Bremes wrote:
>> Hi,
>>
>> below is a fix to TreeNodeCollection.cs to prevent 
>> TreeNodeTest.FullPathTest from failing and some other problems.
>>
>> OTOH I wonder how such obvious bugs could make it into the trunk 
>> especially as there a test that clearly catches at least one of them.
> 
> I believe it has something to do with the current make run-test locking
> up X on most peoples machines. 

Yes, that's very annoying. TreeNodeTest runs fine, though - except that 
NullReferenceException.

I use a very simple script named try-MWF.sh - might save someone some time:

#!/bin/bash
cd ~/mono/trunk/mcs/class/Managed.Windows.Forms
make clean
sudo make install
sudo make test
/opt/mono/bin/nunit-console System.Windows.Forms_test_default.dll 
-fixture:MonoTests.System.Windows.Forms.TreeNodeTest

> 
> Please file a bug report for this, attaching your patches.

Done

Dieter

> 
> Jackson
> 
> 
>> Dieter
>>
>>
>>
>> * TreeNodeCollection.cs : Fixed bugs that among 
>> <http://dict.leo.org/se?lp=ende&p=/Mn4k.&search=among> other 
>> <http://dict.leo.org/se?lp=ende&p=/Mn4k.&search=other> things 
>> <http://dict.leo.org/se?lp=ende&p=/Mn4k.&search=things> caused 
>> TreeNodeTest.FullPathTest to fail.
>>
>> Index: TreeNodeCollection.cs
>> ===================================================================
>> --- TreeNodeCollection.cs       (Revision 54253)
>> +++ TreeNodeCollection.cs       (Arbeitskopie)
>> @@ -115,18 +115,20 @@
>>                         // Remove it from any old parents
>>                         node.Remove ();
>>
>> -                       TreeView tree_view = owner.TreeView;
>> -                       if (owner != null && tree_view != null && 
>> tree_view.Sorted)
>> +                       TreeView tree_view = null;
>> +                       if (owner != null)
>> +                               tree_view = owner.TreeView;
>> +                       if (tree_view != null && tree_view.Sorted)
>>                                 return AddSorted (node);
>>                         node.parent = owner;
>>                         if (count >= nodes.Length)
>>                                 Grow ();
>>                         nodes [count++] = node;
>>
>> -                       if (tree_view != null && (owner.IsExpanded || 
>> owner.IsRoot)) {
>> +                       if (owner != null && tree_view != null && 
>> (owner.IsExpanded || owner.IsRoot)) {
>>                                 // XXX: Need to ensure the boxes for the 
>> nodes have been created
>>                                 tree_view.UpdateNode (owner);
>> -                       } else if (tree_view != null) {
>> +                       } else if (owner != null && tree_view != null) {
>>                                 tree_view.UpdateNodePlusMinus (owner);
>>                         }
>>
>> @@ -152,9 +154,12 @@
>>                         Array.Clear (nodes, 0, count);
>>                         count = 0;
>>
>> -                       TreeView tree_view = owner.TreeView;
>> -                       if (tree_view != null)
>> -                               tree_view.UpdateBelow (owner);
>> +                       TreeView tree_view = null;
>> +                       if (owner != null) {
>> +                               tree_view = owner.TreeView;
>> +                               if (tree_view != null)
>> +                                       tree_view.UpdateBelow (owner);
>> +                       }
>>                 }
>>
>>                 public bool Contains (TreeNode node)
>> @@ -210,8 +215,10 @@
>>                         if (nodes.Length > OrigSize && nodes.Length > 
>> (count * 2))
>>                                 Shrink ();
>>
>> -                       TreeView tree_view = owner.TreeView;
>> -                       if (removed == tree_view.top_node) {
>> +                       TreeView tree_view = null;
>> +                       if (owner != null)
>> +                               tree_view = owner.TreeView;
>> +                       if (tree_view != null && removed == 
>> tree_view.top_node) {
>>                                 OpenTreeNodeEnumerator oe = new 
>> OpenTreeNodeEnumerator (removed);
>>                                 if (oe.MoveNext () && oe.MoveNext ())
>>                                         tree_view.top_node = oe.CurrentNode;
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> 




More information about the Mono-devel-list mailing list