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