File: ButtonBaseTest.cs

package info (click to toggle)
mono 4.6.2.7+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 778,148 kB
  • ctags: 914,052
  • sloc: cs: 5,779,509; xml: 2,773,713; ansic: 432,645; sh: 14,749; makefile: 12,361; perl: 2,488; python: 1,434; cpp: 849; asm: 531; sql: 95; sed: 16; php: 1
file content (62 lines) | stat: -rw-r--r-- 1,718 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// Copyright (c) 2007 Novell, Inc.
//
// Authors:
//      Jonathan Pobst  <monkey@jpobst.com>
//

using System;
using System.Windows.Forms;
using System.Drawing;
using NUnit.Framework;

namespace MonoTests.System.Windows.Forms
{
	[TestFixture]
	public class ButtonBaseTest : TestHelper
	{
		[Test]
		public void Constructor ()
		{
			MockButton b = new MockButton ();
			
			Assert.AreEqual (SystemColors.Control, b.BackColor, "A4");
			Assert.AreEqual (FlatStyle.Standard, b.FlatStyle, "A6");
			Assert.IsNull (b.Image, "A7");
			Assert.AreEqual (ContentAlignment.MiddleCenter, b.ImageAlign, "A8");
			Assert.AreEqual (-1, b.ImageIndex, "A9");
			Assert.IsNull (b.ImageList, "A11");
			Assert.AreEqual (ImeMode.Disable, b.ImeMode, "A12");
			Assert.AreEqual (string.Empty, b.Text, "A13");
			Assert.AreEqual (ContentAlignment.MiddleCenter, b.TextAlign, "A14");

			Assert.IsFalse (b.AutoEllipsis, "A1");
			Assert.IsFalse (b.AutoSize, "A2");
			Assert.AreEqual (string.Empty, b.ImageKey, "A10");
			Assert.AreEqual (TextImageRelation.Overlay, b.TextImageRelation, "A15");
			Assert.IsTrue (b.UseCompatibleTextRendering, "A16");
			Assert.IsTrue (b.UseMnemonic, "A17");
			Assert.IsTrue (b.UseVisualStyleBackColor, "A18");
			Assert.AreEqual (AccessibleStates.None, b.AccessibilityObject.State, "A19");
		}

		[Test]
		public void IsDefault ()
		{
			MockButton b = new MockButton ();
			Assert.IsFalse (b.IsDefault, "#1");
			b.IsDefault = true;
			Assert.IsTrue (b.IsDefault, "#2");
			b.IsDefault = false;
			Assert.IsFalse (b.IsDefault, "#3");
		}
		
		private class MockButton : ButtonBase
		{
			public new bool IsDefault {
				get { return base.IsDefault; }
				set { base.IsDefault = value; }
			}
		}
	}
}