Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Graphics.Tests DeviceTests
Namespace: DeltaEngine.Graphics.Tests
Assembly: DeltaEngine.Graphics.Tests (in DeltaEngine.Graphics.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The DeviceTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DeviceTests | Initializes a new instance of the DeviceTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
DrawRedBackground | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
OnSet3DModeActionIsCalledWhenSetting3DMode | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
SetFullscreenCallsDevicesOnFullscreenChanged | ||
SetFullscreenModeToJustWindowWithoutDeviceAndShowRedBackground | ||
SizeChanged | ||
ToggleFullscreenModeWithSpaceKey |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test, ApproveFirstFrameScreenshot] public void DrawRedBackground() { Resolve<Window>().BackgroundColor = Color.Red; }
[Test] public void SizeChanged() { Resolve<Window>().ViewportPixelSize = new Size(200, 100); Assert.AreEqual(new Size(200, 100), Resolve<Window>().ViewportPixelSize); }
[Test, ApproveFirstFrameScreenshot] public void SetFullscreenModeToJustWindowWithoutDeviceAndShowRedBackground() { var settings = Resolve<Settings>(); settings.StartInFullscreen = true; // does not mean we really go fullscreen without device! Resolve<Window>().BackgroundColor = Color.Red; settings.StartInFullscreen = false; }
[Test] public void SetFullscreenCallsDevicesOnFullscreenChanged() { var device = Resolve<Device>() as MockDevice; if (device == null) return; //ncrunch: no coverage Assert.IsFalse(device.OnFullscreenChangedCalled); var window = Resolve<Window>(); window.SetFullscreen(Size.One); Assert.IsTrue(device.OnFullscreenChangedCalled); }
[Test] public void ToggleFullscreenModeWithSpaceKey() { var window = Resolve<Window>(); window.BackgroundColor = Color.Red; bool fullscreen = false; var screenSize = GetScreenSize(); //ncrunch: no coverage start new Command(() => { if (fullscreen) window.SetWindowed(); else window.SetFullscreen(screenSize); fullscreen = !fullscreen; }).Add(new KeyTrigger(Key.Space)); //ncrunch: no coverage end }
[Test] public void OnSet3DModeActionIsCalledWhenSetting3DMode() { var device = Resolve<Device>() as MockDevice; if (device == null) return; //ncrunch: no coverage Assert.IsFalse(device.OnSet3DModeCalled); device.Set3DMode(); Assert.IsTrue(device.OnSet3DModeCalled); }
See Also