Make a copy of the old ZipLib
[mono.git] / mcs / class / System.Drawing / Test / DrawingTest / Test / Brush.cs
1 using System;\r
2 using System.Drawing;\r
3 using System.Drawing.Drawing2D;\r
4 using NUnit.Framework;\r
5 using DrawingTestHelper;\r
6 \r
7 namespace Test.Sys.Drawing\r
8 {\r
9         /// <summary>\r
10         /// Summary description for Brush.\r
11         /// </summary>\r
12         \r
13         #region BrushFixture\r
14 \r
15         [TestFixture]\r
16         public class BrushFixture\r
17         {\r
18                 [Test]\r
19                 public void ColorTest()\r
20                 {\r
21                         SolidBrush b = new SolidBrush (Color.Azure);\r
22                         Assert.AreEqual (Color.Azure, b.Color);\r
23                         DrawingTest t = DrawingTest.Create (64, 64);\r
24                         t.Graphics.FillRectangle (b, 0, 0, 30, 30);\r
25                         t.Show ();\r
26                         b.Color = Color.FromArgb (100, 240, 30);\r
27                         t.Graphics.FillRectangle (b, 30, 5, 30, 50);\r
28                         t.Show ();\r
29                         b.Color = Color.FromArgb (70, Color.FromName ("red"));\r
30                         t.Graphics.FillRectangle (b, 15, 15, 40, 40);\r
31                         t.Show ();\r
32                 }\r
33         }\r
34 \r
35         #endregion\r
36 \r
37         #region TextureBrushFixture\r
38         [TestFixture]\r
39         public class GraphicsFixtureFillModes {\r
40                 protected DrawingTest t;\r
41                 protected int TOLERANCE = 3;\r
42                 Image bmp;\r
43                 Image bmp2;\r
44 \r
45                 [SetUp]\r
46                 public virtual void SetUp() {\r
47                         SetUp("TextureBrushFixture");\r
48                 }\r
49                 public virtual void SetUp(string ownerClass) {\r
50                         t = DrawingTest.Create(512, 512, ownerClass);\r
51                         bmp = Bitmap.FromFile(@"..\..\bitmap50.png");\r
52                         bmp2 = Bitmap.FromFile(@"..\..\bitmap25.png");\r
53                 }\r
54                 [TearDown]\r
55                 public void TearDown() {\r
56                 }\r
57 \r
58                 [Test]\r
59                 public void WrapMode_1() {\r
60                         TextureBrush b = new TextureBrush( bmp );\r
61                         Assert.AreEqual(WrapMode.Tile, b.WrapMode);\r
62                 }\r
63                 [Test]\r
64                 public void TextureBush_1() {\r
65                         TextureBrush b = new TextureBrush( bmp );\r
66                         t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
67                         t.Show();\r
68                         Assert.IsTrue(t.PDCompare());\r
69                 }\r
70                 [Test]\r
71                 public void TextureBush_2() {\r
72                         TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipX );\r
73                         t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
74                         t.Show();\r
75                         Assert.IsTrue(t.PDCompare());\r
76                 }\r
77                 [Test]\r
78                 public void TextureBush_3() {\r
79                         TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipY );\r
80                         t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
81                         t.Show();\r
82                         Assert.IsTrue(t.PDCompare());\r
83                 }\r
84                 [Test]\r
85                 public void TextureBush_4() {\r
86                         TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipXY );\r
87                         t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
88                         t.Show();\r
89                         Assert.IsTrue(t.PDCompare());\r
90                 }\r
91                 [Test]\r
92                 public void TextureBush_5() {\r
93                         TextureBrush b = new TextureBrush( bmp2, new Rectangle(100, 100, 50, 50) );\r
94                         t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
95                         t.Show();\r
96                         Assert.IsTrue(t.PDCompare());\r
97                 }\r
98                 [Test]\r
99                 public void TextureBush_6() {\r
100                         TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipX, new Rectangle(100, 100, 50, 50) );\r
101                         t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
102                         t.Show();\r
103                         Assert.IsTrue(t.PDCompare());\r
104                 }\r
105                 [Test]\r
106                 public void TextureBush_7() {\r
107                         TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipY, new Rectangle(100, 100, 50, 50) );\r
108                         t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
109                         t.Show();\r
110                         Assert.IsTrue(t.PDCompare());\r
111                 }\r
112                 [Test]\r
113                 public void TextureBush_8() {\r
114                         TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipXY, new Rectangle(100, 100, 50, 50) );\r
115                         t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
116                         t.Show();\r
117                         Assert.IsTrue(t.PDCompare());\r
118                 }\r
119                 [Test]\r
120                 public void TextureBush_9() {\r
121                         TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipXY, new Rectangle(100, 100, 50, 50) );\r
122                         t.Graphics.RotateTransform(30);\r
123                         t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
124                         t.Show();\r
125                         Assert.IsTrue(t.PDCompare());\r
126                 }\r
127                 [Test]\r
128                 public void TextureBush_10() {\r
129                         TextureBrush b = new TextureBrush( bmp, WrapMode.TileFlipXY, new Rectangle(100, 100, 50, 50) );\r
130                         t.Graphics.RotateTransform(30);\r
131                         b.RotateTransform(30);\r
132                         t.Graphics.FillRectangle( b, 100, 100, 300, 300 );\r
133                         t.Show();\r
134                         Assert.IsTrue(t.PDCompare());\r
135                 }\r
136         }\r
137         #endregion\r
138 \r
139 }\r