/Rendering/BasicTests/GraphicsTests.cs
C# | 87 lines | 68 code | 5 blank | 14 comment | 2 complexity | 5d1fde6fcd9a49be39396d4ed770943a MD5 | raw file
Possible License(s): Apache-2.0
- using Delta.Engine;
- using Delta.Utilities.Datatypes;
- using NUnit.Framework;
-
- namespace Delta.Rendering.BasicTests
- {
- internal class GraphicsTests
- {
- #region ClearColor (Static)
- /// <summary>
- /// Clear color: Simply test if the clear color is set properly.
- /// </summary>
- [Test]
- public static void ClearColor()
- {
- Color[] colors =
- {
- Color.Red,
- Color.Green,
- Color.Blue,
- Color.Yellow,
- Color.White,
- Color.Grey,
- Color.Black
- };
-
- int currentColorIndex = 0;
- Application.Start(delegate
- {
- if (Time.EverySecond)
- {
- currentColorIndex++;
- currentColorIndex %= colors.Length;
- Application.BackgroundColor = colors[currentColorIndex];
- }
- });
- }
- #endregion
-
- #region ClearBackgroundInsideLoop (Static)
- /// <summary>
- /// ClearBackgroundInsideLoop
- /// </summary>
- [Test]
- public static void ClearBackgroundInsideLoop()
- {
- Application.Start(delegate
- {
- Application.BackgroundColor = Color.Green;
- });
- }
- #endregion
-
- #region TestSolidColors (Static)
- /// <summary>
- /// Test solid colors
- /// </summary>
- [Test]
- public static void TestSolidColors()
- {
- Application.Start(delegate
- {
- if (Time.EverySecond)
- {
- Application.BackgroundColor = Color.NextSolidColor;
- }
- });
- }
- #endregion
-
- #region InitDevice (LongRunning)
- /// <summary>
- /// Initialize device, simply tests if we can initialize a graphics module.
- /// </summary>
- [Test, Category("Visual")]
- public static void InitDevice()
- {
- Application.Start(delegate
- {
- // Make sure that graphic is initialized
- // And immediately quit the app again
- Application.Quit();
- });
- }
- #endregion
- }
- }