public virtual void TrimNullTrailingTest() { String expected = ""; String actual = SvgTextUtil.TrimTrailingWhitespace(null); NUnit.Framework.Assert.AreEqual(expected, actual); }
public virtual void ProcessWhiteSpaceBreakLine() { //Create tree TextSvgBranchRenderer root = new TextSvgBranchRenderer(); TextLeafSvgNodeRenderer textBefore = new TextLeafSvgNodeRenderer(); textBefore.SetAttribute(SvgConstants.Attributes.TEXT_CONTENT, "\n" + " text\n" + " " ); root.AddChild(textBefore); TextSvgBranchRenderer span = new TextSvgBranchRenderer(); TextLeafSvgNodeRenderer textInSpan = new TextLeafSvgNodeRenderer(); textInSpan.SetAttribute(SvgConstants.Attributes.TEXT_CONTENT, "\n" + " tspan text\n" + " " ); span.AddChild(textInSpan); root.AddChild(span); TextLeafSvgNodeRenderer textAfter = new TextLeafSvgNodeRenderer(); textAfter.SetAttribute(SvgConstants.Attributes.TEXT_CONTENT, "\n" + " after text\n" + " " ); root.AddChild(textAfter); //Run SvgTextUtil.ProcessWhiteSpace(root, true); root.GetChildren()[0].GetAttribute(SvgConstants.Attributes.TEXT_CONTENT); //Create result array String[] actual = new String[] { root.GetChildren()[0].GetAttribute(SvgConstants.Attributes.TEXT_CONTENT), ((TextSvgBranchRenderer)root.GetChildren()[1]).GetChildren()[0].GetAttribute(SvgConstants.Attributes.TEXT_CONTENT ), root.GetChildren()[2].GetAttribute(SvgConstants.Attributes.TEXT_CONTENT) }; //Create expected String[] expected = new String[] { "text", " tspan text", " after text" }; NUnit.Framework.Assert.AreEqual(expected, actual); }
public virtual void TrimLeadingOnlyWhitespaceTest() { String toTrim = "\t\t\t \t\t\t"; String actual = SvgTextUtil.TrimLeadingWhitespace(toTrim); String expected = ""; NUnit.Framework.Assert.AreEqual(expected, actual); }
public virtual void TrimLeadingNonBreakingSpaceTest() { String toTrim = "\u00A0to Test "; String actual = SvgTextUtil.TrimLeadingWhitespace(toTrim); String expected = "\u00A0to Test "; NUnit.Framework.Assert.AreEqual(expected, actual); }
public virtual void TrimTrailingOfStringWithLength1Test() { String toTrim = "A"; String actual = SvgTextUtil.TrimTrailingWhitespace(toTrim); String expected = "A"; NUnit.Framework.Assert.AreEqual(expected, actual); }
public virtual void TrimTrailingLineBreakTest() { String toTrim = " to trim \n"; String actual = SvgTextUtil.TrimTrailingWhitespace(toTrim); String expected = " to trim \n"; NUnit.Framework.Assert.AreEqual(expected, actual); }
public virtual void ProcessFontSizeInPT() { float expected = 24; // Create a renderer TextSvgBranchRenderer root = new TextSvgBranchRenderer(); root.SetAttribute(SvgConstants.Attributes.FONT_SIZE, "24pt"); //Run float actual = SvgTextUtil.ResolveFontSize(root, 10); NUnit.Framework.Assert.AreEqual(expected, actual, EPS); }
public virtual void ProcessKeywordedFontSize() { float expected = 24; // Create a renderer TextSvgBranchRenderer root = new TextSvgBranchRenderer(); root.SetAttribute(SvgConstants.Attributes.FONT_SIZE, "xx-large"); //Run // Parent's font-size doesn't impact the result in this test float actual = SvgTextUtil.ResolveFontSize(root, 10); NUnit.Framework.Assert.AreEqual(expected, actual, EPS); }
public virtual void TestFilterReferenceValueNumberString() { NUnit.Framework.Assert.AreEqual("16554245", SvgTextUtil.FilterReferenceValue("16554245")); }
public virtual void TestFilterReferenceValueFilteredValues() { NUnit.Framework.Assert.AreEqual("", SvgTextUtil.FilterReferenceValue("))url(####)")); }
public virtual void TestFilterReferenceValueEmptyString() { NUnit.Framework.Assert.AreEqual("", SvgTextUtil.FilterReferenceValue("")); }
public virtual void TestFilterReferenceValueNoFilter() { NUnit.Framework.Assert.AreEqual("circle", SvgTextUtil.FilterReferenceValue("circle")); }
public virtual void TestFilterReferenceValueSimpleReference() { NUnit.Framework.Assert.AreEqual("figure11", SvgTextUtil.FilterReferenceValue("#figure11")); }
public virtual void TestFilterReferenceValueMarkerFullEntry() { NUnit.Framework.Assert.AreEqual("marker-end: MarkerArrow;", SvgTextUtil.FilterReferenceValue("marker-end: url(#MarkerArrow);" )); }
public virtual void TestFilterReferenceValueMarkerReference() { NUnit.Framework.Assert.AreEqual("MarkerCircle", SvgTextUtil.FilterReferenceValue("url(#MarkerCircle)")); }