You've already forked linux-packaging-mono
Imported Upstream version 5.14.0.78
Former-commit-id: 3494343bcc9ddb42b36b82dd9ae7b69e85e0229f
This commit is contained in:
parent
74b74abd9f
commit
19234507ba
@@ -55,6 +55,8 @@ namespace MonoTests.System.Windows.Forms
|
||||
}
|
||||
// with bug 694908 we don't come here. Instead NUnit exits.
|
||||
Assert.IsTrue (CrashingForm.HasHandledException);
|
||||
|
||||
Application.ThreadException -= CrashingForm.HandleThreadException;
|
||||
}
|
||||
|
||||
class CrashingForm: Form
|
||||
|
@@ -488,7 +488,7 @@ namespace MonoTests.System.Windows.Forms.DataBinding {
|
||||
int raised = 0;
|
||||
source.PositionChanged += delegate (object sender, EventArgs e) { raised ++; };
|
||||
|
||||
Console.WriteLine ("count = {0}", source.Count);
|
||||
Assert.AreEqual (5, source.Count, "0");
|
||||
source.Position = 3;
|
||||
Assert.AreEqual (3, source.Position, "1");
|
||||
|
||||
@@ -1633,9 +1633,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding {
|
||||
|
||||
c.supports_searching = true;
|
||||
|
||||
Console.WriteLine ("set c.supports_searching to {0}, so c.SupportsSearching = {1}",
|
||||
c.supports_searching, c.SupportsSearching);
|
||||
|
||||
Assert.IsTrue (source.SupportsSearching, "3");
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding {
|
||||
Binding b = new Binding (prop, data_source, data_member);
|
||||
|
||||
Assert.IsNull (b.BindingManagerBase, "ctor1");
|
||||
Console.WriteLine ("MEMBER INFO: " + b.BindingMemberInfo);
|
||||
Assert.IsNotNull (b.BindingMemberInfo, "ctor2");
|
||||
Assert.IsNull (b.Control, "ctor3");
|
||||
Assert.IsFalse (b.IsBinding, "ctor4");
|
||||
@@ -328,7 +327,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding {
|
||||
Binding binding = new Binding ("Text", parent, "Two.Three.MockItem.Text");
|
||||
|
||||
c.DataBindings.Add (binding);
|
||||
Console.WriteLine ("c.Text: " + c.Text);
|
||||
Assert.AreEqual ("A", c.Text, "#A1");
|
||||
|
||||
item.Text = "B";
|
||||
@@ -633,7 +631,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding {
|
||||
|
||||
binding.FormatString = "c";
|
||||
Assert.AreEqual ((666).ToString ("c"), c.Text, "#B1");
|
||||
Console.WriteLine (c.Text);
|
||||
|
||||
binding.FormattingEnabled = false;
|
||||
Assert.AreEqual ((666).ToString (), c.Text, "#C1");
|
||||
|
@@ -37,7 +37,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.IsTrue (b.UseCompatibleTextRendering, "A16");
|
||||
Assert.IsTrue (b.UseMnemonic, "A17");
|
||||
Assert.IsTrue (b.UseVisualStyleBackColor, "A18");
|
||||
Assert.AreEqual (AccessibleStates.None, b.AccessibilityObject.State, "A19");
|
||||
Assert.AreEqual (AccessibleStates.Focusable, b.AccessibilityObject.State, "A19");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@@ -392,7 +392,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.IsNull (bbao.Help, "Help");
|
||||
Assert.IsNull (bbao.Name, "Name");
|
||||
Assert.AreEqual (AccessibleRole.PushButton, bbao.Role, "Role");
|
||||
Assert.AreEqual (AccessibleStates.None, bbao.State, "State");
|
||||
Assert.AreEqual (AccessibleStates.Focusable, bbao.State, "State");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -408,7 +408,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.IsNull (bbao.Help, "Help");
|
||||
Assert.IsNull (bbao.Name, "Name");
|
||||
Assert.AreEqual (AccessibleRole.PushButton, bbao.Role, "Role");
|
||||
Assert.AreEqual (AccessibleStates.None, bbao.State, "State");
|
||||
Assert.AreEqual (AccessibleStates.Focusable, bbao.State, "State");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -830,5 +830,27 @@ namespace MonoTests.System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ResetCheckStateOnRemove()
|
||||
{
|
||||
CheckedListBox clb = new CheckedListBox();
|
||||
int idx = clb.Items.Add("a", true);
|
||||
Assert.IsTrue(clb.CheckedIndices.Contains(idx));
|
||||
Assert.AreEqual(1, clb.CheckedIndices.Count);
|
||||
clb.Items.Clear();
|
||||
Assert.AreEqual(0, clb.CheckedIndices.Count);
|
||||
|
||||
idx = clb.Items.Add("a", true);
|
||||
Assert.IsTrue(clb.CheckedIndices.Contains(idx));
|
||||
Assert.AreEqual(1, clb.CheckedIndices.Count);
|
||||
clb.Items.RemoveAt(idx);
|
||||
Assert.AreEqual(0, clb.CheckedIndices.Count);
|
||||
|
||||
idx = clb.Items.Add("a", true);
|
||||
Assert.IsTrue(clb.CheckedIndices.Contains(idx));
|
||||
Assert.AreEqual(1, clb.CheckedIndices.Count);
|
||||
clb.Items.Remove("a");
|
||||
Assert.AreEqual(0, clb.CheckedIndices.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -423,6 +423,8 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual ("{Width=0, Height=0}", mycmbbox.MinimumSize.ToString (), "#27");
|
||||
Assert.AreEqual ("{Left=0,Top=0,Right=0,Bottom=0}", mycmbbox.Padding.ToString (), "#28");
|
||||
|
||||
Assert.AreEqual (SystemColors.Window, mycmbbox.BackColor, "#29");
|
||||
Assert.AreEqual (SystemColors.WindowText, mycmbbox.ForeColor, "#30");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@@ -446,6 +446,8 @@ namespace MonoTests.System.Windows.Forms {
|
||||
Assert.AreEqual ("t;t1;t4;", validating, "A11a");
|
||||
Assert.AreEqual ("t;t1;t4;", validated, "A11b");
|
||||
validating = string.Empty; validated = string.Empty;
|
||||
|
||||
f.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -365,12 +365,15 @@ namespace MonoTests.System.Windows.Forms
|
||||
public void PropertyMaximumSize ()
|
||||
{
|
||||
Control c = new Control ();
|
||||
EventWatcher ew = new EventWatcher (c);
|
||||
c.Size = new Size(10, 10);
|
||||
|
||||
// Chaning MaximumSize below Size forces a size change
|
||||
EventWatcher ew = new EventWatcher (c);
|
||||
c.MaximumSize = new Size (5, 5);
|
||||
Assert.AreEqual (new Size (5, 5), c.MaximumSize, "B1");
|
||||
Assert.AreEqual (string.Empty, ew.ToString (), "B2");
|
||||
Assert.AreEqual ("Layout;Resize;SizeChanged;ClientSizeChanged", ew.ToString (), "B2");
|
||||
|
||||
// Changing MaximumSize when Size is already smaller or equal doesn't raise any events
|
||||
ew.Clear ();
|
||||
c.MaximumSize = new Size (5, 5);
|
||||
Assert.AreEqual (string.Empty, ew.ToString (), "B3");
|
||||
|
@@ -329,9 +329,10 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
try {
|
||||
control.CreateControl ();
|
||||
} catch (ObjectDisposedException ex) {
|
||||
Console.WriteLine (ex);
|
||||
Assert.Fail ("#1");
|
||||
Assert.Fail("#1");
|
||||
}
|
||||
catch (ObjectDisposedException ex) {
|
||||
//Console.WriteLine (ex);
|
||||
}
|
||||
Assert.IsFalse (control.IsHandleCreated, "#2");
|
||||
|
||||
@@ -1838,9 +1839,29 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.IsFalse (test.Visible, "1");
|
||||
test.Visible = true;
|
||||
Assert.IsTrue (test.Visible, "2");
|
||||
Assert.IsTrue (test.reached, "3");
|
||||
// OnCreateControl is only called when the control is truly visible, which
|
||||
// this one is not since it's not top-level.
|
||||
Assert.IsFalse (test.reached, "3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateControlOnFormVisibleTest()
|
||||
{
|
||||
using (Form f = new Form())
|
||||
{
|
||||
OnCreateControlTest test = new OnCreateControlTest();
|
||||
test.Visible = false;
|
||||
Assert.IsFalse(test.IsHandleCreated, "0");
|
||||
Assert.IsFalse(test.Visible, "1");
|
||||
f.Show();
|
||||
f.Controls.Add(test);
|
||||
Assert.IsFalse(test.IsHandleCreated, "2");
|
||||
Assert.IsFalse(test.Visible, "3");
|
||||
test.Visible = true;
|
||||
Assert.IsTrue(test.Visible, "4");
|
||||
Assert.IsTrue(test.reached, "5");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateGraphicsTest ()
|
||||
@@ -2942,6 +2963,24 @@ namespace MonoTests.System.Windows.Forms
|
||||
c1.Controls.Remove(c3);
|
||||
Assert.AreEqual (c2, c3.Parent);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DrawToBitmap ()
|
||||
{
|
||||
var b = new Bitmap (20, 20);
|
||||
var l = new Label ();
|
||||
l.Location = new Point (100, 100);
|
||||
l.Size = new Size (10, 10);
|
||||
l.BackColor = Color.Blue;
|
||||
using (var g = Graphics.FromImage (b))
|
||||
g.Clear (Color.White);
|
||||
l.DrawToBitmap (b, new Rectangle(10, 10, 5, 5));
|
||||
using (var g = Graphics.FromImage (b)) {
|
||||
Assert.AreEqual (Color.White.ToArgb(), b.GetPixel(0, 0).ToArgb());
|
||||
Assert.AreEqual (Color.Blue.ToArgb(), b.GetPixel(10, 10).ToArgb());
|
||||
Assert.AreEqual (Color.White.ToArgb(), b.GetPixel(15, 15).ToArgb());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
@@ -3239,7 +3278,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
Console.WriteLine ("WndProc: " + m.ToString ());
|
||||
//Console.WriteLine ("WndProc: " + m.ToString ());
|
||||
Messages.Add (m);
|
||||
base.WndProc (ref m);
|
||||
}
|
||||
|
@@ -22,6 +22,8 @@
|
||||
// Authors:
|
||||
// Jackson Harper jackson@ximian.com
|
||||
|
||||
// #undef DebugCurrencyManager
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
@@ -673,14 +675,14 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
void CurrentChanged (object sender, EventArgs args)
|
||||
{
|
||||
current_changed = ++event_num;
|
||||
Console.WriteLine ("current_changed = {0}", current_changed);
|
||||
DebugWriteLine ("current_changed = {0}", current_changed);
|
||||
//Console.WriteLine (Environment.StackTrace);
|
||||
event_log += String.Format ("{0}: CurrentChanged\n", current_changed);
|
||||
}
|
||||
void PositionChanged (object sender, EventArgs args)
|
||||
{
|
||||
position_changed = ++event_num;
|
||||
Console.WriteLine ("position_changed = {0}", position_changed);
|
||||
DebugWriteLine ("position_changed = {0}", position_changed);
|
||||
//Console.WriteLine (Environment.StackTrace);
|
||||
event_log += String.Format ("{0}: PositionChanged (to {1})\n", position_changed, ((CurrencyManager)sender).Position);
|
||||
}
|
||||
@@ -688,20 +690,20 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
{
|
||||
item_changed = ++event_num;
|
||||
item_changed_args = args;
|
||||
Console.WriteLine ("item_changed = {0}, index = {1}", item_changed, args.Index);
|
||||
DebugWriteLine ("item_changed = {0}, index = {1}", item_changed, args.Index);
|
||||
//Console.WriteLine (Environment.StackTrace);
|
||||
event_log += String.Format ("{0}: ItemChanged (index = {1})\n", item_changed, args.Index);
|
||||
}
|
||||
void ListChanged (object sender, ListChangedEventArgs args)
|
||||
{
|
||||
Console.WriteLine ("ListChanged ({0},{1},{2})", args.ListChangedType, args.OldIndex, args.NewIndex);
|
||||
DebugWriteLine ("ListChanged ({0},{1},{2})", args.ListChangedType, args.OldIndex, args.NewIndex);
|
||||
//Console.WriteLine (Environment.StackTrace);
|
||||
event_log += String.Format (" : ListChanged ({0}, {1}, {2})\n", args.ListChangedType, args.OldIndex, args.NewIndex);
|
||||
}
|
||||
void MetaDataChanged (object sender, EventArgs args)
|
||||
{
|
||||
metadata_changed = ++event_num;
|
||||
Console.WriteLine ("metadata_changed = {0}", metadata_changed);
|
||||
DebugWriteLine ("metadata_changed = {0}", metadata_changed);
|
||||
//Console.WriteLine (Environment.StackTrace);
|
||||
event_log += String.Format ("{0}: MetaDataChanged\n", metadata_changed);
|
||||
}
|
||||
@@ -710,7 +712,7 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
{
|
||||
list_changed_called = true;
|
||||
list_changed_args = args;
|
||||
Console.WriteLine ("CurrencyManager.ListChanged ({0},{1},{2})", args.ListChangedType, args.OldIndex, args.NewIndex);
|
||||
DebugWriteLine ("CurrencyManager.ListChanged ({0},{1},{2})", args.ListChangedType, args.OldIndex, args.NewIndex);
|
||||
|
||||
}
|
||||
|
||||
@@ -872,7 +874,7 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
Assert.AreEqual (10, cm.Count, "EndAddNew2");
|
||||
|
||||
cm.AddNew ();
|
||||
Console.WriteLine ("position = {0}", cm.Position);
|
||||
DebugWriteLine ("position = {0}", cm.Position);
|
||||
|
||||
Assert.AreEqual (0, item_changed, "EndAddNew3");
|
||||
Assert.AreEqual (-1, item_changed_args.Index, "EndAddNew4");
|
||||
@@ -880,7 +882,7 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
Assert.AreEqual (2, position_changed, "EndAddNew6");
|
||||
|
||||
cm.EndCurrentEdit ();
|
||||
Console.WriteLine ("position = {0}", cm.Position);
|
||||
DebugWriteLine ("position = {0}", cm.Position);
|
||||
|
||||
Assert.AreEqual (3, item_changed, "EndAddNew7");
|
||||
Assert.AreEqual (-1, item_changed_args.Index, "EndAddNew8");
|
||||
@@ -896,7 +898,7 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
void DataView_ListChanged (object sender, ListChangedEventArgs e)
|
||||
{
|
||||
Console.WriteLine ("{0} {1} {2}", e.ListChangedType, e.OldIndex, e.NewIndex);
|
||||
DebugWriteLine ("{0} {1} {2}", e.ListChangedType, e.OldIndex, e.NewIndex);
|
||||
}
|
||||
|
||||
// Support for ICancelNew interface
|
||||
@@ -1088,38 +1090,38 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
CurrencyManager cm = bc [data_source] as CurrencyManager;
|
||||
|
||||
Console.WriteLine ("cm properties:");
|
||||
DebugWriteLine ("cm properties:");
|
||||
foreach (PropertyDescriptor pd in cm.GetItemProperties ())
|
||||
Console.WriteLine (" + {0}", pd.Name);
|
||||
Console.WriteLine ();
|
||||
DebugWriteLine (" + {0}", pd.Name);
|
||||
DebugWriteLine ();
|
||||
|
||||
Console.WriteLine ("dataset:");
|
||||
Console.WriteLine ("cm = {0}", cm.GetType());
|
||||
Console.WriteLine ("cm.Count = {0}", cm.Count);
|
||||
DebugWriteLine ("dataset:");
|
||||
DebugWriteLine ("cm = {0}", cm.GetType());
|
||||
DebugWriteLine ("cm.Count = {0}", cm.Count);
|
||||
cm.Position = 0;
|
||||
Console.WriteLine ("cm.Current = {0}", cm.Current);
|
||||
Console.WriteLine ("cm.Current properties");
|
||||
DebugWriteLine ("cm.Current = {0}", cm.Current);
|
||||
DebugWriteLine ("cm.Current properties");
|
||||
foreach (PropertyDescriptor pd in ((ICustomTypeDescriptor)cm.Current).GetProperties ())
|
||||
Console.WriteLine (" + {0}", pd.Name);
|
||||
Console.WriteLine ();
|
||||
DebugWriteLine (" + {0}", pd.Name);
|
||||
DebugWriteLine ();
|
||||
|
||||
cm = bc [data_source.Tables["Customers"]] as CurrencyManager;
|
||||
Console.WriteLine ("datatable:");
|
||||
Console.WriteLine ("cm = {0}", cm.GetType());
|
||||
Console.WriteLine ("cm.Count = {0}", cm.Count);
|
||||
DebugWriteLine ("datatable:");
|
||||
DebugWriteLine ("cm = {0}", cm.GetType());
|
||||
DebugWriteLine ("cm.Count = {0}", cm.Count);
|
||||
cm.Position = 0;
|
||||
Console.WriteLine ("cm.Current = {0}", cm.Current);
|
||||
Console.WriteLine ("cm.Current properties");
|
||||
DebugWriteLine ("cm.Current = {0}", cm.Current);
|
||||
DebugWriteLine ("cm.Current properties");
|
||||
foreach (PropertyDescriptor pd in ((ICustomTypeDescriptor)cm.Current).GetProperties ())
|
||||
Console.WriteLine (" + {0}", pd.Name);
|
||||
DebugWriteLine (" + {0}", pd.Name);
|
||||
|
||||
Console.WriteLine ();
|
||||
DebugWriteLine ();
|
||||
|
||||
DataViewManager vm = new DataViewManager (data_source);
|
||||
Console.WriteLine ("vm properties:");
|
||||
DebugWriteLine ("vm properties:");
|
||||
foreach (PropertyDescriptor pd in ((ITypedList)vm).GetItemProperties (null))
|
||||
Console.WriteLine (" + {0}", pd.Name);
|
||||
Console.WriteLine ();
|
||||
DebugWriteLine (" + {0}", pd.Name);
|
||||
DebugWriteLine ();
|
||||
|
||||
}
|
||||
|
||||
@@ -1240,5 +1242,16 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.Conditional("DebugCurrencyManager")]
|
||||
void DebugWriteLine ()
|
||||
{
|
||||
Console.WriteLine ();
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.Conditional("DebugCurrencyManager")]
|
||||
void DebugWriteLine (string text, params object[] p)
|
||||
{
|
||||
Console.WriteLine (text, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -168,8 +168,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (-1, cm.Position);
|
||||
|
||||
// Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual (
|
||||
"0: PositionChanged (to -1)\n1: ItemChanged (index = -1)\n2: PositionChanged (to -1)\n3: CurrentChanged\n4: CurrentItemChanged\n5: ItemChanged (index = -1)\n"
|
||||
, event_log, "2");
|
||||
@@ -219,8 +217,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (0, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual (
|
||||
|
||||
#if WITH_BINDINGS
|
||||
@@ -273,8 +269,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (0, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
#if WITH_BINDINGS
|
||||
Assert.AreEqual ("0: ItemChanged (index = -1)\n1: Binding.Format\n", event_log, "2");
|
||||
#else
|
||||
@@ -325,8 +319,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (0, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual (
|
||||
#if WITH_BINDINGS
|
||||
"0: CurrentChanged\n1: CurrentItemChanged\n2: ItemChanged (index = -1)\n3: Binding.Format\n"
|
||||
@@ -375,8 +367,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (0, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual (
|
||||
#if WITH_BINDINGS
|
||||
"0: PositionChanged (to 0)\n1: CurrentChanged\n2: CurrentItemChanged\n3: ItemChanged (index = -1)\n4: ItemChanged (index = -1)\n5: Binding.Format\n6: Binding.Format\n7: Binding.Format\n"
|
||||
@@ -424,8 +414,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (0, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
#if WITH_BINDINGS
|
||||
Assert.AreEqual ("0: ItemChanged (index = -1)\n1: Binding.Format\n", event_log, "2");
|
||||
#else
|
||||
@@ -479,8 +467,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (2, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual (
|
||||
#if WITH_BINDINGS
|
||||
"0: CurrentChanged\n1: CurrentItemChanged\n2: ItemChanged (index = -1)\n3: PositionChanged (to 2)\n4: Binding.Format\n"
|
||||
@@ -531,8 +517,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (2, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual (
|
||||
#if WITH_BINDINGS
|
||||
"0: CurrentChanged\n1: CurrentItemChanged\n2: ItemChanged (index = -1)\n3: PositionChanged (to 2)\n4: Binding.Format\n"
|
||||
@@ -574,8 +558,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (-1, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual ("0: MetaDataChanged\n", event_log, "2");
|
||||
Assert.AreEqual (0, cm.Count, "3");
|
||||
}
|
||||
@@ -611,8 +593,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (-1, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual ("0: MetaDataChanged\n", event_log, "2");
|
||||
|
||||
Assert.AreEqual (0, cm.Count, "3");
|
||||
@@ -650,7 +630,7 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (-1, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
//riteLine (event_log);
|
||||
|
||||
Assert.AreEqual ("0: MetaDataChanged\n", event_log, "3");
|
||||
|
||||
@@ -697,8 +677,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (-1, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual ("0: MetaDataChanged\n", event_log, "3");
|
||||
|
||||
Assert.AreEqual (0, cm.Count, "4");
|
||||
@@ -708,12 +686,12 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
void DataColumnCollection_CollectionChanged (object sender, CollectionChangeEventArgs e)
|
||||
{
|
||||
Console.WriteLine ("collection changed : {0} {1}", e.Action, e.Element.GetType());
|
||||
//Console.WriteLine ("collection changed : {0} {1}", e.Action, e.Element.GetType());
|
||||
}
|
||||
|
||||
void DataView_ListChanged (object sender, ListChangedEventArgs e)
|
||||
{
|
||||
Console.WriteLine ("list changed : {0} {1} {2}", e.ListChangedType, e.OldIndex, e.NewIndex);
|
||||
//Console.WriteLine ("list changed : {0} {1} {2}", e.ListChangedType, e.OldIndex, e.NewIndex);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -757,8 +735,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (0, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual (
|
||||
#if WITH_BINDINGS
|
||||
"0: CurrentItemChanged\n1: ItemChanged (index = 0)\n2: Binding.Format\n"
|
||||
@@ -810,7 +786,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (0, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
Assert.AreEqual ("0: ItemChanged (index = 0)\n", event_log, "2");
|
||||
|
||||
Assert.AreEqual (1, cm.Count, "3");
|
||||
@@ -853,8 +828,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
Assert.AreEqual (-1, cm.Position);
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual (
|
||||
"0: PositionChanged (to -1)\n1: ItemChanged (index = -1)\n2: PositionChanged (to -1)\n3: CurrentChanged\n4: CurrentItemChanged\n5: ItemChanged (index = -1)\n"
|
||||
, event_log, "1");
|
||||
@@ -948,8 +921,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
cm.CancelCurrentEdit ();
|
||||
Console.WriteLine ("<<<");
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual (
|
||||
"0: PositionChanged (to 0)\n1: CurrentChanged\n2: CurrentItemChanged\n3: ItemChanged (index = -1)\n4: ItemChanged (index = -1)\n5: PositionChanged (to -1)\n6: ItemChanged (index = -1)\n7: PositionChanged (to -1)\n8: CurrentChanged\n9: CurrentItemChanged\n10: ItemChanged (index = -1)\n11: ItemChanged (index = -1)\n",
|
||||
event_log, "1");
|
||||
@@ -995,8 +966,6 @@ namespace MonoTests.System.Windows.Forms.DataBinding
|
||||
|
||||
c1.Text = "hi";
|
||||
|
||||
Console.WriteLine (event_log);
|
||||
|
||||
Assert.AreEqual ("0: CurrentChanged\n1: CurrentItemChanged\n2: Binding.Format\n3: CurrentChanged\n4: CurrentItemChanged\n", event_log, "1");
|
||||
}
|
||||
}
|
||||
|
@@ -239,6 +239,8 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.IsNotNull (ex.ParamName, "#B5");
|
||||
Assert.AreEqual ("index", ex.ParamName, "#B6");
|
||||
}
|
||||
|
||||
form.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@@ -45,7 +45,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
{
|
||||
// Send a mouse event in Win32.
|
||||
[DllImport ("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
|
||||
private static extern void mouse_event (long dwFlags, long dx, long dy, long dwData, long dwExtraInfo);
|
||||
private static extern void mouse_event (int dwFlags, int dx, int dy, int dwData, IntPtr dwExtraInfo);
|
||||
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
|
||||
private const int MOUSEEVENTF_LEFTUP = 0x04;
|
||||
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
|
||||
@@ -1147,9 +1147,9 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
// Finally, fire a mouse-down and mouse-up event.
|
||||
mouse_event (MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_ABSOLUTE,
|
||||
ptGlobal.x, ptGlobal.y, 0, 0);
|
||||
ptGlobal.x, ptGlobal.y, 0, IntPtr.Zero);
|
||||
mouse_event (MOUSEEVENTF_LEFTUP|MOUSEEVENTF_ABSOLUTE,
|
||||
ptGlobal.x, ptGlobal.y, 0, 0);
|
||||
ptGlobal.x, ptGlobal.y, 0, IntPtr.Zero);
|
||||
|
||||
// Let the system process these events.
|
||||
Application.DoEvents ();
|
||||
|
@@ -43,7 +43,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (0, event_count, "3");
|
||||
p.ResumeLayout ();
|
||||
Assert.AreEqual (1, event_count, "4");
|
||||
Assert.AreEqual (null, most_recent_args.AffectedProperty, "5");
|
||||
Assert.AreEqual ("Anchor", most_recent_args.AffectedProperty, "5");
|
||||
|
||||
/* with the anchor style set to something, resize the parent */
|
||||
event_count = 0;
|
||||
@@ -58,12 +58,13 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (0, event_count, "8");
|
||||
p.ResumeLayout ();
|
||||
Assert.AreEqual (1, event_count, "9");
|
||||
Assert.AreEqual (null, most_recent_args.AffectedProperty, "10");
|
||||
Assert.AreEqual ("Bounds", most_recent_args.AffectedProperty, "10");
|
||||
|
||||
/* with the anchor style set to something, resize the child */
|
||||
event_count = 0;
|
||||
b.Size = new Size (100, 100);
|
||||
Assert.AreEqual (1, event_count, "11");
|
||||
// On .NET Framework PerformLayout is called twice; on Mono only once
|
||||
//Assert.AreEqual (2, event_count, "11");
|
||||
Assert.AreEqual ("Bounds", most_recent_args.AffectedProperty, "12");
|
||||
|
||||
/* and again with layout suspended */
|
||||
@@ -73,7 +74,27 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (0, event_count, "13");
|
||||
p.ResumeLayout ();
|
||||
Assert.AreEqual (1, event_count, "14");
|
||||
Assert.AreEqual (null, most_recent_args.AffectedProperty, "15");
|
||||
Assert.AreEqual ("Bounds", most_recent_args.AffectedProperty, "15");
|
||||
|
||||
/* change two properties when suspended */
|
||||
event_count = 0;
|
||||
p.SuspendLayout ();
|
||||
b.Anchor = AnchorStyles.Left;
|
||||
b.Size = new Size (150, 150);
|
||||
Assert.AreEqual (0, event_count, "15");
|
||||
p.ResumeLayout ();
|
||||
Assert.AreEqual (1, event_count, "16");
|
||||
Assert.AreEqual ("Bounds", most_recent_args.AffectedProperty, "17");
|
||||
|
||||
/* and now in the opposite order */
|
||||
event_count = 0;
|
||||
p.SuspendLayout ();
|
||||
b.Size = new Size (100, 100);
|
||||
b.Anchor = AnchorStyles.Top;
|
||||
Assert.AreEqual (0, event_count, "18");
|
||||
p.ResumeLayout ();
|
||||
Assert.AreEqual (1, event_count, "19");
|
||||
Assert.AreEqual ("Bounds", most_recent_args.AffectedProperty, "20");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -374,7 +395,6 @@ namespace MonoTests.System.Windows.Forms
|
||||
}
|
||||
|
||||
[Test] // bug #80917
|
||||
[Category ("NotWorking")]
|
||||
public void BehaviorOverriddenDisplayRectangle ()
|
||||
{
|
||||
Control c = new Control ();
|
||||
@@ -525,11 +545,9 @@ namespace MonoTests.System.Windows.Forms
|
||||
[Test]
|
||||
public void Bug82762 ()
|
||||
{
|
||||
if (TestHelper.RunningOnUnix)
|
||||
Assert.Ignore ("WM Size dependent");
|
||||
|
||||
Form f = new Form ();
|
||||
f.ShowInTaskbar = false;
|
||||
f.ClientSize = new Size (284, 264);
|
||||
|
||||
Button b = new Button ();
|
||||
b.Size = new Size (100, 100);
|
||||
|
@@ -33,7 +33,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (b, e2.Binding, "B1");
|
||||
Assert.AreEqual (BindingCompleteState.Success, e2.BindingCompleteState, "B2");
|
||||
Assert.AreEqual (c, e2.BindingCompleteContext, "B3");
|
||||
Assert.AreEqual (false, e2.Cancel, "B4");
|
||||
Assert.AreEqual (true, e2.Cancel, "B4");
|
||||
Assert.AreEqual (errorText, e2.ErrorText, "B5");
|
||||
Assert.AreEqual (null, e2.Exception, "B6");
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (b, e3.Binding, "C1");
|
||||
Assert.AreEqual (BindingCompleteState.Success, e3.BindingCompleteState, "C2");
|
||||
Assert.AreEqual (c, e3.BindingCompleteContext, "C3");
|
||||
Assert.AreEqual (false, e3.Cancel, "C4");
|
||||
Assert.AreEqual (true, e3.Cancel, "C4");
|
||||
Assert.AreEqual (errorText, e3.ErrorText, "C5");
|
||||
Assert.AreEqual (ex, e3.Exception, "C6");
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (false, e.IsInputKey, "A3");
|
||||
Assert.AreEqual ((Keys)66, e.KeyCode, "A4"); // B
|
||||
Assert.AreEqual (k, e.KeyData, "A5");
|
||||
Assert.AreEqual (Convert.ToInt32 (k), e.KeyValue, "A6");
|
||||
Assert.AreEqual (66, e.KeyValue, "A6");
|
||||
Assert.AreEqual ((Keys)196608, e.Modifiers, "A7"); // Control + Shift
|
||||
Assert.AreEqual (true, e.Shift, "A8");
|
||||
|
||||
|
@@ -216,13 +216,16 @@ namespace MonoTests.System.Windows.Forms
|
||||
p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
|
||||
p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
|
||||
|
||||
Assert.AreEqual (new Size (400, 100), p.PreferredSize, "O1");
|
||||
|
||||
p.SetFlowBreak (p.Controls[0], true);
|
||||
p.SetFlowBreak (p.Controls[2], true);
|
||||
|
||||
Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[0].Bounds, "O1");
|
||||
Assert.AreEqual (new Rectangle (0, 100, 100, 100), p.Controls[1].Bounds, "O2");
|
||||
Assert.AreEqual (new Rectangle (100, 100, 100, 100), p.Controls[2].Bounds, "O3");
|
||||
Assert.AreEqual (new Rectangle (0, 200, 100, 100), p.Controls[3].Bounds, "O4");
|
||||
|
||||
Assert.AreEqual (new Size (200, 300), p.PreferredSize, "O2");
|
||||
Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[0].Bounds, "O3");
|
||||
Assert.AreEqual (new Rectangle (0, 100, 100, 100), p.Controls[1].Bounds, "O4");
|
||||
Assert.AreEqual (new Rectangle (100, 100, 100, 100), p.Controls[2].Bounds, "O5");
|
||||
Assert.AreEqual (new Rectangle (0, 200, 100, 100), p.Controls[3].Bounds, "O6");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -236,10 +239,11 @@ namespace MonoTests.System.Windows.Forms
|
||||
p.Controls.Add (CreateButton (50, 50, false, DockStyle.None, new Padding (14,7,1,3), AnchorStyles.Left | AnchorStyles.Top));
|
||||
p.Controls.Add (CreateButton (50, 50, false, DockStyle.None, new Padding (4), AnchorStyles.Left | AnchorStyles.Top));
|
||||
|
||||
Assert.AreEqual (new Rectangle (1, 3, 50, 50), p.Controls[0].Bounds, "P1");
|
||||
Assert.AreEqual (new Rectangle (63, 3, 50, 50), p.Controls[1].Bounds, "P2");
|
||||
Assert.AreEqual (new Rectangle (139, 7, 50, 50), p.Controls[2].Bounds, "P3");
|
||||
Assert.AreEqual (new Rectangle (4, 64, 50, 50), p.Controls[3].Bounds, "P4");
|
||||
Assert.AreEqual (new Size (248, 60), p.PreferredSize, "P1");
|
||||
Assert.AreEqual (new Rectangle (1, 3, 50, 50), p.Controls[0].Bounds, "P2");
|
||||
Assert.AreEqual (new Rectangle (63, 3, 50, 50), p.Controls[1].Bounds, "P3");
|
||||
Assert.AreEqual (new Rectangle (139, 7, 50, 50), p.Controls[2].Bounds, "P4");
|
||||
Assert.AreEqual (new Rectangle (4, 64, 50, 50), p.Controls[3].Bounds, "P5");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -253,10 +257,11 @@ namespace MonoTests.System.Windows.Forms
|
||||
p.Controls.Add (CreateButton (15, 85, false, DockStyle.None, new Padding (2), AnchorStyles.Left | AnchorStyles.Top));
|
||||
p.Controls.Add (CreateButton (50, 20, false, DockStyle.None, new Padding (4), AnchorStyles.Left | AnchorStyles.Top));
|
||||
|
||||
Assert.AreEqual (new Rectangle (6, 6, 25, 45), p.Controls[0].Bounds, "Q1");
|
||||
Assert.AreEqual (new Rectangle (46, 9, 60, 20), p.Controls[1].Bounds, "Q2");
|
||||
Assert.AreEqual (new Rectangle (117, 2, 15, 85), p.Controls[2].Bounds, "Q3");
|
||||
Assert.AreEqual (new Rectangle (138, 4, 50, 20), p.Controls[3].Bounds, "Q4");
|
||||
Assert.AreEqual (new Size (192, 89), p.PreferredSize, "Q1");
|
||||
Assert.AreEqual (new Rectangle (6, 6, 25, 45), p.Controls[0].Bounds, "Q2");
|
||||
Assert.AreEqual (new Rectangle (46, 9, 60, 20), p.Controls[1].Bounds, "Q3");
|
||||
Assert.AreEqual (new Rectangle (117, 2, 15, 85), p.Controls[2].Bounds, "Q4");
|
||||
Assert.AreEqual (new Rectangle (138, 4, 50, 20), p.Controls[3].Bounds, "Q5");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -272,12 +277,13 @@ namespace MonoTests.System.Windows.Forms
|
||||
p.Controls.Add (CreateButton (13, 22, false, DockStyle.None, new Padding (12), AnchorStyles.Left | AnchorStyles.Right));
|
||||
p.Controls.Add (CreateButton (73, 28, false, DockStyle.Top, new Padding (6), AnchorStyles.None));
|
||||
|
||||
Assert.AreEqual (new Rectangle (6, 6, 25, 45), p.Controls[0].Bounds, "R1");
|
||||
Assert.AreEqual (new Rectangle (46, 9, 60, 39), p.Controls[1].Bounds, "R2");
|
||||
Assert.AreEqual (new Rectangle (117, 2, 15, 53), p.Controls[2].Bounds, "R3");
|
||||
Assert.AreEqual (new Rectangle (138, 33, 50, 20), p.Controls[3].Bounds, "R4");
|
||||
Assert.AreEqual (new Rectangle (12, 69, 13, 22), p.Controls[4].Bounds, "R5");
|
||||
Assert.AreEqual (new Rectangle (43, 63, 73, 28), p.Controls[5].Bounds, "R6");
|
||||
Assert.AreEqual (new Size (314, 57), p.PreferredSize, "R1");
|
||||
Assert.AreEqual (new Rectangle (6, 6, 25, 45), p.Controls[0].Bounds, "R2");
|
||||
Assert.AreEqual (new Rectangle (46, 9, 60, 39), p.Controls[1].Bounds, "R3");
|
||||
Assert.AreEqual (new Rectangle (117, 2, 15, 53), p.Controls[2].Bounds, "R4");
|
||||
Assert.AreEqual (new Rectangle (138, 33, 50, 20), p.Controls[3].Bounds, "R5");
|
||||
Assert.AreEqual (new Rectangle (12, 69, 13, 22), p.Controls[4].Bounds, "R6");
|
||||
Assert.AreEqual (new Rectangle (43, 63, 73, 28), p.Controls[5].Bounds, "R7");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@@ -1293,6 +1293,8 @@ OnGotFocus: ContainerControl 1 System.Windows.Forms.ContainerControl
|
||||
|
||||
Assert.IsTrue (t2.Focused, "#A1");
|
||||
Assert.AreSame (t2, c.ActiveControl, "#A2");
|
||||
|
||||
form.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1 +1 @@
|
||||
424baa00da302fe58cee9ed2b9a036c69dc8a3d8
|
||||
7c50cf76cc7959b4f72a51d62135fda9d187acaf
|
@@ -183,7 +183,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
Assert.AreEqual (FlatStyle.Standard, l.FlatStyle, "#30");
|
||||
Assert.IsFalse (l.Focused, "#31");
|
||||
Assert.AreEqual (FontFamily.GenericSansSerif, l.Font.FontFamily, "#32");
|
||||
Assert.AreEqual (SystemFonts.DefaultFont, l.Font, "#32");
|
||||
Assert.AreEqual (SystemColors.ControlText, l.ForeColor, "#33");
|
||||
|
||||
Assert.IsFalse (l.HasChildren, "#35");
|
||||
@@ -324,7 +324,43 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (-1, b.ImageIndex, "D14");
|
||||
Assert.AreEqual (string.Empty, b.ImageKey, "D15");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SelfSizingTest ()
|
||||
{
|
||||
TableLayoutPanel p1 = new TableLayoutPanel ();
|
||||
Label l1 = new Label ();
|
||||
l1.AutoSize = true;
|
||||
p1.Controls.Add (l1);
|
||||
p1.SuspendLayout ();
|
||||
Size l1_saved_size = l1.Size;
|
||||
l1.Text = "Text";
|
||||
Assert.AreEqual (l1_saved_size, l1.Size, "#1");
|
||||
p1.ResumeLayout ();
|
||||
Assert.AreNotEqual (l1_saved_size, l1.Size, "#1a");
|
||||
|
||||
FlowLayoutPanel p2 = new FlowLayoutPanel ();
|
||||
Label l2 = new Label ();
|
||||
l2.AutoSize = true;
|
||||
p2.Controls.Add (l2);
|
||||
p2.SuspendLayout ();
|
||||
Size l2_saved_size = l2.Size;
|
||||
l2.Text = "Text";
|
||||
Assert.AreEqual (l2_saved_size, l2.Size, "#2");
|
||||
p2.ResumeLayout ();
|
||||
Assert.AreNotEqual (l2_saved_size, l2.Size, "#2a");
|
||||
|
||||
Panel p3 = new Panel ();
|
||||
Label l3 = new Label ();
|
||||
l3.AutoSize = true;
|
||||
p3.Controls.Add (l3);
|
||||
p3.SuspendLayout ();
|
||||
Size l3_saved_size = l3.Size;
|
||||
l3.Text = "Text";
|
||||
Assert.AreNotEqual (l3_saved_size, l3.Size, "#2");
|
||||
p3.ResumeLayout ();
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class LabelEventTest : TestHelper
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user