using Glass.Typesetting; using UnitTestSharp; namespace Glass.UnitTests.Typesetting { public class MeasuredWordTests : TestFixture { public static readonly MeasuredWord Sample = new MeasuredWord( new LineBreak(9, isMandatory: true, trailingSpaces: 2), contentWidth: 30, leadingKerning: -2, endKerning: -1); public class CtorTests : TestFixture { public void KeepsEveryField() { CheckEqual(new object[] { 9, true, 30, (short)-2, (short)-1 }, new object[] { Sample.Break.Position, Sample.Break.IsMandatory, Sample.ContentWidth, Sample.LeadingKerning, Sample.EndKerning, }); } } public class LayoutTests : TestFixture { public void TakesSixteenBytes() { CheckEqual(16, System.Runtime.InteropServices.Marshal.SizeOf()); } } public class ContentEndTests : TestFixture { public void IsTheBreaks() { CheckEqual(7, Sample.ContentEnd); } } public class EndTests : TestFixture { public void IsTheBreaksPosition() { CheckEqual(9, Sample.End); } } public class IsMandatoryTests : TestFixture { public void IsWhetherTheBreakIs() { CheckTrue(Sample.IsMandatory); CheckFalse(new MeasuredWord(new LineBreak(9, isMandatory: false), contentWidth: 30, leadingKerning: -2, endKerning: -1).IsMandatory); } } } }