Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ProgressBarTest.cs « System.Windows.Forms « Test « Managed.Windows.Forms « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0b93e3db00b93fb0ba061f558945bbe9fb008c92 (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// ProgressBarTest.cs: Test cases for ProgressBar.
//
// Author:
//   Ritvik Mayank (mritvik@novell.com)
//
// (C) 2005 Novell, Inc. (http://www.novell.com)
//

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

namespace MonoTests.System.Windows.Forms
{
	[TestFixture]
	[Ignore ("This test has to be completly reviewed")]
	public class ProgressBarBaseTest
	{
		[Test]
		public void ProgressBarPropertyTest ()
		{
			ProgressBar myProgressBar = new ProgressBar ();
			
			// A
			Assert.AreEqual (false, myProgressBar.AllowDrop, "#A1");
			
			// B
			Assert.AreEqual ("Control", myProgressBar.BackColor.Name, "#B1");
			myProgressBar.BackColor = Color.White;
			Assert.AreEqual (255, myProgressBar.BackColor.R, "#B2");
			Assert.AreEqual (null, myProgressBar.BackgroundImage, "#B3");
			string gif = "M.gif";
			myProgressBar.BackgroundImage = Image.FromFile (gif);
			// comparing image objects fails on MS .Net so using Size property
			Assert.AreEqual (Image.FromFile(gif, true).Size, myProgressBar.BackgroundImage.Size, "#B4");
			
			// F 
			Assert.AreEqual (8.25, myProgressBar.Font.Size, "#F1");
			Assert.AreEqual (FontStyle.Regular, myProgressBar.Font.Style, "#F2");
			Assert.AreEqual ("ControlText", myProgressBar.ForeColor.Name, "#F3");
			
			// M
			Assert.AreEqual (100, myProgressBar.Maximum, "#M1");
			Assert.AreEqual (0, myProgressBar.Minimum, "#M2");
			
			// R
			Assert.AreEqual (RightToLeft.No, myProgressBar.RightToLeft, "#R1");
						
			// S
			Assert.AreEqual (10, myProgressBar.Step, "#S1");

			// T
			Assert.AreEqual ("", myProgressBar.Text, "#T1");
			myProgressBar.Text = "New ProgressBar";
			Assert.AreEqual ("New ProgressBar", myProgressBar.Text, "#T2");

			// V
			Assert.AreEqual (0, myProgressBar.Value, "#V1");
		}
		
		[Test]
		[ExpectedException (typeof (ArgumentException))]		
		public void ValueTest ()
		{
			ProgressBar myProgressBar = new ProgressBar ();
			myProgressBar.Value = -1;
			myProgressBar.Value = 100;
		}
	
		[Test]
		public void ToStringMethodTest () 
		{
			ProgressBar myProgressBar = new ProgressBar ();
			myProgressBar.Text = "New ProgressBar";
			Assert.AreEqual ("System.Windows.Forms.ProgressBar, Minimum: 0, Maximum: 100, Value: 0", myProgressBar.ToString (), "#T3");
		}
		// [MonoTODO("Add test for method Increment (Visual Test)")]
		// [MonoTODO("Add test for method PerformStep (Visual Test)")]
	}
}