using UnitTestSharp; using Azimuth; using Annulus; namespace Glass.UnitTests { public class WindowMaterialTests : TestFixture { public static readonly WindowMaterial Framed = new WindowMaterial { Background = new Material { BorderSize = new Rect.BorderSize(10) }, Content = new Material { BorderSize = new Rect.BorderSize(2) }, }; public class ContentSizeForTests : TestFixture { public void NoMaterials_TakesOffJustTheTitleBar() { CheckEqual(new Vector(200, 126), new WindowMaterial().ContentSizeFor( new Vector(200, 150), titleBarHeight: 24)); } public void WithMaterials_TakesOffTheFrameTheTitleBarAndTheContentsBorder() { CheckEqual(new Vector(176, 102), Framed.ContentSizeFor(new Vector(200, 150), titleBarHeight: 24)); } public void TitleBarTallerThanTheRoomLeft_LeavesNoContent() { CheckEqual(new Vector(40, 0), new WindowMaterial().ContentSizeFor( new Vector(40, 10), titleBarHeight: 24)); } } public class BoundsSizeForTests : TestFixture { public void NoMaterials_AddsJustTheTitleBar() { CheckEqual(new Vector(200, 150), new WindowMaterial().BoundsSizeFor( new Vector(200, 126), titleBarHeight: 24)); } public void WithMaterials_InvertsContentSizeFor() { CheckEqual(new Vector(200, 150), Framed.BoundsSizeFor(new Vector(176, 102), titleBarHeight: 24)); } } } }