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

ListBoxEventTest.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: 65d3551183207524c110c7e55b36d2743d23c045 (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
//
// Copyright  (c) 2005 Novell, Inc.
//
// Authors:
//      Ritvik Mayank (mritvik@novell.com)
//

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

namespace MonoTests.System.Windows.Forms
{
	[TestFixture]
	[Ignore ("This test has to be completly reviewed")]
	public class ListBoxDrawItemEvent
	{	
		static bool eventhandled = false;
		public void DrawItem_EventHandler (object sender,DrawItemEventArgs e)
		{
			eventhandled = true;
		}

		[Test]
		public void DrawItemTest ()
		{
			Form myform = new Form ();
			ListBox lb1 = new ListBox ();
			lb1.Items.Add ("A");
			// Test DrawItem Event
			lb1.DrawItem += new DrawItemEventHandler (DrawItem_EventHandler);		
			lb1.DrawMode = DrawMode.OwnerDrawFixed;
			myform.Controls.Add (lb1);
			myform.Show ();
			Assert.AreEqual (true, eventhandled, "#A1");
		}

		[TestFixture]
		[Ignore ("This test has to be completly reviewed")]
		public class ListBoxMeasureItemEvent
		{
			static bool eventhandled = false;
			public void MeasureItem_EventHandler (object sender,MeasureItemEventArgs e)
			{
				eventhandled = true;
			}		

			[Test]
			public void MeasureItemTest ()
			{
				Form myform = new Form ();
				myform.Visible = true;
				ListBox lb1 = new ListBox ();
				lb1.Items.Add ("B");
				lb1.Visible = true;
				myform.Controls.Add (lb1);
				// Test MeasureItem Event
				lb1.MeasureItem += new MeasureItemEventHandler (MeasureItem_EventHandler);		
				lb1.DrawMode = DrawMode.OwnerDrawVariable;
				Assert.AreEqual (true, eventhandled, "#A2");
			}
		}
	}
}