PageRenderTime 40ms CodeModel.GetById 37ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Rendering/BasicTests/GraphicsTests.cs

#
C# | 87 lines | 68 code | 5 blank | 14 comment | 2 complexity | 5d1fde6fcd9a49be39396d4ed770943a MD5 | raw file
 1using Delta.Engine;
 2using Delta.Utilities.Datatypes;
 3using NUnit.Framework;
 4
 5namespace Delta.Rendering.BasicTests
 6{
 7	internal class GraphicsTests
 8	{
 9		#region ClearColor (Static)
10		/// <summary>
11		/// Clear color: Simply test if the clear color is set properly.
12		/// </summary>
13		[Test]
14		public static void ClearColor()
15		{
16			Color[] colors =
17				{
18					Color.Red,
19					Color.Green,
20					Color.Blue,
21					Color.Yellow,
22					Color.White,
23					Color.Grey,
24					Color.Black
25				};
26
27			int currentColorIndex = 0;
28			Application.Start(delegate
29			{
30				if (Time.EverySecond)
31				{
32					currentColorIndex++;
33					currentColorIndex %= colors.Length;
34					Application.BackgroundColor = colors[currentColorIndex];
35				}
36			});
37		}
38		#endregion
39
40		#region ClearBackgroundInsideLoop (Static)
41		/// <summary>
42		/// ClearBackgroundInsideLoop
43		/// </summary>
44		[Test]
45		public static void ClearBackgroundInsideLoop()
46		{
47			Application.Start(delegate
48			{
49				Application.BackgroundColor = Color.Green;
50			});
51		}
52		#endregion
53
54		#region TestSolidColors (Static)
55		/// <summary>
56		/// Test solid colors
57		/// </summary>
58		[Test]
59		public static void TestSolidColors()
60		{
61			Application.Start(delegate
62			{
63				if (Time.EverySecond)
64				{
65					Application.BackgroundColor = Color.NextSolidColor;
66				}
67			});
68		}
69		#endregion
70
71		#region InitDevice (LongRunning)
72		/// <summary>
73		/// Initialize device, simply tests if we can initialize a graphics module.
74		/// </summary>
75		[Test, Category("Visual")]
76		public static void InitDevice()
77		{
78			Application.Start(delegate
79			{
80				// Make sure that graphic is initialized
81				// And immediately quit the app again
82				Application.Quit();
83			});
84		}
85		#endregion
86	}
87}