From: Jeff R. <jef...@us...> - 2005-11-20 20:42:37
|
Update of /cvsroot/svgdomcsharp/SharpVectorGraphics/src/SharpVectorUnitTests/SharpVectors/Dom/Svg/Basic types In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1906/src/SharpVectorUnitTests/SharpVectors/Dom/Svg/Basic types Modified Files: SvgAngleTests.cs SvgElementTests.cs SvgLengthListTests.cs SvgLengthTests.cs SvgListTests.cs SvgMatrixTests.cs SvgNumberListTests.cs SvgNumberTests.cs SvgPointListTests.cs SvgPointTests.cs SvgStringListTests.cs SvgTransformListTests.cs Log Message: Project wide fixes to eliminate obsolete NUnit calls, minor test related fixes Index: SvgElementTests.cs =================================================================== RCS file: /cvsroot/svgdomcsharp/SharpVectorGraphics/src/SharpVectorUnitTests/SharpVectors/Dom/Svg/Basic types/SvgElementTests.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SvgElementTests.cs 28 Jun 2003 20:37:31 -0000 1.3 +++ SvgElementTests.cs 20 Nov 2005 20:42:23 -0000 1.4 @@ -24,7 +24,7 @@ public override void TestTypeFromDocument() { XmlElement elm = Util.GetXmlElement("<" + localName + " xmlns='http://www.w3.org/2000/svg' />", "", localName); - Assertion.AssertEquals(elmType, elm.GetType()); + Assert.AreEqual(elmType, elm.GetType()); } [Test] @@ -34,70 +34,71 @@ SvgDocument doc = new SvgDocument(wnd); XmlElement elm = doc.CreateElement("", localName, "http://www.w3.org/2000/svg"); - Assertion.AssertEquals(elmType, elm.GetType()); + Assert.AreEqual(elmType, elm.GetType()); } [Test] public void TestId() { SvgElement elm = Util.GetXmlElement("<" + localName + " xmlns='http://www.w3.org/2000/svg' id='kalle' />", "", localName) as SvgElement; - Assertion.AssertEquals("kalle", elm.Id); + Assert.AreEqual("kalle", elm.Id); } [Test] public void TestOwnerDocument() { SvgElement elm = Util.GetXmlElement("<" + localName + " xmlns='http://www.w3.org/2000/svg' />", "", localName) as SvgElement; - Assertion.Assert(elm.OwnerDocument is SvgDocument); + ISvgDocument doc = elm.OwnerDocument as ISvgDocument; + Assert.IsNotNull(doc); } [Test] public void TestOwnerSvgElement() { SvgElement elm = Util.GetXmlElement("<svg id='svgElm' xmlns='http://www.w3.org/2000/svg'><" + localName + " /></svg>", "", localName) as SvgElement; - Assertion.AssertEquals("2", elm.OwnerDocument.SelectSingleNode("//*[@id='svgElm']"), elm.OwnerSvgElement); + Assert.AreEqual(elm.OwnerDocument.SelectSingleNode("//*[@id='svgElm']"), elm.OwnerSvgElement, "2"); } [Test] public void TestViewportElement() { SvgElement elm = Util.GetXmlElement("<svg id='svgElm' xmlns='http://www.w3.org/2000/svg'><" + localName + " /></svg>", "", localName) as SvgElement; - Assertion.AssertEquals(elm.OwnerDocument.SelectSingleNode("//*[@id='svgElm']"), elm.ViewportElement); + Assert.AreEqual(elm.OwnerDocument.SelectSingleNode("//*[@id='svgElm']"), elm.ViewportElement); } [Test] public void TestXmlLang() { SvgElement elm = Util.GetXmlElement("<" + localName + " xmlns='http://www.w3.org/2000/svg' xml:lang='sv-SE' />", "", localName) as SvgElement; - Assertion.AssertEquals("sv-SE", elm.XmlLang); + Assert.AreEqual("sv-SE", elm.XmlLang); } [Test] public void TestInheritedXmlLang() { SvgElement elm = Util.GetXmlElement("<svg id='svgElm' xmlns='http://www.w3.org/2000/svg' xml:lang='sv-SE'><" + localName + " /></svg>", "", localName) as SvgElement; - Assertion.AssertEquals("sv-SE", elm.XmlLang); + Assert.AreEqual("sv-SE", elm.XmlLang); } [Test] public void TestXmlSpace() { SvgElement elm = Util.GetXmlElement("<" + localName + " xmlns='http://www.w3.org/2000/svg' xml:space='default' />", "", localName) as SvgElement; - Assertion.AssertEquals("default", elm.XmlSpace); + Assert.AreEqual("default", elm.XmlSpace); } [Test] public void TestDefaultXmlSpace() { SvgElement elm = Util.GetXmlElement("<" + localName + " xmlns='http://www.w3.org/2000/svg' />", "", localName) as SvgElement; - Assertion.AssertEquals("default", elm.XmlSpace); + Assert.AreEqual("default", elm.XmlSpace); } [Test] public void TestInheritedXmlSpace() { SvgElement elm = Util.GetXmlElement("<svg id='svgElm' xmlns='http://www.w3.org/2000/svg' xml:space='preserve'><" + localName + " /></svg>", "", localName) as SvgElement; - Assertion.AssertEquals("preserve", elm.XmlSpace); + Assert.AreEqual("preserve", elm.XmlSpace); } } Index: SvgMatrixTests.cs =================================================================== RCS file: /cvsroot/svgdomcsharp/SharpVectorGraphics/src/SharpVectorUnitTests/SharpVectors/Dom/Svg/Basic types/SvgMatrixTests.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SvgMatrixTests.cs 3 Aug 2003 18:22:59 -0000 1.3 +++ SvgMatrixTests.cs 20 Nov 2005 20:42:23 -0000 1.4 @@ -1 +1 @@ -using System; using NUnit.Framework; using SharpVectors.Dom.Svg; namespace SharpVectors.UnitTests.Svg.BasicTypesAndInterfaces { // The resulting test values were generated using MuPad Light // NOTE: The original implementation of SvgMatrix returned doubles when accessing properties. To stay consistent with the SVG specification, these were switched to floats. The original double values used in the assertions have been left "just in case". They are being converted to floats using the trailing "f". [TestFixture] public class SvgMatrixTests { [Test] public void TestConstructor() { ISvgMatrix m = new SvgMatrix(); Assertion.AssertEquals(1, m.A); Assertion.AssertEquals(0, m.B); Assertion.AssertEquals(0, m.C); Assertion.AssertEquals(1, m.D); Assertion.AssertEquals(0, m.E); Assertion.AssertEquals(0, m.F); } [Test] public void TestConstructor2() { ISvgMatrix m = new SvgMatrix(1, 2, 3, 4, 5, 6); Assertion.AssertEquals(1, m.A); Assertion.AssertEquals(2, m.B); Assertion.AssertEquals(3, m.C); Assertion.AssertEquals(4, m.D); Assertion.AssertEquals(5, m.E); Assertion.AssertEquals(6, m.F); } [Test] public void TestMultiply() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = new SvgMatrix(7, 8, 9, 10, 11, 12); ISvgMatrix m3 = m1.Multiply(m2); Assertion.AssertEquals(31, m3.A); Assertion.AssertEquals(46, m3.B); Assertion.AssertEquals(39, m3.C); Assertion.AssertEquals(58, m3.D); Assertion.AssertEquals(52, m3.E); Assertion.AssertEquals(76, m3.F); } [Test] public void TestInverse() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.Inverse(); Assertion.AssertEquals(-2, m2.A); Assertion.AssertEquals(1, m2.B); Assertion.AssertEquals(1.5, m2.C); Assertion.AssertEquals(-0.5, m2.D); Assertion.AssertEquals(1, m2.E); Assertion.AssertEquals(-2, m2.F); } [Test] [ExpectedException(typeof(SvgException))] public void TestNoInverse() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 6, 0, 0); ISvgMatrix m2 = m1.Inverse(); } [Test] public void TestTranslate() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.Translate(10,20); Assertion.AssertEquals(1, m2.A); Assertion.AssertEquals(2, m2.B); Assertion.AssertEquals(3, m2.C); Assertion.AssertEquals(4, m2.D); Assertion.AssertEquals(75, m2.E); Assertion.AssertEquals(106, m2.F); } [Test] public void TestScale() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.Scale(10); Assertion.AssertEquals(10, m2.A); Assertion.AssertEquals(20, m2.B); Assertion.AssertEquals(30, m2.C); Assertion.AssertEquals(40, m2.D); Assertion.AssertEquals(5, m2.E); Assertion.AssertEquals(6, m2.F); } [Test] public void TestScaleNonUniform() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.ScaleNonUniform(10,20); Assertion.AssertEquals(10, m2.A); Assertion.AssertEquals(20, m2.B); Assertion.AssertEquals(60, m2.C); Assertion.AssertEquals(80, m2.D); Assertion.AssertEquals(5, m2.E); Assertion.AssertEquals(6, m2.F); } [Test] public void TestRotate() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.Rotate(30); Assertion.AssertEquals(2.36602540378444f, m2.A); Assertion.AssertEquals(3.73205080756888f, m2.B); Assertion.AssertEquals(2.09807621135332f, m2.C); Assertion.AssertEquals(2.46410161513775f, m2.D); Assertion.AssertEquals(5, m2.E); Assertion.AssertEquals(6, m2.F); } [Test] public void TestRotateFromVector() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.RotateFromVector(1.73205080756888f, 1); Assertion.AssertEquals(2.36602540378444f, m2.A); Assertion.AssertEquals(3.73205080756888f, m2.B); Assertion.AssertEquals(2.09807621135332f, m2.C); //D property incorrect when using doubles, probably due to rounding //Assertion.AssertEquals(2.46410161513775, m2.D); Assertion.AssertEquals(2.46410161513776f, m2.D); Assertion.AssertEquals(5, m2.E); Assertion.AssertEquals(6, m2.F); } [Test] [ExpectedException(typeof(SvgException))] public void TestRotateFromVectorZeroX() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 6, 0, 0); ISvgMatrix m2 = m1.RotateFromVector(0, 1); } [Test] [ExpectedException(typeof(SvgException))] public void TestRotateFromVectorZeroY() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 6, 0, 0); ISvgMatrix m2 = m1.RotateFromVector(1, 0); } [Test] public void TestFlipX() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.FlipX(); Assertion.AssertEquals(-1, m2.A); Assertion.AssertEquals(-2, m2.B); Assertion.AssertEquals(3, m2.C); Assertion.AssertEquals(4, m2.D); Assertion.AssertEquals(5, m2.E); Assertion.AssertEquals(6, m2.F); } [Test] public void TestFlipY() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.FlipY(); Assertion.AssertEquals(1, m2.A); Assertion.AssertEquals(2, m2.B); Assertion.AssertEquals(-3, m2.C); Assertion.AssertEquals(-4, m2.D); Assertion.AssertEquals(5, m2.E); Assertion.AssertEquals(6, m2.F); } [Test] public void TestSkewX() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.SkewX(30); Assertion.AssertEquals(1, m2.A); Assertion.AssertEquals(2, m2.B); Assertion.AssertEquals(3.57735026918963f, m2.C); Assertion.AssertEquals(5.15470053837925f, m2.D); Assertion.AssertEquals(5, m2.E); Assertion.AssertEquals(6, m2.F); } [Test] public void TestSkewY() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.SkewY(30); Assertion.AssertEquals(2.73205080756888f, m2.A); Assertion.AssertEquals(4.3094010767585f, m2.B); Assertion.AssertEquals(3, m2.C); Assertion.AssertEquals(4, m2.D); Assertion.AssertEquals(5, m2.E); Assertion.AssertEquals(6, m2.F); } [Test] public void TestMultiply2() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = new SvgMatrix(7, 8, 9, 10, 11, 12); SvgMatrix m3 = (SvgMatrix) m1 * (SvgMatrix) m2; Assertion.AssertEquals(31, m3.A); Assertion.AssertEquals(46, m3.B); Assertion.AssertEquals(39, m3.C); Assertion.AssertEquals(58, m3.D); Assertion.AssertEquals(52, m3.E); Assertion.AssertEquals(76, m3.F); } } } \ No newline at end of file +using System; using NUnit.Framework; using SharpVectors.Dom.Svg; namespace SharpVectors.UnitTests.Svg.BasicTypesAndInterfaces { // The resulting test values were generated using MuPad Light // NOTE: The original implementation of SvgMatrix returned doubles when accessing properties. To stay consistent with the SVG specification, these were switched to floats. The original double values used in the assertions have been left "just in case". They are being converted to floats using the trailing "f". [TestFixture] public class SvgMatrixTests { [Test] public void TestConstructor() { ISvgMatrix m = new SvgMatrix(); Assert.AreEqual(1, m.A); Assert.AreEqual(0, m.B); Assert.AreEqual(0, m.C); Assert.AreEqual(1, m.D); Assert.AreEqual(0, m.E); Assert.AreEqual(0, m.F); } [Test] public void TestConstructor2() { ISvgMatrix m = new SvgMatrix(1, 2, 3, 4, 5, 6); Assert.AreEqual(1, m.A); Assert.AreEqual(2, m.B); Assert.AreEqual(3, m.C); Assert.AreEqual(4, m.D); Assert.AreEqual(5, m.E); Assert.AreEqual(6, m.F); } [Test] public void TestMultiply() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = new SvgMatrix(7, 8, 9, 10, 11, 12); ISvgMatrix m3 = m1.Multiply(m2); Assert.AreEqual(31, m3.A); Assert.AreEqual(46, m3.B); Assert.AreEqual(39, m3.C); Assert.AreEqual(58, m3.D); Assert.AreEqual(52, m3.E); Assert.AreEqual(76, m3.F); } [Test] public void TestInverse() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.Inverse(); Assert.AreEqual(-2, m2.A); Assert.AreEqual(1, m2.B); Assert.AreEqual(1.5, m2.C); Assert.AreEqual(-0.5, m2.D); Assert.AreEqual(1, m2.E); Assert.AreEqual(-2, m2.F); } [Test] [ExpectedException(typeof(SvgException))] public void TestNoInverse() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 6, 0, 0); ISvgMatrix m2 = m1.Inverse(); } [Test] public void TestTranslate() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.Translate(10,20); Assert.AreEqual(1, m2.A); Assert.AreEqual(2, m2.B); Assert.AreEqual(3, m2.C); Assert.AreEqual(4, m2.D); Assert.AreEqual(75, m2.E); Assert.AreEqual(106, m2.F); } [Test] public void TestScale() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.Scale(10); Assert.AreEqual(10, m2.A); Assert.AreEqual(20, m2.B); Assert.AreEqual(30, m2.C); Assert.AreEqual(40, m2.D); Assert.AreEqual(5, m2.E); Assert.AreEqual(6, m2.F); } [Test] public void TestScaleNonUniform() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.ScaleNonUniform(10,20); Assert.AreEqual(10, m2.A); Assert.AreEqual(20, m2.B); Assert.AreEqual(60, m2.C); Assert.AreEqual(80, m2.D); Assert.AreEqual(5, m2.E); Assert.AreEqual(6, m2.F); } [Test] public void TestRotate() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.Rotate(30); Assert.AreEqual(2.36602540378444f, m2.A); Assert.AreEqual(3.73205080756888f, m2.B); Assert.AreEqual(2.09807621135332f, m2.C); Assert.AreEqual(2.46410161513775f, m2.D); Assert.AreEqual(5, m2.E); Assert.AreEqual(6, m2.F); } [Test] public void TestRotateFromVector() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.RotateFromVector(1.73205080756888f, 1); Assert.AreEqual(2.36602540378444f, m2.A); Assert.AreEqual(3.73205080756888f, m2.B); Assert.AreEqual(2.09807621135332f, m2.C); //D property incorrect when using doubles, probably due to rounding //Assert.AreEqual(2.46410161513775, m2.D); Assert.AreEqual(2.46410161513776f, m2.D); Assert.AreEqual(5, m2.E); Assert.AreEqual(6, m2.F); } [Test] [ExpectedException(typeof(SvgException))] public void TestRotateFromVectorZeroX() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 6, 0, 0); ISvgMatrix m2 = m1.RotateFromVector(0, 1); } [Test] [ExpectedException(typeof(SvgException))] public void TestRotateFromVectorZeroY() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 6, 0, 0); ISvgMatrix m2 = m1.RotateFromVector(1, 0); } [Test] public void TestFlipX() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.FlipX(); Assert.AreEqual(-1, m2.A); Assert.AreEqual(-2, m2.B); Assert.AreEqual(3, m2.C); Assert.AreEqual(4, m2.D); Assert.AreEqual(5, m2.E); Assert.AreEqual(6, m2.F); } [Test] public void TestFlipY() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.FlipY(); Assert.AreEqual(1, m2.A); Assert.AreEqual(2, m2.B); Assert.AreEqual(-3, m2.C); Assert.AreEqual(-4, m2.D); Assert.AreEqual(5, m2.E); Assert.AreEqual(6, m2.F); } [Test] public void TestSkewX() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.SkewX(30); Assert.AreEqual(1, m2.A); Assert.AreEqual(2, m2.B); Assert.AreEqual(3.57735026918963f, m2.C); Assert.AreEqual(5.15470053837925f, m2.D); Assert.AreEqual(5, m2.E); Assert.AreEqual(6, m2.F); } [Test] public void TestSkewY() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = m1.SkewY(30); Assert.AreEqual(2.73205080756888f, m2.A); Assert.AreEqual(4.3094010767585f, m2.B); Assert.AreEqual(3, m2.C); Assert.AreEqual(4, m2.D); Assert.AreEqual(5, m2.E); Assert.AreEqual(6, m2.F); } [Test] public void TestMultiply2() { ISvgMatrix m1 = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgMatrix m2 = new SvgMatrix(7, 8, 9, 10, 11, 12); SvgMatrix m3 = (SvgMatrix) m1 * (SvgMatrix) m2; Assert.AreEqual(31, m3.A); Assert.AreEqual(46, m3.B); Assert.AreEqual(39, m3.C); Assert.AreEqual(58, m3.D); Assert.AreEqual(52, m3.E); Assert.AreEqual(76, m3.F); } } } \ No newline at end of file Index: SvgLengthTests.cs =================================================================== RCS file: /cvsroot/svgdomcsharp/SharpVectorGraphics/src/SharpVectorUnitTests/SharpVectors/Dom/Svg/Basic types/SvgLengthTests.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SvgLengthTests.cs 27 May 2003 20:44:07 -0000 1.3 +++ SvgLengthTests.cs 20 Nov 2005 20:42:23 -0000 1.4 @@ -41,105 +41,105 @@ public void TestSettingValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10px"); - Assertion.AssertEquals(10, length.Value); - Assertion.AssertEquals(SvgLengthType.Px, length.UnitType); - Assertion.AssertEquals(10, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("10px", length.ValueAsString); + Assert.AreEqual(10, length.Value); + Assert.AreEqual(SvgLengthType.Px, length.UnitType); + Assert.AreEqual(10, length.ValueInSpecifiedUnits); + Assert.AreEqual("10px", length.ValueAsString); length.ValueAsString = "10cm"; - Assertion.AssertEquals(10, length.ValueInSpecifiedUnits); + Assert.AreEqual(10, length.ValueInSpecifiedUnits); length.Value = 200; double valueInCm = 200 / 96D * 2.54D; - Assertion.AssertEquals(200, length.Value); - Assertion.AssertEquals(valueInCm, length.ValueInSpecifiedUnits); - Assertion.AssertEquals(valueInCm.ToString(SvgNumber.Format)+"cm", length.ValueAsString); + Assert.AreEqual(200, length.Value); + Assert.AreEqual(valueInCm, length.ValueInSpecifiedUnits); + Assert.AreEqual(valueInCm.ToString(SvgNumber.Format)+"cm", length.ValueAsString); // change px value length.ValueAsString = "2px"; - Assertion.AssertEquals(2, length.Value); - Assertion.AssertEquals(2, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("2px", length.ValueAsString); + Assert.AreEqual(2, length.Value); + Assert.AreEqual(2, length.ValueInSpecifiedUnits); + Assert.AreEqual("2px", length.ValueAsString); // set to a CM value length.NewValueSpecifiedUnits(SvgLengthType.Cm, 23); - Assertion.AssertEquals(23, length.ValueInSpecifiedUnits); - Assertion.AssertEquals(23 / 2.54D * 96, length.Value); - Assertion.AssertEquals("23cm", length.ValueAsString); - Assertion.AssertEquals(SvgLengthType.Cm, length.UnitType); + Assert.AreEqual(23, length.ValueInSpecifiedUnits); + Assert.AreEqual(23 / 2.54D * 96, length.Value); + Assert.AreEqual("23cm", length.ValueAsString); + Assert.AreEqual(SvgLengthType.Cm, length.UnitType); length.ConvertToSpecifiedUnits(SvgLengthType.Mm); - Assertion.AssertEquals(230, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("230mm", length.ValueAsString); - Assertion.AssertEquals(SvgLengthType.Mm, length.UnitType); + Assert.AreEqual(230, length.ValueInSpecifiedUnits); + Assert.AreEqual("230mm", length.ValueAsString); + Assert.AreEqual(SvgLengthType.Mm, length.UnitType); } [Test] public void TestPxValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10px"); - Assertion.AssertEquals(10, length.Value); - Assertion.AssertEquals(SvgLengthType.Px, length.UnitType); - Assertion.AssertEquals(10, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("10px", length.ValueAsString); + Assert.AreEqual(10, length.Value); + Assert.AreEqual(SvgLengthType.Px, length.UnitType); + Assert.AreEqual(10, length.ValueInSpecifiedUnits); + Assert.AreEqual("10px", length.ValueAsString); } [Test] public void TestCmValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10cm"); - Assertion.AssertEquals(10 / 2.54 * 96, length.Value); - Assertion.AssertEquals(SvgLengthType.Cm, length.UnitType); - Assertion.AssertEquals(10, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("10cm", length.ValueAsString); + Assert.AreEqual(10 / 2.54 * 96, length.Value); + Assert.AreEqual(SvgLengthType.Cm, length.UnitType); + Assert.AreEqual(10, length.ValueInSpecifiedUnits); + Assert.AreEqual("10cm", length.ValueAsString); } [Test] public void TestMmValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10mm"); - Assertion.AssertEquals(10 / 25.4 * 96, length.Value); - Assertion.AssertEquals(SvgLengthType.Mm, length.UnitType); - Assertion.AssertEquals(10, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("10mm", length.ValueAsString); + Assert.AreEqual(10 / 25.4 * 96, length.Value); + Assert.AreEqual(SvgLengthType.Mm, length.UnitType); + Assert.AreEqual(10, length.ValueInSpecifiedUnits); + Assert.AreEqual("10mm", length.ValueAsString); } [Test] public void TestInValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10in"); - Assertion.AssertEquals(10 * 96, length.Value); - Assertion.AssertEquals(SvgLengthType.In, length.UnitType); - Assertion.AssertEquals(10, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("10in", length.ValueAsString); + Assert.AreEqual(10 * 96, length.Value); + Assert.AreEqual(SvgLengthType.In, length.UnitType); + Assert.AreEqual(10, length.ValueInSpecifiedUnits); + Assert.AreEqual("10in", length.ValueAsString); } [Test] public void TestPtValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10pt"); - Assertion.AssertEquals(10 / 72D * 96, length.Value); - Assertion.AssertEquals(SvgLengthType.Pt, length.UnitType); - Assertion.AssertEquals(10, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("10pt", length.ValueAsString); + Assert.AreEqual(10 / 72D * 96, length.Value); + Assert.AreEqual(SvgLengthType.Pt, length.UnitType); + Assert.AreEqual(10, length.ValueInSpecifiedUnits); + Assert.AreEqual("10pt", length.ValueAsString); } [Test] public void TestPcValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10pc"); - Assertion.AssertEquals(10 / 6D * 96, length.Value); - Assertion.AssertEquals(SvgLengthType.Pc, length.UnitType); - Assertion.AssertEquals(10, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("10pc", length.ValueAsString); + Assert.AreEqual(10 / 6D * 96, length.Value); + Assert.AreEqual(SvgLengthType.Pc, length.UnitType); + Assert.AreEqual(10, length.ValueInSpecifiedUnits); + Assert.AreEqual("10pc", length.ValueAsString); } [Test] public void TestEmValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10em"); - Assertion.AssertEquals(SvgLengthType.Ems, length.UnitType); - Assertion.AssertEquals(10, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("10em", length.ValueAsString); + Assert.AreEqual(SvgLengthType.Ems, length.UnitType); + Assert.AreEqual(10, length.ValueInSpecifiedUnits); + Assert.AreEqual("10em", length.ValueAsString); } [Test] @@ -147,16 +147,16 @@ public void TestEmToAbsValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10em"); - Assertion.AssertEquals(100, length.Value); + Assert.AreEqual(100, length.Value); } [Test] public void TestExValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10ex"); - Assertion.AssertEquals(SvgLengthType.Exs, length.UnitType); - Assertion.AssertEquals(10, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("10ex", length.ValueAsString); + Assert.AreEqual(SvgLengthType.Exs, length.UnitType); + Assert.AreEqual(10, length.ValueInSpecifiedUnits); + Assert.AreEqual("10ex", length.ValueAsString); } [Test] @@ -164,40 +164,40 @@ public void TestExToAbsValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10ex"); - Assertion.AssertEquals(60, length.Value); + Assert.AreEqual(60, length.Value); } [Test] public void TestPercentValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "10%"); - Assertion.AssertEquals(20, length.Value); - Assertion.AssertEquals(SvgLengthType.Percentage, length.UnitType); - Assertion.AssertEquals(10, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("10%", length.ValueAsString); + Assert.AreEqual(20, length.Value); + Assert.AreEqual(SvgLengthType.Percentage, length.UnitType); + Assert.AreEqual(10, length.ValueInSpecifiedUnits); + Assert.AreEqual("10%", length.ValueAsString); length = new SvgLength(elm, "test", SvgLengthDirection.Vertical, "20%"); - Assertion.AssertEquals(60, length.Value); + Assert.AreEqual(60, length.Value); length = new SvgLength(elm, "test", SvgLengthDirection.Viewport, "10%"); - Assertion.AssertEquals(Math.Sqrt(200*200+300*300)/Math.Sqrt(2) * 0.1D, length.Value); + Assert.AreEqual(Math.Sqrt(200*200+300*300)/Math.Sqrt(2) * 0.1D, length.Value); } [Test] public void TestScientificValues() { length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "2E3px"); - Assertion.AssertEquals(2000, length.Value); - Assertion.AssertEquals(SvgLengthType.Px, length.UnitType); - Assertion.AssertEquals(2000, length.ValueInSpecifiedUnits); - Assertion.AssertEquals("2000px", length.ValueAsString); + Assert.AreEqual(2000, length.Value); + Assert.AreEqual(SvgLengthType.Px, length.UnitType); + Assert.AreEqual(2000, length.ValueInSpecifiedUnits); + Assert.AreEqual("2000px", length.ValueAsString); length = new SvgLength(elm, "test", SvgLengthDirection.Horizontal, "1E-1px"); - Assertion.Assert("Value", Math.Abs(0.1D-length.Value)<0.0001); - Assertion.AssertEquals(SvgLengthType.Px, length.UnitType); - Assertion.Assert("ValueInSpecifiedUnits", Math.Abs(0.1D-length.ValueInSpecifiedUnits)<0.0001); - //Assertion.AssertEquals("0.1px", length.ValueAsString); + Assert.IsTrue(Math.Abs(0.1D-length.Value)<0.0001, "Value"); + Assert.AreEqual(SvgLengthType.Px, length.UnitType); + Assert.IsTrue(Math.Abs(0.1D-length.ValueInSpecifiedUnits)<0.0001, "ValueInSpecifiedUnits"); + //Assert.AreEqual("0.1px", length.ValueAsString); } } Index: SvgNumberListTests.cs =================================================================== RCS file: /cvsroot/svgdomcsharp/SharpVectorGraphics/src/SharpVectorUnitTests/SharpVectors/Dom/Svg/Basic types/SvgNumberListTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SvgNumberListTests.cs 26 Apr 2003 19:50:04 -0000 1.2 +++ SvgNumberListTests.cs 20 Nov 2005 20:42:23 -0000 1.3 @@ -1,130 +1,260 @@ -using System; -using NUnit.Framework; -using SharpVectors.Dom; -using SharpVectors.Dom.Svg; - -namespace SharpVectors.UnitTests.Svg.BasicTypesAndInterfaces -{ - public class SvgNumberListTests : SvgListTests - { - #region Fields - private static int counter = 0; - #endregion - - #region Additional SvgStringList-specific tests - [Test] - public void TestFromStringEmpty() - { - ((SvgNumberList) list).FromString(""); - Assertion.AssertEquals(0, list.NumberOfItems); - } - - [Test] - public void TestFromStringNull() - { - ((SvgNumberList) list).FromString(null); - Assertion.AssertEquals(0, list.NumberOfItems); - } - - [Test] - public void TestFromStringLeadingWhitespace() - { - ((SvgNumberList) list).FromString(" 1 2 3 4"); - Assertion.AssertEquals(1, ((SvgNumberList) list).GetItem(0).Value); - Assertion.AssertEquals(2, ((SvgNumberList) list).GetItem(1).Value); - Assertion.AssertEquals(3, ((SvgNumberList) list).GetItem(2).Value); - Assertion.AssertEquals(4, ((SvgNumberList) list).GetItem(3).Value); - } - - [Test] - public void TestFromStringTrailingWhitespace() - { - ((SvgNumberList) list).FromString("1 2 3 4 "); - Assertion.AssertEquals(1, ((SvgNumberList) list).GetItem(0).Value); - Assertion.AssertEquals(2, ((SvgNumberList) list).GetItem(1).Value); - Assertion.AssertEquals(3, ((SvgNumberList) list).GetItem(2).Value); - Assertion.AssertEquals(4, ((SvgNumberList) list).GetItem(3).Value); - } - - [Test] - public void TestFromStringOneValue() - { - ((SvgNumberList) list).FromString("1"); - Assertion.AssertEquals(1, ((SvgNumberList) list).GetItem(0).Value); - } - - [Test] - public void TestFromStringSpaceDelimited() - { - ((SvgNumberList) list).FromString("1 2 3 4"); - Assertion.AssertEquals(1, ((SvgNumberList) list).GetItem(0).Value); - Assertion.AssertEquals(2, ((SvgNumberList) list).GetItem(1).Value); - Assertion.AssertEquals(3, ((SvgNumberList) list).GetItem(2).Value); - Assertion.AssertEquals(4, ((SvgNumberList) list).GetItem(3).Value); - } - - [Test] - public void TestFromStringCommaDelimited() - { - ((SvgNumberList) list).FromString("1,2, 3 ,4 , 5"); - Assertion.AssertEquals(1, ((SvgNumberList) list).GetItem(0).Value); - Assertion.AssertEquals(2, ((SvgNumberList) list).GetItem(1).Value); - Assertion.AssertEquals(3, ((SvgNumberList) list).GetItem(2).Value); - Assertion.AssertEquals(4, ((SvgNumberList) list).GetItem(3).Value); - Assertion.AssertEquals(5, ((SvgNumberList) list).GetItem(4).Value); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas() - { - ((SvgNumberList) list).FromString("1,,2"); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas2() - { - ((SvgNumberList) list).FromString("1, ,2"); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas3() - { - ((SvgNumberList) list).FromString("1 , ,2"); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas4() - { - ((SvgNumberList) list).FromString("1 , , 2"); - } - - [Test] - public void TestFromStringMixed() - { - ((SvgNumberList) list).FromString("1 2 3,4 ,5 , 6"); - Assertion.AssertEquals(1, ((SvgNumberList) list).GetItem(0).Value); - Assertion.AssertEquals(2, ((SvgNumberList) list).GetItem(1).Value); - Assertion.AssertEquals(3, ((SvgNumberList) list).GetItem(2).Value); - Assertion.AssertEquals(4, ((SvgNumberList) list).GetItem(3).Value); - Assertion.AssertEquals(5, ((SvgNumberList) list).GetItem(4).Value); - Assertion.AssertEquals(6, ((SvgNumberList) list).GetItem(5).Value); - } - #endregion - - #region Support Methods - protected override SvgList makeList() - { - return new SvgNumberList(); - } - - protected new SvgNumber makeItem() - { - return new SvgNumber(counter++); - } - #endregion - } -} +using System; + +using NUnit.Framework; + +using SharpVectors.Dom; + +using SharpVectors.Dom.Svg; + + + +namespace SharpVectors.UnitTests.Svg.BasicTypesAndInterfaces + +{ + + public class SvgNumberListTests : SvgListTests + + { + + #region Fields + + private static int counter = 0; + + #endregion + + + + #region Additional SvgStringList-specific tests + + [Test] + + public void TestFromStringEmpty() + + { + + ((SvgNumberList) list).FromString(""); + + Assert.AreEqual(0, list.NumberOfItems); + + } + + + + [Test] + + public void TestFromStringNull() + + { + + ((SvgNumberList) list).FromString(null); + + Assert.AreEqual(0, list.NumberOfItems); + + } + + + + [Test] + + public void TestFromStringLeadingWhitespace() + + { + + ((SvgNumberList) list).FromString(" 1 2 3 4"); + + Assert.AreEqual(1, ((SvgNumberList) list).GetItem(0).Value); + + Assert.AreEqual(2, ((SvgNumberList) list).GetItem(1).Value); + + Assert.AreEqual(3, ((SvgNumberList) list).GetItem(2).Value); + + Assert.AreEqual(4, ((SvgNumberList) list).GetItem(3).Value); + + } + + + + [Test] + + public void TestFromStringTrailingWhitespace() + + { + + ((SvgNumberList) list).FromString("1 2 3 4 "); + + Assert.AreEqual(1, ((SvgNumberList) list).GetItem(0).Value); + + Assert.AreEqual(2, ((SvgNumberList) list).GetItem(1).Value); + + Assert.AreEqual(3, ((SvgNumberList) list).GetItem(2).Value); + + Assert.AreEqual(4, ((SvgNumberList) list).GetItem(3).Value); + + } + + + + [Test] + + public void TestFromStringOneValue() + + { + + ((SvgNumberList) list).FromString("1"); + + Assert.AreEqual(1, ((SvgNumberList) list).GetItem(0).Value); + + } + + + + [Test] + + public void TestFromStringSpaceDelimited() + + { + + ((SvgNumberList) list).FromString("1 2 3 4"); + + Assert.AreEqual(1, ((SvgNumberList) list).GetItem(0).Value); + + Assert.AreEqual(2, ((SvgNumberList) list).GetItem(1).Value); + + Assert.AreEqual(3, ((SvgNumberList) list).GetItem(2).Value); + + Assert.AreEqual(4, ((SvgNumberList) list).GetItem(3).Value); + + } + + + + [Test] + + public void TestFromStringCommaDelimited() + + { + + ((SvgNumberList) list).FromString("1,2, 3 ,4 , 5"); + + Assert.AreEqual(1, ((SvgNumberList) list).GetItem(0).Value); + + Assert.AreEqual(2, ((SvgNumberList) list).GetItem(1).Value); + + Assert.AreEqual(3, ((SvgNumberList) list).GetItem(2).Value); + + Assert.AreEqual(4, ((SvgNumberList) list).GetItem(3).Value); + + Assert.AreEqual(5, ((SvgNumberList) list).GetItem(4).Value); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas() + + { + + ((SvgNumberList) list).FromString("1,,2"); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas2() + + { + + ((SvgNumberList) list).FromString("1, ,2"); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas3() + + { + + ((SvgNumberList) list).FromString("1 , ,2"); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas4() + + { + + ((SvgNumberList) list).FromString("1 , , 2"); + + } + + + + [Test] + + public void TestFromStringMixed() + + { + + ((SvgNumberList) list).FromString("1 2 3,4 ,5 , 6"); + + Assert.AreEqual(1, ((SvgNumberList) list).GetItem(0).Value); + + Assert.AreEqual(2, ((SvgNumberList) list).GetItem(1).Value); + + Assert.AreEqual(3, ((SvgNumberList) list).GetItem(2).Value); + + Assert.AreEqual(4, ((SvgNumberList) list).GetItem(3).Value); + + Assert.AreEqual(5, ((SvgNumberList) list).GetItem(4).Value); + + Assert.AreEqual(6, ((SvgNumberList) list).GetItem(5).Value); + + } + + #endregion + + + + #region Support Methods + + protected override SvgList makeList() + + { + + return new SvgNumberList(); + + } + + + + protected new SvgNumber makeItem() + + { + + return new SvgNumber(counter++); + + } + + #endregion + + } + +} + Index: SvgTransformListTests.cs =================================================================== RCS file: /cvsroot/svgdomcsharp/SharpVectorGraphics/src/SharpVectorUnitTests/SharpVectors/Dom/Svg/Basic types/SvgTransformListTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SvgTransformListTests.cs 26 Apr 2003 19:50:04 -0000 1.2 +++ SvgTransformListTests.cs 20 Nov 2005 20:42:23 -0000 1.3 @@ -1,134 +1,268 @@ -using System; -using NUnit.Framework; -using SharpVectors.Dom; -using SharpVectors.Dom.Svg; - -namespace SharpVectors.UnitTests.Svg.BasicTypesAndInterfaces -{ - public class SvgTransformListTests : SvgListTests - { - #region Fields - private static int counter = 0; - #endregion - - #region Additional SvgTransformList-specific tests - /* - [Test] - public void TestFromStringEmpty() - { - ((SvgStringList) list).FromString(""); - Assertion.AssertEquals(0, list.NumberOfItems); - } - - [Test] - public void TestFromStringNull() - { - ((SvgStringList) list).FromString(null); - Assertion.AssertEquals(0, list.NumberOfItems); - } - - [Test] - public void TestFromStringLeadingWhitespace() - { - ((SvgStringList) list).FromString(" one two three four"); - Assertion.AssertEquals("one", list.GetItem(0)); - Assertion.AssertEquals("two", list.GetItem(1)); - Assertion.AssertEquals("three", list.GetItem(2)); - Assertion.AssertEquals("four", list.GetItem(3)); - } - - [Test] - public void TestFromStringTrailingWhitespace() - { - ((SvgStringList) list).FromString("one two three four "); - Assertion.AssertEquals("one", list.GetItem(0)); - Assertion.AssertEquals("two", list.GetItem(1)); - Assertion.AssertEquals("three", list.GetItem(2)); - Assertion.AssertEquals("four", list.GetItem(3)); - } - - [Test] - public void TestFromStringOneValue() - { - ((SvgStringList) list).FromString("one"); - Assertion.AssertEquals("one", list.GetItem(0)); - } - - [Test] - public void TestFromStringSpaceDelimited() - { - ((SvgStringList) list).FromString("one two three four"); - Assertion.AssertEquals("one", list.GetItem(0)); - Assertion.AssertEquals("two", list.GetItem(1)); - Assertion.AssertEquals("three", list.GetItem(2)); - Assertion.AssertEquals("four", list.GetItem(3)); - } - - [Test] - public void TestFromStringCommaDelimited() - { - ((SvgStringList) list).FromString("one,two, three ,four , five"); - Assertion.AssertEquals("one", list.GetItem(0)); - Assertion.AssertEquals("two", list.GetItem(1)); - Assertion.AssertEquals("three", list.GetItem(2)); - Assertion.AssertEquals("four", list.GetItem(3)); - Assertion.AssertEquals("five", list.GetItem(4)); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas() - { - ((SvgStringList) list).FromString("one,,two"); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas2() - { - ((SvgStringList) list).FromString("one, ,two"); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas3() - { - ((SvgStringList) list).FromString("one , ,two"); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas4() - { - ((SvgStringList) list).FromString("one , , two"); - } - - [Test] - public void TestFromStringMixed() - { - ((SvgStringList) list).FromString("one two three,four ,five , six"); - Assertion.AssertEquals("one", list.GetItem(0)); - Assertion.AssertEquals("two", list.GetItem(1)); - Assertion.AssertEquals("three", list.GetItem(2)); - Assertion.AssertEquals("four", list.GetItem(3)); - Assertion.AssertEquals("five", list.GetItem(4)); - Assertion.AssertEquals("six", list.GetItem(5)); - } - */ - #endregion - - #region Support Methods - protected override SvgList makeList() - { - return new SvgTransformList(); - } - - protected new SvgTransform makeItem() - { - string scale = (counter++).ToString(); - - return new SvgTransform("matrix(" + scale + ",0,0," + scale + ",0,0"); - } - #endregion - } -} +using System; + +using NUnit.Framework; + +using SharpVectors.Dom; + +using SharpVectors.Dom.Svg; + + + +namespace SharpVectors.UnitTests.Svg.BasicTypesAndInterfaces + +{ + + public class SvgTransformListTests : SvgListTests + + { + + #region Fields + + private static int counter = 0; + + #endregion + + + + #region Additional SvgTransformList-specific tests + + /* + + [Test] + + public void TestFromStringEmpty() + + { + + ((SvgStringList) list).FromString(""); + + Assert.AreEqual(0, list.NumberOfItems); + + } + + + + [Test] + + public void TestFromStringNull() + + { + + ((SvgStringList) list).FromString(null); + + Assert.AreEqual(0, list.NumberOfItems); + + } + + + + [Test] + + public void TestFromStringLeadingWhitespace() + + { + + ((SvgStringList) list).FromString(" one two three four"); + + Assert.AreEqual("one", list.GetItem(0)); + + Assert.AreEqual("two", list.GetItem(1)); + + Assert.AreEqual("three", list.GetItem(2)); + + Assert.AreEqual("four", list.GetItem(3)); + + } + + + + [Test] + + public void TestFromStringTrailingWhitespace() + + { + + ((SvgStringList) list).FromString("one two three four "); + + Assert.AreEqual("one", list.GetItem(0)); + + Assert.AreEqual("two", list.GetItem(1)); + + Assert.AreEqual("three", list.GetItem(2)); + + Assert.AreEqual("four", list.GetItem(3)); + + } + + + + [Test] + + public void TestFromStringOneValue() + + { + + ((SvgStringList) list).FromString("one"); + + Assert.AreEqual("one", list.GetItem(0)); + + } + + + + [Test] + + public void TestFromStringSpaceDelimited() + + { + + ((SvgStringList) list).FromString("one two three four"); + + Assert.AreEqual("one", list.GetItem(0)); + + Assert.AreEqual("two", list.GetItem(1)); + + Assert.AreEqual("three", list.GetItem(2)); + + Assert.AreEqual("four", list.GetItem(3)); + + } + + + + [Test] + + public void TestFromStringCommaDelimited() + + { + + ((SvgStringList) list).FromString("one,two, three ,four , five"); + + Assert.AreEqual("one", list.GetItem(0)); + + Assert.AreEqual("two", list.GetItem(1)); + + Assert.AreEqual("three", list.GetItem(2)); + + Assert.AreEqual("four", list.GetItem(3)); + + Assert.AreEqual("five", list.GetItem(4)); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas() + + { + + ((SvgStringList) list).FromString("one,,two"); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas2() + + { + + ((SvgStringList) list).FromString("one, ,two"); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas3() + + { + + ((SvgStringList) list).FromString("one , ,two"); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas4() + + { + + ((SvgStringList) list).FromString("one , , two"); + + } + + + + [Test] + + public void TestFromStringMixed() + + { + + ((SvgStringList) list).FromString("one two three,four ,five , six"); + + Assert.AreEqual("one", list.GetItem(0)); + + Assert.AreEqual("two", list.GetItem(1)); + + Assert.AreEqual("three", list.GetItem(2)); + + Assert.AreEqual("four", list.GetItem(3)); + + Assert.AreEqual("five", list.GetItem(4)); + + Assert.AreEqual("six", list.GetItem(5)); + + } + + */ + + #endregion + + + + #region Support Methods + + protected override SvgList makeList() + + { + + return new SvgTransformList(); + + } + + + + protected new SvgTransform makeItem() + + { + + string scale = (counter++).ToString(); + + + + return new SvgTransform("matrix(" + scale + ",0,0," + scale + ",0,0"); + + } + + #endregion + + } + +} + Index: SvgStringListTests.cs =================================================================== RCS file: /cvsroot/svgdomcsharp/SharpVectorGraphics/src/SharpVectorUnitTests/SharpVectors/Dom/Svg/Basic types/SvgStringListTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SvgStringListTests.cs 26 Apr 2003 19:50:04 -0000 1.2 +++ SvgStringListTests.cs 20 Nov 2005 20:42:23 -0000 1.3 @@ -1,130 +1,260 @@ -using System; -using NUnit.Framework; -using SharpVectors.Dom; -using SharpVectors.Dom.Svg; - -namespace SharpVectors.UnitTests.Svg.BasicTypesAndInterfaces -{ - public class SvgStringListTests : SvgListTests - { - #region Fields - private static int counter = 0; - #endregion - - #region Additional SvgStringList-specific tests - [Test] - public void TestFromStringEmpty() - { - ((SvgStringList) list).FromString(""); - Assertion.AssertEquals(0, list.NumberOfItems); - } - - [Test] - public void TestFromStringNull() - { - ((SvgStringList) list).FromString(null); - Assertion.AssertEquals(0, list.NumberOfItems); - } - - [Test] - public void TestFromStringLeadingWhitespace() - { - ((SvgStringList) list).FromString(" one two three four"); - Assertion.AssertEquals("one", list.GetItem(0)); - Assertion.AssertEquals("two", list.GetItem(1)); - Assertion.AssertEquals("three", list.GetItem(2)); - Assertion.AssertEquals("four", list.GetItem(3)); - } - - [Test] - public void TestFromStringTrailingWhitespace() - { - ((SvgStringList) list).FromString("one two three four "); - Assertion.AssertEquals("one", list.GetItem(0)); - Assertion.AssertEquals("two", list.GetItem(1)); - Assertion.AssertEquals("three", list.GetItem(2)); - Assertion.AssertEquals("four", list.GetItem(3)); - } - - [Test] - public void TestFromStringOneValue() - { - ((SvgStringList) list).FromString("one"); - Assertion.AssertEquals("one", list.GetItem(0)); - } - - [Test] - public void TestFromStringSpaceDelimited() - { - ((SvgStringList) list).FromString("one two three four"); - Assertion.AssertEquals("one", list.GetItem(0)); - Assertion.AssertEquals("two", list.GetItem(1)); - Assertion.AssertEquals("three", list.GetItem(2)); - Assertion.AssertEquals("four", list.GetItem(3)); - } - - [Test] - public void TestFromStringCommaDelimited() - { - ((SvgStringList) list).FromString("one,two, three ,four , five"); - Assertion.AssertEquals("one", list.GetItem(0)); - Assertion.AssertEquals("two", list.GetItem(1)); - Assertion.AssertEquals("three", list.GetItem(2)); - Assertion.AssertEquals("four", list.GetItem(3)); - Assertion.AssertEquals("five", list.GetItem(4)); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas() - { - ((SvgStringList) list).FromString("one,,two"); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas2() - { - ((SvgStringList) list).FromString("one, ,two"); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas3() - { - ((SvgStringList) list).FromString("one , ,two"); - } - - [Test] - [ExpectedException(typeof(DomException))] - public void TestFromStringMultipleCommas4() - { - ((SvgStringList) list).FromString("one , , two"); - } - - [Test] - public void TestFromStringMixed() - { - ((SvgStringList) list).FromString("one two three,four ,five , six"); - Assertion.AssertEquals("one", list.GetItem(0)); - Assertion.AssertEquals("two", list.GetItem(1)); - Assertion.AssertEquals("three", list.GetItem(2)); - Assertion.AssertEquals("four", list.GetItem(3)); - Assertion.AssertEquals("five", list.GetItem(4)); - Assertion.AssertEquals("six", list.GetItem(5)); - } - #endregion - - #region Support Methods - protected override SvgList makeList() - { - return new SvgStringList(); - } - - protected new string makeItem() - { - return "string" + (counter++).ToString(); - } - #endregion - } -} +using System; + +using NUnit.Framework; + +using SharpVectors.Dom; + +using SharpVectors.Dom.Svg; + + + +namespace SharpVectors.UnitTests.Svg.BasicTypesAndInterfaces + +{ + + public class SvgStringListTests : SvgListTests + + { + + #region Fields + + private static int counter = 0; + + #endregion + + + + #region Additional SvgStringList-specific tests + + [Test] + + public void TestFromStringEmpty() + + { + + ((SvgStringList) list).FromString(""); + + Assert.AreEqual(0, list.NumberOfItems); + + } + + + + [Test] + + public void TestFromStringNull() + + { + + ((SvgStringList) list).FromString(null); + + Assert.AreEqual(0, list.NumberOfItems); + + } + + + + [Test] + + public void TestFromStringLeadingWhitespace() + + { + + ((SvgStringList) list).FromString(" one two three four"); + + Assert.AreEqual("one", list.GetItem(0)); + + Assert.AreEqual("two", list.GetItem(1)); + + Assert.AreEqual("three", list.GetItem(2)); + + Assert.AreEqual("four", list.GetItem(3)); + + } + + + + [Test] + + public void TestFromStringTrailingWhitespace() + + { + + ((SvgStringList) list).FromString("one two three four "); + + Assert.AreEqual("one", list.GetItem(0)); + + Assert.AreEqual("two", list.GetItem(1)); + + Assert.AreEqual("three", list.GetItem(2)); + + Assert.AreEqual("four", list.GetItem(3)); + + } + + + + [Test] + + public void TestFromStringOneValue() + + { + + ((SvgStringList) list).FromString("one"); + + Assert.AreEqual("one", list.GetItem(0)); + + } + + + + [Test] + + public void TestFromStringSpaceDelimited() + + { + + ((SvgStringList) list).FromString("one two three four"); + + Assert.AreEqual("one", list.GetItem(0)); + + Assert.AreEqual("two", list.GetItem(1)); + + Assert.AreEqual("three", list.GetItem(2)); + + Assert.AreEqual("four", list.GetItem(3)); + + } + + + + [Test] + + public void TestFromStringCommaDelimited() + + { + + ((SvgStringList) list).FromString("one,two, three ,four , five"); + + Assert.AreEqual("one", list.GetItem(0)); + + Assert.AreEqual("two", list.GetItem(1)); + + Assert.AreEqual("three", list.GetItem(2)); + + Assert.AreEqual("four", list.GetItem(3)); + + Assert.AreEqual("five", list.GetItem(4)); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas() + + { + + ((SvgStringList) list).FromString("one,,two"); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas2() + + { + + ((SvgStringList) list).FromString("one, ,two"); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas3() + + { + + ((SvgStringList) list).FromString("one , ,two"); + + } + + + + [Test] + + [ExpectedException(typeof(DomException))] + + public void TestFromStringMultipleCommas4() + + { + + ((SvgStringList) list).FromString("one , , two"); + + } + + + + [Test] + + public void TestFromStringMixed() + + { + + ((SvgStringList) list).FromString("one two three,four ,five , six"); + + Assert.AreEqual("one", list.GetItem(0)); + + Assert.AreEqual("two", list.GetItem(1)); + + Assert.AreEqual("three", list.GetItem(2)); + + Assert.AreEqual("four", list.GetItem(3)); + + Assert.AreEqual("five", list.GetItem(4)); + + Assert.AreEqual("six", list.GetItem(5)); + + } + + #endregion + + + + #region Support Methods + + protected override SvgList makeList() + + { + + return new SvgStringList(); + + } + + + + protected new string makeItem() + + { + + return "string" + (counter++).ToString(); + + } + + #endregion + + } + +} + Index: SvgLengthListTests.cs =================================================================== RCS file: /cvsroot/svgdomcsharp/SharpVectorGraphics/src/SharpVectorUnitTests/SharpVectors/Dom/Svg/Basic types/SvgLengthListTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SvgLengthListTests.cs 26 Apr 2003 19:50:04 -0000 1.2 +++ SvgLengthListTests.cs 20 Nov 2005 20:42:23 -0000 1.3 @@ -1,163 +1 @@ -using System; -using NUnit.Framework; -using SharpVectors.Dom; -using SharpVectors.Dom.Svg; - -namespace SharpVectors.UnitTests.Svg.BasicTypesAndInterfaces -{ - public class SvgLengthListTests : SvgListTests - { - #region Fields - private static int counter = 0; - #endregion - - #region Additional SvgLengthList-specific tests - [Test] - public void TestFromStringEmpty() - { - ((SvgLengthList) list).FromString(""); - Assertion.AssertEquals(0, list.NumberOfItems); - } - - [Test] - public void TestFromStringNull() - { - ((SvgLengthList) list).FromString(null); - Assertion.AssertEquals(0, list.NumberOfItems); - } - - [Test] - - public void TestFromStringLeadingWhitespace() - { - SvgLengthList svgLengthList = (SvgLengthList) list; - - svgLengthList.FromString(" 1px 2em 3in 4cm"); - Assertion.AssertEquals(1, svgLengthList.GetItem(0).ValueInSpecifiedUnits); - Assertion.AssertEquals(SvgLengthType.Px, svgLengthList.GetItem(0).UnitType); - Assertion.AssertEquals(2, svgLengthList.GetItem(1).ValueInSpecifiedUnits); - Assertion.AssertE... [truncated message content] |