diff options
author | Rob Wilkens <RobWilkens@gmail.com> | 2012-06-20 17:49:25 +0400 |
---|---|---|
committer | Rob Wilkens <RobWilkens@gmail.com> | 2012-06-20 17:49:25 +0400 |
commit | 7b04af5711a28191e31f02074987c71172d90e53 (patch) | |
tree | a42bcae626ac18a020aeff9579ea530d22addd79 /mcs/class/Managed.Windows.Forms/Test | |
parent | 08216842321f23525062c001e0a0f64ff4d1b6c8 (diff) |
This is a unit test for Bug5487, Bug 5510, and maybe Bug 5511
Based loosely on the code here:
https://bugzilla.novell.com/show_bug.cgi?id=MONO79788
which was the sample code used to recreate the problems in the first place.
Diffstat (limited to 'mcs/class/Managed.Windows.Forms/Test')
-rw-r--r-- | mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTest.cs | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTest.cs index f49ecd88cdc..8141409ca18 100644 --- a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTest.cs +++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTest.cs @@ -32,6 +32,7 @@ using System.Windows.Forms; using System.Xml; using NUnit.Framework; using System.Data; +using System.Xml; namespace MonoTests.System.Windows.Forms { @@ -619,5 +620,96 @@ namespace MonoTests.System.Windows.Forms Assert.AreEqual (1, table_style.GridColumnStyles.Count, "#B1"); } + + public class ClickableDataGrid : DataGrid + { + public void ClickGrid (int X, int Y) + { + MouseEventArgs me = new MouseEventArgs ( + MouseButtons.Left, + 1, /*# of clicks*/ + X, Y, 0); + OnMouseDown (me); + OnClick (me); + OnMouseUp (me); + } + } + + public class Form5487 : Form + { + private ClickableDataGrid dataGrid1; + private Container components = null; + + public Form5487 () + { + InitializeComponent (); + } + + protected override void Dispose (bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose (); + } + } + base.Dispose (disposing); + } + + private void InitializeComponent () + { + this.dataGrid1 = new ClickableDataGrid (); + ((ISupportInitialize)(this.dataGrid1)).BeginInit (); + this.SuspendLayout (); + this.dataGrid1.DataMember = ""; + this.dataGrid1.HeaderForeColor = SystemColors.ControlText; + this.dataGrid1.Location = new Point (16, 16); + this.dataGrid1.Name = "dataGrid1"; + this.dataGrid1.Size = new Size (624, 440); + this.dataGrid1.TabIndex = 0; + this.AutoScaleBaseSize = new Size (5, 13); + this.ClientSize = new Size (656, 470); + this.Controls.Add (this.dataGrid1); + this.Name = "Form1"; + this.Text = "Form1"; + this.Shown += new EventHandler (this.Form1_Load); + ((ISupportInitialize)(this.dataGrid1)).EndInit (); + this.ResumeLayout (false); + + } + + private void Form1_Load (object sender, EventArgs e) + { + DataSet ds = new DataSet (); + String XMLString = ""; + XmlTextReader XMLTR; + + XMLString += "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"; + XMLString += "<pa><pb><pc><pd><id>1</id>"; + XMLString += "</pd></pc><pc><pd><id>1</id>"; + XMLString += "</pd><pd><id>1</id></pd><pd>"; + XMLString += "<id>1</id></pd><pd><id>1</id>"; + XMLString += "</pd><pd><id>1</id></pd><pd>"; + XMLString += "<id>1</id></pd><pd><id>1</id>"; + XMLString += "</pd><pd><id>1</id></pd></pc>"; + XMLString += "</pb></pa>"; + XMLTR = new XmlTextReader (XMLString, + XmlNodeType.Document, null); + XMLTR.ReadOuterXml (); + ds.ReadXml (XMLTR); + this.dataGrid1.DataSource = ds; + this.dataGrid1.ClickGrid (25, 45); + Application.DoEvents (); + this.dataGrid1.ClickGrid (46, 73); + Application.DoEvents (); + this.dataGrid1.NavigateBack (); + Close (); + } + } + [Test] + public void Bug5487AndRelated () + { + //this should crash on fail + Application.Run (new Form5487 ()); + } } } |