Author: toshok
Date: 2007-01-19 13:03:50 -0500 (Fri, 19 Jan 2007)
New Revision: 71349

Modified:
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTextBoxColumnTest.cs
Log:
        * DataGridTextBoxColumnTest.cs: add a couple more tests to see how
        DataGrid.ReadOnly affects things.

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



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:59:20 UTC (rev 71348)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-01-19 18:03:50 UTC (rev 71349)
@@ -1,5 +1,10 @@
 2007-01-19  Chris Toshok  <[EMAIL PROTECTED]>
 
+       * DataGridTextBoxColumnTest.cs: add a couple more tests to see how
+       DataGrid.ReadOnly affects things.
+
+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

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:59:20 UTC (rev 71348)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTextBoxColumnTest.cs
        2007-01-19 18:03:50 UTC (rev 71349)
@@ -534,5 +534,74 @@
                        DataRowView v = (DataRowView)cm.Current;
                        Assert.AreEqual ("hi there", v[0], "10");
                }
+
+               [Test]
+               public void TestReadOnly_DataGrid ()
+               {
+                       MakeTable (false);
+
+                       BindingContext bc = new BindingContext ();
+                       DataGrid dg = new DataGrid ();
+                       dg.BindingContext = bc;
+                       dg.TableStyles.Add (tableStyle);
+                       dg.DataSource = table;
+                       dg.ReadOnly = true;
+
+                       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);
+
+                       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");
+               }
+
+               [Test]
+               public void TestReadOnly_TableStyle ()
+               {
+                       MakeTable (false);
+
+                       BindingContext bc = new BindingContext ();
+                       DataGrid dg = new DataGrid ();
+                       dg.BindingContext = bc;
+                       dg.TableStyles.Add (tableStyle);
+                       dg.DataSource = table;
+
+                       tableStyle.ReadOnly = true;
+
+                       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);
+
+                       Assert.IsTrue (tb.ReadOnly, "7");
+
+                       Assert.AreEqual ("Miguel", tb.Text, "8");
+               }
        }
 }

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

Reply via email to