public void GetBoundingRect_WithEmptyGlyphs() { CGFont cgFont = CGFont.CreateWithFontName("Arial"); ushort [] glyphs = new ushort [] {}; CTFont ctFont = new CTFont(cgFont, 14, new CTFontDescriptor("Arial", 14)); NSFont nsFont = NSFont.FromCTFont(ctFont); Assert.Throws <ArgumentException> (() => nsFont.GetBoundingRects(glyphs)); Assert.Throws <ArgumentException> (() => nsFont.GetAdvancements(glyphs)); }
public void GetBoundingRect_WithEmptyGlyphs() { if (!PlatformHelper.CheckSystemVersion(10, 13)) { return; } CGFont cgFont = CGFont.CreateWithFontName("Arial"); ushort [] glyphs = new ushort [] {}; CTFont ctFont = new CTFont(cgFont, 14, new CTFontDescriptor("Arial", 14)); NSFont nsFont = NSFont.FromCTFont(ctFont); Assert.Throws <ArgumentException> (() => nsFont.GetBoundingRects(glyphs)); Assert.Throws <ArgumentException> (() => nsFont.GetAdvancements(glyphs)); }
public void GetBoundingRect_SmokeTest() { CGFont cgFont = CGFont.CreateWithFontName("Arial"); ushort [] glyphs = new ushort [5]; for (int i = 0; i < 5; ++i) { glyphs[i] = cgFont.GetGlyphWithGlyphName("Hello"[i].ToString()); } CTFont ctFont = new CTFont(cgFont, 14, new CTFontDescriptor("Arial", 14)); NSFont nsFont = NSFont.FromCTFont(ctFont); var bounding = nsFont.GetBoundingRects(glyphs); var advancement = nsFont.GetAdvancements(glyphs); Assert.AreEqual(5, bounding.Length); Assert.AreEqual(5, advancement.Length); }