https://bugzilla.novell.com/show_bug.cgi?id=664827

https://bugzilla.novell.com/show_bug.cgi?id=664827#c0


           Summary: A control property's XXXIsNull property isn't set when
                    no items are in the data source.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1036 Safari/532.5

If there is a property with a corresponding XXXIsNull property like so:
public bool ReadOnly { get; set; }
public bool ReadOnlyIsNull { get; set; }

The ReadOnlyIsNull property is set to true (only) when there are no items in
the data source.

Funnily enough, there's code to deal with an XXXIsNull property on the data
source (not the control as above) where ms.net does not..


Reproducible: Always

Steps to Reproduce:
Unit test:

[Test]
public void Test_DataSourceIsNullProperty()
{
    BindingList<TestDataSource> dataSource = new BindingList<TestDataSource>();
    Control.DataBindings().Add("ReadOnly", dataSource, "IsReadOnly", false,
DataSourceUpdateMode.OnPropertyChanged);
    Form.Controls.Add(Control);

    Control.DataBindings()["ReadOnly"].ReadValue();
    AssertEquals(true, Control.ReadOnly, "ReadOnlyIsNull set to true when list
is empty");

    Form.Show();
    Application.DoEvents();
    dataSource.AddNew();
    AssertEquals(1, dataSource.Count);
    AssertEquals(false, Control.ReadOnly, "ReadOnly set to false when list has
items");

    dataSource.RemoveAt(0);
    AssertEquals(0, dataSource.Count);
    AssertEquals(true, Control.ReadOnly, "ReadOnlyIsNull set to true when list
is empty");
}

Form form;
Form Form
{
    get { return form ?? (form = new Form()); }
}

TestControl control;
TestControl Control
{
    get { return control ?? (control = new TestControl()); }
}

class TestDataSource
{
    public event EventHandler IsReadOnlyChanged;
    bool isReadOnly;
    public bool IsReadOnly
    {
        get { return isReadOnly; }
        set
        {
            isReadOnly = value;
            if (IsReadOnlyChanged != null)
            {
                IsReadOnlyChanged(this, EventArgs.Empty);
            }
        }
    }
}

Actual Results:  
Unit test fails.

Expected Results:  
Unit test should pass, as it does on ms.net.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to