2 // Copyright (c) 2005 Novell, Inc.
5 // Hisham Mardam Bey (hisham.mardambey@gmail.com)
11 using NUnit.Framework;
12 using System.Windows.Forms;
14 using System.Runtime.Remoting;
16 namespace MonoTests.System.Windows.Forms
19 public class LabelTest2
23 public void PubPropTest ()
25 Label l = new Label ();
28 Assert.AreEqual (false, l.AutoSize, "A1");
30 Assert.AreEqual (true, l.AutoSize, "A2");
32 Assert.AreEqual (false, l.AutoSize, "A3");
35 Assert.AreEqual (null, l.BackgroundImage, "B1");
36 l.BackgroundImage = Image.FromFile ("a.png");;
37 Assert.IsNotNull (l.BackgroundImage, "B2");
38 Bitmap bmp = (Bitmap)l.BackgroundImage;
39 Assert.IsNotNull (bmp.GetPixel (0, 0), "B3");
41 Assert.AreEqual (BorderStyle.None, l.BorderStyle, "B4");
42 l.BorderStyle = BorderStyle.FixedSingle;
43 Assert.AreEqual (BorderStyle.FixedSingle, l.BorderStyle, "B5");
44 l.BorderStyle = BorderStyle.Fixed3D;
45 Assert.AreEqual (BorderStyle.Fixed3D, l.BorderStyle, "B6");
46 l.BorderStyle = BorderStyle.None;
47 Assert.AreEqual (BorderStyle.None, l.BorderStyle, "B7");
50 string name = l.CompanyName;
51 if (!name.Equals("Mono Project, Novell, Inc.") && !name.Equals("Microsoft Corporation")) {
52 Assert.Fail("CompanyName property does not match any accepted value - C1");
57 Assert.AreEqual (FlatStyle.Standard, l.FlatStyle, "F1");
58 l.FlatStyle = FlatStyle.Flat;
59 Assert.AreEqual (FlatStyle.Flat, l.FlatStyle, "F1");
60 l.FlatStyle = FlatStyle.Popup;
61 Assert.AreEqual (FlatStyle.Popup, l.FlatStyle, "F2");
62 l.FlatStyle = FlatStyle.Standard;
63 Assert.AreEqual (FlatStyle.Standard, l.FlatStyle, "F3");
64 l.FlatStyle = FlatStyle.System;
65 Assert.AreEqual (FlatStyle.System, l.FlatStyle, "F4");
68 Assert.AreEqual (ContentAlignment.MiddleCenter, l.ImageAlign, "I1");
69 l.ImageAlign = ContentAlignment.TopLeft;
70 Assert.AreEqual (ContentAlignment.TopLeft, l.ImageAlign, "I2");
71 l.ImageAlign = ContentAlignment.TopCenter;
72 Assert.AreEqual (ContentAlignment.TopCenter, l.ImageAlign, "I3");
73 l.ImageAlign = ContentAlignment.TopRight;
74 Assert.AreEqual (ContentAlignment.TopRight, l.ImageAlign, "I4");
75 l.ImageAlign = ContentAlignment.MiddleLeft;
76 Assert.AreEqual (ContentAlignment.MiddleLeft, l.ImageAlign, "I5");
77 l.ImageAlign = ContentAlignment.MiddleCenter;
78 Assert.AreEqual (ContentAlignment.MiddleCenter, l.ImageAlign, "I6");
79 l.ImageAlign = ContentAlignment.MiddleRight;
80 Assert.AreEqual (ContentAlignment.MiddleRight, l.ImageAlign, "I7");
81 l.ImageAlign = ContentAlignment.BottomLeft;
82 Assert.AreEqual (ContentAlignment.BottomLeft, l.ImageAlign, "I8");
83 l.ImageAlign = ContentAlignment.BottomCenter;
84 Assert.AreEqual (ContentAlignment.BottomCenter, l.ImageAlign, "I9");
85 l.ImageAlign = ContentAlignment.BottomRight;
86 Assert.AreEqual (ContentAlignment.BottomRight, l.ImageAlign, "I10");
87 Assert.AreEqual (-1, l.ImageIndex, "I11");
88 Assert.AreEqual (null, l.ImageList, "I12");
89 Assert.AreEqual (null, l.Image, "I13");
90 l.Image = Image.FromFile ("a.png");
91 Assert.IsNotNull (l.Image, "I14");
92 bmp = (Bitmap)l.Image;
93 Assert.IsNotNull (bmp.GetPixel (0, 0), "I15");
96 ImageList il = new ImageList ();
97 il.ColorDepth = ColorDepth.Depth32Bit;
98 il.ImageSize = new Size (15, 15);
99 il.Images.Add (Image.FromFile ("a.png"));
103 Assert.AreEqual (0, l.ImageIndex, "I16");
104 Assert.IsNotNull (l.ImageList, "I17");
111 // Assert.AreEqual (false, l.TabStop, "T1");
112 Assert.AreEqual (ContentAlignment.TopLeft, l.TextAlign, "T2");
115 Assert.AreEqual (true, l.UseMnemonic, "U1");
116 l.UseMnemonic = false;
117 Assert.AreEqual (false, l.UseMnemonic, "U2");
121 public void PubMethodTest ()
123 Label l = new Label ();
127 Assert.AreEqual ("System.Windows.Forms.LabelText: My Label", l.ToString (), "T1");