Author: toshok
Date: 2007-01-19 12:28:02 -0500 (Fri, 19 Jan 2007)
New Revision: 71347

Modified:
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridColumnStyleTest.cs
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTextBoxColumnTest.cs
Log:
2007-01-19  Chris Toshok  <[EMAIL PROTECTED]>

        * DataGridTextBoxColumnTest.cs: mark TestUpdateUI as NotWorking,
        and add a couple of tests for the overloaded ReadOnly property.
        can't figure out how it's being used, maybe all it really does is
        chain up to base.ReadOnly.

        * DataGridColumnStyleTest.cs: add some tests to see if we should
        be mucking with the ReadOnly property when the PropertyDescriptor
        is set (turns out we shouldn't be).

2007-01-18  Chris Toshok  <[EMAIL PROTECTED]>

        * DataGridTextBoxColumnTest.cs: add some tests (some of which aren't 
working on mono)

        * DataGridTextBoxTest.cs: add some tests (some of which aren't working 
on mono)



Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-01-19 17:09:17 UTC (rev 71346)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-01-19 17:28:02 UTC (rev 71347)
@@ -1,3 +1,14 @@
+2007-01-19  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * DataGridTextBoxColumnTest.cs: mark TestUpdateUI as NotWorking,
+       and add a couple of tests for the overloaded ReadOnly property.
+       can't figure out how it's being used, maybe all it really does is
+       chain up to base.ReadOnly.
+
+       * DataGridColumnStyleTest.cs: add some tests to see if we should
+       be mucking with the ReadOnly property when the PropertyDescriptor
+       is set (turns out we shouldn't be).
+
 2007-01-18  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * FormTest.cs: Add test for bug #79959.
@@ -11,6 +22,12 @@
 
        * NotifyIconTest.cs: Add test for Tag, ContextMenuStrip.
 
+2007-01-18  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * DataGridTextBoxColumnTest.cs: add some tests (some of which aren't 
working on mono)
+
+       * DataGridTextBoxTest.cs: add some tests (some of which aren't working 
on mono)
+
 2007-01-16  Chris Toshok  <[EMAIL PROTECTED]>
 
        * UpDownTest.cs: add UpDownActiveControlTest.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridColumnStyleTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridColumnStyleTest.cs
  2007-01-19 17:09:17 UTC (rev 71346)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridColumnStyleTest.cs
  2007-01-19 17:28:02 UTC (rev 71347)
@@ -98,5 +98,78 @@
 
                        p.DoCheckValidDataSource ((CurrencyManager)bc[arr]);
                }
+
+               class ReadOnlyPropertyTest {
+                       public int ROProp {
+                               get { return 5; }
+                       }
+                       public int RWProp {
+                               get { return 5; }
+                               set { }
+                       }
+               }
+
+               [Test]
+               public void TestReadOnly ()
+               {
+                       StylePoker p = new StylePoker ();
+
+                       Assert.IsFalse (p.ReadOnly, "1");
+                       p.ReadOnly = true;
+                       Assert.IsTrue (p.ReadOnly, "2");
+
+                       p.ReadOnly = false;
+
+                       DataGridTableStyle ts = new DataGridTableStyle();
+                       ts.GridColumnStyles.Add (p);
+
+                       ts.ReadOnly = true;
+                       Assert.IsFalse (p.ReadOnly, "3");
+               }
+
+               [Test]
+               public void TestReadOnly_PropertyDescriptorSet ()
+               {
+                       /* check the effect the PropertyDescriptor setter has 
on the property */
+                       PropertyDescriptor ro_prop = 
TypeDescriptor.GetProperties(typeof (ReadOnlyPropertyTest))["ROProp"];
+                       PropertyDescriptor rw_prop = 
TypeDescriptor.GetProperties(typeof (ReadOnlyPropertyTest))["RWProp"];
+                       StylePoker p;
+
+                       /* non-user set, readonly property */
+                       p = new StylePoker ();
+                       Assert.IsFalse (p.ReadOnly, "a1");
+                       p.PropertyDescriptor = ro_prop;
+                       Assert.IsFalse (p.ReadOnly, "a2");
+
+                       /* non-user set, non-readonly property */
+                       p = new StylePoker ();
+                       Assert.IsFalse (p.ReadOnly, "b1");
+                       p.PropertyDescriptor = rw_prop;
+                       Assert.IsFalse (p.ReadOnly, "b2");
+
+                       /* user set to false, readonly property */
+                       p = new StylePoker ();
+                       p.ReadOnly = false;
+                       p.PropertyDescriptor = ro_prop;
+                       Assert.IsFalse (p.ReadOnly, "c1");
+
+                       /* user set to false, non-readonly property */
+                       p = new StylePoker ();
+                       p.ReadOnly = false;
+                       p.PropertyDescriptor = rw_prop;
+                       Assert.IsFalse (p.ReadOnly, "d1");
+
+                       /* user set to true, readonly property */
+                       p = new StylePoker ();
+                       p.ReadOnly = true;
+                       p.PropertyDescriptor = ro_prop;
+                       Assert.IsTrue (p.ReadOnly, "e1");
+
+                       /* user set to true, non-readonly property */
+                       p = new StylePoker ();
+                       p.ReadOnly = true;
+                       p.PropertyDescriptor = rw_prop;
+                       Assert.IsTrue (p.ReadOnly, "f1");
+               }
        }
 }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTextBoxColumnTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTextBoxColumnTest.cs
        2007-01-19 17:09:17 UTC (rev 71346)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTextBoxColumnTest.cs
        2007-01-19 17:28:02 UTC (rev 71347)
