Click here to Skip to main content
15,897,891 members
Articles / Programming Languages / C#

Article Two: Building a UI Platform in C# - Testing via UI Animation

,
Rate me:
Please Sign up or sign in to vote.
4.20/5 (7 votes)
3 Mar 20055 min read 51.4K   927   33  
Describes an implementation of UI animation for the support of Test-Driven Development.
// (c) 2003-2005 Datron, Inc.  All rights reserved. http://www.blix.net

using UITestingFramework;

namespace freeBlix
{
	[IsAncestor]
	public class MoveDragCase: Case
	{
		#region Fields
		private System.Windows.Forms.Form _Form;
		private ControlSystem _ControlSystem;
		private Stone _Stone;
		private StonePad _StonePad;
		#endregion

		#region Setup
		protected override void Setup()
		{
			_Form = new System.Windows.Forms.Form();
			_Form.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
			_Form.Location = System.Drawing.Point.Empty;
			_Form.ClientSize = new System.Drawing.Size(492, 465);
			_Form.Text = Number + "." + Name + " - Testing Framework [Test Form]";
	
			_ControlSystem = new ControlSystem();		
			_ControlSystem.Form = _Form;
		
			((DragState)GetState()).Offscreen = _ControlSystem.PaintDeck.FormBlaster.Offscreen;

			TestObject = _ControlSystem.ControlOverlay;

			CreateStonePad();

			CreateStone();

			_Form.Show();
	
			ControlSystem.PaintDeck.FormBlaster.Paint();
		}
		#endregion		
		#region TearDown
		protected override void TearDown()
		{
			if (_Form != null)			
				_Form.Close();
						
			_Stone = null;
			_StonePad = null;
			_ControlSystem = null;	
			_Form = null;
		}		
		#endregion
		
		#region CreateStone
		protected void CreateStone()
		{
			_Stone = new Stone();
			_Stone.Bounds.Left = 10;
			_Stone.Bounds.Top = 10;
			_Stone.Bounds.Width = 100;
			_Stone.Bounds.Height = 100;
			_Stone.FillColor = System.Drawing.Color.FromArgb(64, System.Drawing.Color.Blue);
			_Stone.HotFillColor = System.Drawing.Color.FromArgb(128, System.Drawing.Color.Blue);

			((IChildren)_ControlSystem.ControlOverlay).Children.Add(_Stone);						

			ControlSystem.DragManifest.AddDragBot(new MoveDragBot(Stone));

			ControlSystem.PaintDeck.FormBlaster.Paint();
		}
		#endregion
		#region CreateStonePad
		protected void CreateStonePad()
		{
			_StonePad = new StonePad();
			_StonePad.Bounds.Left = 310;
			_StonePad.Bounds.Top = 310;
			_StonePad.Bounds.Width = 102;
			_StonePad.Bounds.Height = 102;
			_StonePad.BorderColor = System.Drawing.Color.FromArgb(64, System.Drawing.Color.Red);
			_StonePad.HotBorderColor = System.Drawing.Color.FromArgb(128, System.Drawing.Color.Red);

			((IChildren)_ControlSystem.ControlOverlay).Children.Add(_StonePad);						

			ControlSystem.DragManifest.AddDropSite(new MoveDropSite(StonePad));

			ControlSystem.PaintDeck.FormBlaster.Paint();
		}
		#endregion

		#region ControlSystem
		protected ControlSystem ControlSystem
		{
			get
			{
				return _ControlSystem;
			}
		}
		#endregion
		#region Form
		protected System.Windows.Forms.Form Form
		{
			get
			{
				return _Form;
			}
		}
		#endregion

		#region Stone
		protected Stone Stone
		{
			get
			{
				return _Stone;
			}
		}
		#endregion
		#region StonePad
		protected StonePad StonePad
		{
			get
			{
				return _StonePad;
			}
		}
		#endregion

		#region StateType
		public override System.Type StateType
		{
			get
			{
				return typeof(DragState);
			}
		}
		#endregion			 
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
CEO Sagerion, LLC
United States United States
I read About Face by Alan Cooper in 1995 and immediately recognized it as a founding document for the future of software. I also recognized we had a long, long way to go - and yes, even with the advent of iOS, we are still not there yet.

At my company, Sagerion (say-jair-ee-on), we can take a look at your planned or existing software and suggest ways of making it better - lots better. We can develop down-to-the-pixel blueprints showing exactly what our suggestions mean. We can help manage on-going development to make sure the top-notch user-experience we've suggested really does get built. Now, honestly, how often have you ever seen all those things happen?

You may or may not already have great development going on - but what does that matter if you don't have great design driving it?

Feel free to contact me at tom@sagerion.com, I would love to hear about your next ground-breaking project.

Written By
Founder Sagerion LLC
United States United States
www.filoshare.com
-It is a fresh and free distributed source control system.

Comments and Discussions