Inheritance Hierarchy
DeltaEngine.Tests.Content MaterialTests
Namespace: DeltaEngine.Tests.Content
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The MaterialTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MaterialTests | Initializes a new instance of the MaterialTests class |
Methods
Examples
[Test] public void TestPixelBasedRenderSize() { material.RenderSizeMode = RenderSizeMode.PixelBased; Assert.AreEqual(0.3125f, material.MaterialRenderSize.Width); Assert.AreEqual(0.3125f, material.MaterialRenderSize.Height); }
[Test] public void Test800X480RenderSize() { material.RenderSizeMode = RenderSizeMode.SizeFor800X480; Assert.AreEqual(0.125f, material.MaterialRenderSize.Width); Assert.AreEqual(0.125f, material.MaterialRenderSize.Height); }
[Test] public void Test1024X720RenderSize() { material.RenderSizeMode = RenderSizeMode.SizeFor1024X768; Assert.AreEqual(0.09765625f, material.MaterialRenderSize.Width); Assert.AreEqual(0.09765625f, material.MaterialRenderSize.Height); }
[Test] public void Test1280X720RenderSize() { material.RenderSizeMode = RenderSizeMode.SizeFor1280X720; Assert.AreEqual(0.078125f, material.MaterialRenderSize.Width); Assert.AreEqual(0.078125f, material.MaterialRenderSize.Height); }
[Test] public void Test1920X1080RenderSize() { material.RenderSizeMode = RenderSizeMode.SizeFor1920X1080; Assert.AreEqual(0.0520833321f, material.MaterialRenderSize.Width); Assert.AreEqual(0.0520833321f, material.MaterialRenderSize.Height); }
[Test] public void TestSettingsBasedRenderSize() { material.RenderSizeMode = RenderSizeMode.SizeForSettingsResolution; AssertMaterialRenderSize(material, StackTraceExtensions.StartedFromNCrunchOrNunitConsole ? 0.3125f : ExceptionExtensions.IsDebugMode ? 0.15625f : 0.078125f); }
[Test] public void CompareMaterials() { var material2 = new Material(material.Shader, material.DiffuseMap); var shader3 = ContentLoader.Create<FakeShader>(new ShaderCreationData(ShaderFlags.Colored)); var image3 = ContentLoader.Create<FakeImage>(new ImageCreationData(new Size(10))); var material3 = new Material(shader3, image3); Assert.AreEqual(material, material2); Assert.AreNotEqual(material2, material3); Assert.IsTrue(material2.Equals(material)); Assert.IsFalse(material2.Equals(material3)); Assert.AreEqual(material.GetHashCode(), material2.GetHashCode()); Assert.IsTrue(material.Equals((object)material2)); }
See Also