@@ -435,6 +435,7 @@
                }
 
                [Test]
+               [Category ("NotWorking")]
                public void TestUpdateUI ()
                {
                        MakeTable (false);
@@ -465,5 +466,73 @@
                        DataRowView v = (DataRowView)cm.Current;
                        Assert.AreEqual ("Miguel", v[0], "8");
                }
+
+               [Test]
+               public void TestReadOnly_InEditCall ()
+               {
+                       MakeTable (false);
+
+                       BindingContext bc = new BindingContext ();
+                       DataGrid dg = new DataGrid ();
+                       dg.BindingContext = bc;
+                       dg.TableStyles.Add (tableStyle);
+                       dg.DataSource = table;
+
+                       CurrencyManager cm = (CurrencyManager)bc[view];
+                       ColumnPoker column = nameColumnStyle;
+                       TextBox tb = nameColumnStyle.TextBox;
+
+                       Assert.IsNotNull (tb, "1");
+                       Assert.AreEqual (typeof (DataGridTextBox), 
tb.GetType(), "2");
+                       Assert.IsTrue (tb.Enabled, "3");
+                       Assert.IsFalse (tb.Visible, "4");
+                       Assert.AreEqual ("", tb.Text, "5");
+                       Assert.IsFalse (tb.ReadOnly, "6");
+
+                       column.DoEdit (cm, 0, new Rectangle (new Point (0,0), 
new Size (100, 100)), true, "hi there", true);
+
+                       Assert.IsTrue (tb.ReadOnly, "7");
+
+                       // since it's readonly
+                       Assert.AreEqual ("Miguel", tb.Text, "8");
+               }
+
+               [Test]
+               public void TestReadOnly_AfterEditCall ()
+               {
+                       MakeTable (false);
+
+                       BindingContext bc = new BindingContext ();
+                       DataGrid dg = new DataGrid ();
+                       dg.BindingContext = bc;
+                       dg.TableStyles.Add (tableStyle);
+                       dg.DataSource = table;
+
+                       CurrencyManager cm = (CurrencyManager)bc[view];
+                       ColumnPoker column = nameColumnStyle;
+                       TextBox tb = nameColumnStyle.TextBox;
+
+                       Assert.IsNotNull (tb, "1");
+                       Assert.AreEqual (typeof (DataGridTextBox), 
tb.GetType(), "2");
+                       Assert.IsTrue (tb.Enabled, "3");
+                       Assert.IsFalse (tb.Visible, "4");
+                       Assert.AreEqual ("", tb.Text, "5");
+                       Assert.IsFalse (tb.ReadOnly, "6");
+
+                       column.DoEdit (cm, 0, new Rectangle (new Point (0,0), 
new Size (100, 100)), false, "hi there", true);
+                       column.ReadOnly = true;
+
+                       Assert.IsFalse (tb.ReadOnly, "7");
+
+                       Assert.AreEqual ("hi there", tb.Text, "8");
+
+                       bool rv;
+
+                       rv = column.DoCommit (cm, cm.Position);
+                       column.DoEndEdit ();
+                       Assert.IsTrue (rv, "9");
+                       DataRowView v = (DataRowView)cm.Current;
+                       Assert.AreEqual ("hi there", v[0], "10");
+               }
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to