public void BackgroundColor() { var sa = new CTStringAttributes(); Assert.DoesNotThrow(() => { sa.BackgroundColor = TestRuntime.GetCGColor(UIColor.Blue); }, "#0"); Assert.DoesNotThrow(() => { var x = sa.BackgroundColor; }, "#1"); }
public void EnumerateCaretOffsets() { if (!TestRuntime.CheckXcodeVersion(7, 0)) { Assert.Ignore("Requires iOS9+ or macOS 10.11+"); } var sa = new CTStringAttributes(); sa.ForegroundColor = TestRuntime.GetCGColor(UIColor.Blue); sa.Font = new CTFont("Georgia-BoldItalic", 24); sa.UnderlineStyle = CTUnderlineStyle.Double; // It does not seem to do anything sa.UnderlineColor = TestRuntime.GetCGColor(UIColor.Blue); sa.UnderlineStyleModifiers = CTUnderlineStyleModifiers.PatternDashDotDot; var attributedString = new NSAttributedString("Hello world.\nWoohooo!\nThere", sa); var line = new CTLine(attributedString); bool executed = false; line.EnumerateCaretOffsets((double o, nint charIndex, bool leadingEdge, ref bool stop) => { executed = true; }); Assert.IsTrue(executed); }
public void Attributes() { red = TestRuntime.GetCGColor(UIColor.Red); yellow = TestRuntime.GetCGColor(UIColor.Yellow); var j = new NSMutableAttributedString("Hello", new CTStringAttributes() { ForegroundColor = red }); j.Append(new NSMutableAttributedString("12345", new CTStringAttributes() { ForegroundColor = yellow })); j.EnumerateAttributes(new NSRange(0, 10), NSAttributedStringEnumeration.None, cb); Assert.True(t1); Assert.True(t2); Assert.False(failEnum); Assert.True(tFont1); Assert.True(tFont2); }
public void NullableProperties() { var sl = new CAShapeLayer(); Assert.NotNull(sl.FillColor, "FillColor"); sl.FillColor = null; Assert.Null(sl.Path, "Path"); sl.Path = null; Assert.Null(sl.LineDashPattern, "LineDashPattern"); sl.LineDashPattern = null; Assert.Null(sl.StrokeColor, "StrokeColor"); sl.StrokeColor = null; sl.FillColor = TestRuntime.GetCGColor(UIColor.Black); Assert.NotNull(sl.FillColor, "FillColor"); sl.Path = new CGPath(); Assert.NotNull(sl.Path, "Path"); sl.LineDashPattern = new [] { new NSNumber(5), new NSNumber(10) }; Assert.NotNull(sl.LineDashPattern, "LineDashPattern"); sl.StrokeColor = TestRuntime.GetCGColor(UIColor.White); Assert.NotNull(sl.StrokeColor, "StrokeColor"); }