using System.Runtime.Remoting;
using System.Threading;
using System.Windows.Forms;
-#if NET_2_0
using System.Windows.Forms.Layout;
-#endif
using NUnit.Framework;
using CategoryAttribute = NUnit.Framework.CategoryAttribute;
CreateHandle ();
}
}
-#if NET_2_0
[Test]
public void AutoSizeTest ()
{
}
}
-#endif
[Test]
public void Bug82748 ()
Assert.AreEqual ("{Width=0, Height=0}", c.Size.ToString (), "#S1");
}
-#if NET_2_0
[Test]
public void CaptureTest ()
{
Assert.IsFalse (log.IsHandleCreated, "#05");
Assert.IsTrue (log.Log.ToString ().IndexOf ("OnMouseCaptureChanged") == -1, "#06");
}
-#endif
public class OnPaintTester : Form
{
public bool TestRefresh;
public bool TestInvalidate;
public bool TestUpdate;
-#if NET_2_0
public new bool DoubleBuffered {
get {
return base.DoubleBuffered;
base.DoubleBuffered = value;
}
}
-#endif
protected override void OnPaint (PaintEventArgs pevent)
{
Assert.IsFalse (list.Contains (pevent.Graphics), "OnPaintTester.OnPaint: Got the same Graphics twice");
Assert.IsFalse (t.Recursive, "#3");
}
}
-#if NET_2_0
[Test]
[Category ("Interactive")]
public void OnPaintDoubleBufferedTest ()
Assert.IsFalse (t.Recursive, "#3");
}
}
-#endif
public class PaintEventForm : Form
{
public ArrayList overrides = new ArrayList ();
[Ignore ("Can't find a reliable way to generate a paint message on Windows.")]
public void EventStyleTest ()
{
-#if NET_2_0
using (PaintEventForm f = new PaintEventForm ()) {
f.Show ();
f.SetControlStyle (ControlStyles.OptimizedDoubleBuffer, true);
Assert.IsTrue (f.overrides.Contains ("OnPaint"), "#A2");
Assert.IsTrue (f.events.Contains ("Paint"), "#A3");
}
-#endif
using (PaintEventForm f = new PaintEventForm ()) {
f.Show ();
f.SetControlStyle (ControlStyles.DoubleBuffer, true);
Assert.IsTrue (f.events.Contains ("Paint"), "#H3");
}
}
-#if NET_2_0
public class DoubleBufferedForm : Form
{
public bool painted;
TestControlStyle.CheckStyles (c, "#B3", ControlStyles.AllPaintingInWmPaint);
}
-#endif
class Helper {
public static void TestAccessibility(Control c, string Default, string Description, string Name, AccessibleRole Role)
Assert.IsFalse (c.Font.Strikeout, "#A7");
Assert.IsFalse (c.Font.Underline, "#A8");
Assert.AreEqual (GraphicsUnit.Point, c.Font.Unit, "#A9");
-#if NET_2_0
Assert.IsTrue (c.Font.IsSystemFont, "#A10");
-#endif
c.Font = new Font (c.Font.FontFamily, 3, FontStyle.Italic);
Assert.IsFalse (c.Font.Bold, "#B1");
Assert.IsFalse (c.Font.Strikeout, "#B7");
Assert.IsFalse (c.Font.Underline, "#B8");
Assert.AreEqual (GraphicsUnit.Point, c.Font.Unit, "#B9");
-#if NET_2_0
Assert.AreEqual (false, c.Font.IsSystemFont, "#B10");
-#endif
}
[Test]
Assert.AreEqual ("Control", c.BackColor.Name , "B1");
Assert.IsNull (c.BackgroundImage, "B2");
Assert.IsNull (c.BindingContext, "B3");
-#if NET_2_0
Assert.AreEqual (ImageLayout.Tile, c.BackgroundImageLayout, "B4");
-#endif
Assert.IsFalse (c.CanFocus, "C1");
Assert.IsTrue (c.CanSelect, "C2");
Assert.AreEqual(Point.Empty, c.Location, "L2");
-#if NET_2_0
Assert.IsTrue(c.MaximumSize.IsEmpty);
Assert.IsTrue(c.MinimumSize.IsEmpty);
-#endif
Assert.AreEqual (Keys.None, Control.ModifierKeys, "M1");
Assert.IsTrue (Control.MousePosition.X >= 0 && Control.MousePosition.Y >= 0, "M2");
Assert.AreEqual (MouseButtons.None, Control.MouseButtons, "M3");
Assert.AreEqual(40, r1.Height, "Scale2");
}
-#if NET_2_0
[Test]
public void ScaleChildrenTest ()
{
get { return scale_children; }
}
}
-#endif
[Test] // Bug #347282
public void ScaleHierarchy ()
Assert.AreEqual (d.Name, l.Name, "Child4");
// GetChildAtPointSkip is not implemented and the following test is breaking for Net_2_0 profile
-#if NET_2_0
c.Controls.Add (e);
e.Visible = false;
l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Invisible);
l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Transparent);
Assert.AreSame (e.Name, l.Name, "Child10");
-#endif // NET_2_0
} finally {
if (c != null)
c.Dispose ();
Assert.IsFalse (c.Font.Strikeout, "#7");
Assert.IsFalse (c.Font.Underline, "#8");
Assert.AreEqual (GraphicsUnit.Point, c.Font.Unit, "#9");
-#if NET_2_0
Assert.AreEqual (true, c.Font.IsSystemFont, "#10");
-#endif
}
public class LayoutTestControl : Control {
form.Dispose ();
}
-#if NET_2_0
[Test]
public void UseWaitCursorTest ()
{
return base.SizeFromClientSize (clientSize);
}
}
-#endif
public class MockControl : Control
{
const int WM_SYSCHAR = 0x0106;
const int WM_KEYUP = 0x0101;
-#if NET_2_0
[Test]
public void MethodPreProcessControlMessage ()
{
Assert.AreEqual (PreProcessControlState.MessageNotNeeded, c.PreProcessControlMessage (ref m), "A16");
if (testing_callstack) Console.WriteLine ("End {0}\n", m.WParam.ToString ());
}
-#endif
[Test]
public void MethodPreProcessMessage ()
return retval;
}
-#if NET_2_0
protected override void OnPreviewKeyDown (PreviewKeyDownEventArgs e)
{
if (testing_callstack) Console.Write ("OnPreviewKeyDown[");
base.OnPreviewKeyDown (e);
if (testing_callstack) Console.WriteLine ("]");
}
-#endif
protected override bool IsInputChar (char charCode)
{
}
}
-#if NET_2_0
[TestFixture]
public class ControlLayoutTest : TestHelper
{
private bool _layoutInvoked;
}
}
-#endif
}