using System; using Azimuth; using Blacklight.Core.Drawables; namespace Glass.Blacklight.UnitTests { public class TintSpaceAdapterTests : UnitTestSharp.TestFixture { public void SameCount() { CheckEqual((int)FillSpace.Count, (int)Glass.TintSpace.Count); } public void ToBlacklightMethodReturnsCorrectValue() { for (int i = 0; i < (int)Glass.TintSpace.Count; ++i) { string actual = ((Glass.TintSpace)i).ToBlacklight().ToString(); string expected = ((FillSpace)i).ToString(); CheckEqual(expected, actual); } } public void AnUnknownSpace_Throws() { CheckThrow(typeof(InvalidOperationException)); ((Glass.TintSpace)99).ToBlacklight(); } public class TintTransformForTests : UnitTestSharp.TestFixture { private static readonly AffineMatrix Moved = AffineMatrix.BuildFromTranslation(new Vector(3, 4)); public void Screen_ScalesTheWholeTransform() { AffineMatrix scaled = TintSpaceAdapter.TintTransformFor(Moved, FillSpace.Screen, uiScale: 2); CheckEqual(new AffineMatrix(0, new Vector(6, 8), new Vector(2, 2)), scaled); } public void Screen_AtAScaleOfOne_LeavesItAlone() { CheckEqual(Moved, TintSpaceAdapter.TintTransformFor(Moved, FillSpace.Screen, uiScale: 1)); } public void Model_LeavesItAloneWhateverTheScale() { CheckEqual(Moved, TintSpaceAdapter.TintTransformFor(Moved, FillSpace.Model, uiScale: 2)); } } } }