/// <summary>\r
/// Summary description for Brush.\r
/// </summary>\r
+ \r
+ #region BrushFixture\r
+\r
[TestFixture]\r
public class BrushFixture\r
{\r
t.Show ();\r
}\r
}\r
+\r
+ #endregion\r
+\r
+ #region TextureBrushFixture\r
+ [TestFixture]\r
+ public class GraphicsFixtureFillModes {\r
+ protected DrawingTest t;\r
+ protected int TOLERANCE = 3;\r
+ Image bmp;\r
+ Image bmp2;\r
+\r
+ [SetUp]\r
+ public virtual void SetUp() {\r
+ SetUp("TextureBrushFixture");\r
+ }\r
+ public virtual void SetUp(string ownerClass) {\r
+ t = DrawingTest.Create(512, 512, ownerClass);\r
+ bmp = Bitmap.FromFile(@"..\..\bitmap50.png");\r
+ bmp2 = Bitmap.FromFile(@"..\..\bitmap25.png");\r
+ }\r
+ [TearDown]\r
+ public void TearDown() {\r
+ }\r
+\r
+ [Test]\r
+ public void WrapMode_1() {\r
+ TextureBrush b = new TextureBrush( bmp );\r
+ Assert.AreEqual(WrapMode.Tile, b.WrapMode);\r
+ }\r
+ [Test]\r
+ public void TextureBush_1() {\r
+ TextureBrush b = new TextureBrush( bmp );\r
+ t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void TextureBush_2() {\r
+ TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipX );\r
+ t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void TextureBush_3() {\r
+ TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipY );\r
+ t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void TextureBush_4() {\r
+ TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipXY );\r
+ t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void TextureBush_5() {\r
+ TextureBrush b = new TextureBrush( bmp2, new Rectangle(100, 100, 50, 50) );\r
+ t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void TextureBush_6() {\r
+ TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipX, new Rectangle(100, 100, 50, 50) );\r
+ t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void TextureBush_7() {\r
+ TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipY, new Rectangle(100, 100, 50, 50) );\r
+ t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void TextureBush_8() {\r
+ TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipXY, new Rectangle(100, 100, 50, 50) );\r
+ t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ }\r
+ #endregion\r
+\r
}\r
+2005-10-17 Vladimir Krasnov <vladimirk@mainsoft.com>\r
+ \r
+ * Graphics.cs: Added FillMode tests\r
+ * Brush.cs: Added TextureBrush tests \r
+\r
2005-09-21 Vladimir Krasnov <vladimirk@mainsoft.com>\r
\r
* Graphics.cs: Added tests for DrawImage\r
}\r
#endregion\r
\r
+ #region GraphicsFixtureFillModes\r
+ [TestFixture]\r
+ public class GraphicsFixtureFillModes {\r
+ protected DrawingTest t;\r
+ protected int TOLERANCE = 3; //in %;\r
+\r
+ [SetUp]\r
+ public virtual void SetUp() {\r
+ SetUp("GraphicsFixtureFillModes");\r
+ }\r
+ public virtual void SetUp(string ownerClass) {\r
+ t = DrawingTest.Create(512, 512, ownerClass);\r
+ }\r
+ [TearDown]\r
+ public void TearDown() {\r
+ }\r
+\r
+ [Test]\r
+ public void FillModeAlternate() {\r
+ GraphicsPath p = new GraphicsPath();\r
+ Assert.AreEqual(FillMode.Alternate, p.FillMode);\r
+ }\r
+ [Test]\r
+ public void FillModeAlternate_1() {\r
+ Point [] p = new Point[] {\r
+ new Point(50, 100),\r
+ new Point(70, 10),\r
+ new Point(90, 100),\r
+ new Point(140, 10),\r
+ new Point(150, 100),\r
+ new Point(170, 10),\r
+ new Point(50, 100)\r
+ };\r
+\r
+ GraphicsPath path = new GraphicsPath();\r
+ path.AddLines( p );\r
+ path.FillMode = FillMode.Alternate;\r
+ t.Graphics.FillPath( Brushes.Blue, path );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void FillModeAlternate_2() {\r
+\r
+ Rectangle r1 = new Rectangle(100, 100, 100, 100);\r
+ Rectangle r2 = new Rectangle(125, 125, 50, 50);\r
+ GraphicsPath path = new GraphicsPath();\r
+ path.AddRectangle( r1 );\r
+ path.AddRectangle( r2 );\r
+ path.FillMode = FillMode.Alternate;\r
+ t.Graphics.FillPath( Brushes.Blue, path );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void FillModeAlternate_3() {\r
+ Point [] p = new Point[] {\r
+ new Point(50, 100),\r
+ new Point(150, 50),\r
+ new Point(250, 100),\r
+ new Point(50, 75),\r
+ new Point(250, 50),\r
+ new Point(50, 100)\r
+ };\r
+\r
+ GraphicsPath path = new GraphicsPath();\r
+ path.AddLines( p );\r
+ path.FillMode = FillMode.Alternate;\r
+ t.Graphics.FillPath( Brushes.Blue, path );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void FillModeWinding_1() {\r
+ Point [] p = new Point[] {\r
+ new Point(50, 100),\r
+ new Point(70, 10),\r
+ new Point(90, 100),\r
+ new Point(140, 10),\r
+ new Point(150, 100),\r
+ new Point(170, 10),\r
+ new Point(50, 100)\r
+ };\r
+\r
+ GraphicsPath path = new GraphicsPath();\r
+ path.AddLines( p );\r
+ path.FillMode = FillMode.Winding;\r
+ t.Graphics.FillPath( Brushes.Blue, path );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void FillModeWinding_2() {\r
+\r
+ Rectangle r1 = new Rectangle(100, 100, 100, 100);\r
+ Rectangle r2 = new Rectangle(125, 125, 50, 50);\r
+ GraphicsPath path = new GraphicsPath();\r
+ path.AddRectangle( r1 );\r
+ path.AddRectangle( r2 );\r
+ path.FillMode = FillMode.Winding;\r
+ t.Graphics.FillPath( Brushes.Blue, path );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+ [Test]\r
+ public void FillModeWinding_3() {\r
+ Point [] p = new Point[] {\r
+ new Point(50, 100),\r
+ new Point(150, 50),\r
+ new Point(250, 100),\r
+ new Point(50, 75),\r
+ new Point(250, 50),\r
+ new Point(50, 100)\r
+ };\r
+\r
+ GraphicsPath path = new GraphicsPath();\r
+ path.AddLines( p );\r
+ path.FillMode = FillMode.Winding;\r
+ t.Graphics.FillPath( Brushes.Blue, path );\r
+ t.Show();\r
+ Assert.IsTrue(t.PDCompare());\r
+ }\r
+\r
+ }\r
+ #endregion\r
+\r
+\r
#region GraphicsFixture\r
/// <summary>\r
/// Summary description for Graphics.\r
public virtual void SetUp(string ownerClass) {\r
t = DrawingTest.Create(512, 512, ownerClass);\r
\r
- // hashtable of differents tolerance values for specified tests.\r
+ // hashtable of differents tolerance values for specified tests. (for fft comparer)\r
st["DrawArcTest:6"] = TOLERANCE * 2.5f;\r
st["DrawCurveTestF:4"] = TOLERANCE * 2f;\r
st["DrawPolygonPoint:2"] = TOLERANCE * 2f;\r