2005-08-16 Marek Safar <marek.safar@seznam.cz>
[mono.git] / mcs / class / System.Drawing / Test / DrawingTest / Test / Pen.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 Pen.\r
11         /// </summary>\r
12         [TestFixture]\r
13         public class PenFixture {\r
14                 //TODO: Brush, CompoundArray, CustomEndCap, CustomStartCap,\r
15                 //StartCap, EndCap, PenType, Transform\r
16                 DrawingTest t;\r
17                 Pen p;\r
18                 [SetUp]\r
19                 public void SetUp () {\r
20                         t = DrawingTest.Create (256, 256);\r
21                         p = new Pen (Color.Blue);\r
22                         p.Width = 10;\r
23                 }\r
24                 [Test]\r
25                 public void InitAlignment () {\r
26                         Pen p = new Pen (Color.Blue);\r
27                         Assert.AreEqual (PenAlignment.Center, p.Alignment);\r
28                 }\r
29                 [Test]\r
30                 public void Width () {\r
31                         Assert.AreEqual (10, p.Width);\r
32                         t.Graphics.DrawLine (p, 0, 0, 64, 64);\r
33                         t.Show ();\r
34                         Assert.IsTrue (t.Compare (10));\r
35                         p.Width = 0;\r
36                         t.Graphics.DrawLine (p, 32, 0, 35, 64);\r
37                         t.Show ();\r
38                         Assert.IsTrue (t.Compare (10));\r
39                         p.Width = 10;\r
40                         t.Graphics.DrawLine (p, 0, 64, 64, 70);\r
41                         t.Show ();\r
42                         Assert.IsTrue (t.Compare (10));\r
43                 }\r
44                 [Test]\r
45                 public void DashStyleTest () {\r
46                         Assert.AreEqual (DashStyle.Solid, p.DashStyle);\r
47                         t.Graphics.DrawLine (p, 0, 30, 256, 30);\r
48                         t.Show ();\r
49                         Assert.IsTrue (t.Compare (10));\r
50                         \r
51                         p.DashStyle = DashStyle.Dash;\r
52                         p.Width = 10;\r
53                         t.Graphics.DrawLine (p, 0, 600, 200, 60);\r
54                         t.Show ();\r
55                         Assert.IsTrue (t.Compare (10));\r
56                         \r
57                         p.DashStyle = DashStyle.DashDot;\r
58                         t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);\r
59                         t.Graphics.DrawLine (p, 0, 0, 200, 200);\r
60                         t.Show ();\r
61                         Assert.IsTrue (t.Compare (10));\r
62                         \r
63                         p.DashStyle = DashStyle.DashDotDot;\r
64                         t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);\r
65                         t.Graphics.DrawLine (p, 0, 0, 200, 200);\r
66                         t.Show ();\r
67                         Assert.IsTrue (t.Compare (10));\r
68 \r
69                         p.DashStyle = DashStyle.Dot;\r
70                         t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);\r
71                         t.Graphics.DrawLine (p, 0, 0, 200, 200);\r
72                         t.Show ();\r
73                         Assert.IsTrue (t.Compare (10));\r
74 \r
75                         p.DashStyle = DashStyle.Custom;\r
76                         t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);\r
77                         t.Graphics.DrawLine (p, 0, 0, 200, 200);\r
78                         t.Show ();\r
79                         Assert.IsTrue (t.Compare (10));\r
80                 }\r
81                 //The following tests DashOffset and DashPattern\r
82                 [Test]\r
83                 public void DashCustomStyle () {\r
84                         p.DashStyle = DashStyle.Custom;\r
85                         p.Width = 10;\r
86                         Assert.AreEqual (new float [] {1F}, p.DashPattern);\r
87                         Assert.AreEqual (0F, p.DashOffset);\r
88 \r
89                         p.DashPattern = new float [] {2, 3, 1.15F, 0.05F};\r
90                         t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);\r
91                         t.Graphics.DrawLine (p, 0, 0, 200, 10);\r
92                         t.Show ();\r
93                         Assert.IsTrue (t.Compare (10));\r
94                         p.DashOffset = 10F;\r
95                         t.Graphics.DrawLine (p, 0, 50, 200, 50);\r
96                         t.Show ();\r
97                         Assert.IsTrue (t.Compare (10));\r
98                         p.DashPattern = new float [] {2, 3, 1.15F, 0.05F, 1.74321F};\r
99                         p.DashOffset = 10.2F;\r
100                         t.Graphics.DrawLine (p, 0, 100, 200, 90);\r
101                         t.Show ();\r
102                         Assert.IsTrue (t.Compare (10));\r
103                         p.DashPattern = new float [] {2, 3, 1.15F, 0.05F, 1.74321F};\r
104                         p.DashOffset = 10.2F;\r
105                         t.Graphics.DrawLine (p, 0, 100, 200, 90);\r
106                         t.Show ();\r
107                         Assert.IsTrue (t.Compare (10));\r
108                 }\r
109                 [Test]\r
110                 public void DashCapTest () {\r
111                         Assert.AreEqual (DashCap.Flat, p.DashCap);\r
112                         p.DashStyle = DashStyle.DashDot;\r
113                         t.Graphics.DrawLine (p, 0, 0, 200, 10);\r
114                         t.Show ();\r
115                         Assert.IsTrue (t.Compare (10));\r
116 \r
117                         p.DashCap = DashCap.Round;\r
118                         t.Graphics.DrawLine (p, 0, 50, 200, 61.7F);\r
119                         t.Show ();\r
120                         Assert.IsTrue (t.Compare (10));\r
121 \r
122                         p.DashCap = DashCap.Triangle;\r
123                         t.Graphics.DrawLine (p, 0F, 92.3F, 200F, 117.9F);\r
124                         t.Show ();\r
125                         Assert.IsTrue (t.Compare (10));\r
126                 }\r
127                 [Test]\r
128                 public void LineJoinTest () {\r
129                         Assert.AreEqual (LineJoin.Miter, p.LineJoin);\r
130                         Point [] points = new Point [] {\r
131                                                                                            new Point(40, 10), new Point (200, 11),\r
132                                                                                            new Point (100, 40)};\r
133                         t.Graphics.DrawPolygon (p, points);\r
134                         t.Graphics.DrawPolygon (Pens.White, points);\r
135                         t.Show ();\r
136                         Assert.IsTrue (t.Compare (10));\r
137 \r
138                         p.LineJoin = LineJoin.Bevel;\r
139                         points =new Point [] {\r
140                                                                          new Point(40, 70), new Point (200, 79),\r
141                                                                          new Point (100, 100)};\r
142                         t.Graphics.DrawPolygon (p, points);\r
143                         t.Graphics.DrawPolygon (Pens.White, points);\r
144                         t.Show ();\r
145                         Assert.IsTrue (t.Compare (35));\r
146 \r
147                         p.LineJoin = LineJoin.MiterClipped;\r
148                         points = new Point [] {\r
149                                                                           new Point(40, 120), new Point (200, 117),\r
150                                                                           new Point (80, 135)};\r
151                         t.Graphics.DrawPolygon (p, points);\r
152                         t.Graphics.DrawPolygon (Pens.White, points);\r
153                         t.Show ();\r
154                         Assert.IsTrue (t.Compare (50));\r
155 \r
156                         p.LineJoin = LineJoin.Round;\r
157                         points = new Point [] {\r
158                                                                           new Point(40, 170), new Point (200, 175),\r
159                                                                           new Point (100, 210)};\r
160                         t.Graphics.DrawPolygon (p, points);\r
161                         t.Graphics.DrawPolygon (Pens.White, points);\r
162                         t.Show ();\r
163                         Assert.IsTrue (t.Compare (60));\r
164                 }\r
165                 [Test]\r
166                 public void LineJoinTest_Miter () {\r
167                         p.LineJoin = LineJoin.Miter;\r
168                         Point [] points = new Point [] {\r
169                                                                                            new Point(200, 217), new Point (215, 55),\r
170                                                                                            new Point (230, 217)};\r
171                         t.Graphics.DrawLines (p, points);\r
172                         t.Graphics.DrawLines (Pens.White, points);\r
173                         t.Show ();\r
174                         Assert.IsTrue (t.Compare (10));\r
175 \r
176                         p.LineJoin = LineJoin.Miter;\r
177                         points = new Point [] {\r
178                                                                           new Point(140, 217), new Point (155, 75),\r
179                                                                           new Point (170, 217)};\r
180                         t.Graphics.DrawLines (p, points);\r
181                         t.Graphics.DrawLines (Pens.White, points);\r
182                         t.Show ();\r
183                         Assert.IsTrue (t.Compare (10));\r
184 \r
185                         p.LineJoin = LineJoin.Miter;\r
186                         points = new Point [] {\r
187                                                                           new Point(100, 217), new Point (105, 100),\r
188                                                                           new Point (110, 217)};\r
189                         t.Graphics.DrawLines (p, points);\r
190                         t.Graphics.DrawLines (Pens.White, points);\r
191                         t.Show ();\r
192                         Assert.IsTrue (t.Compare (10));\r
193 \r
194                         p.LineJoin = LineJoin.Miter;\r
195                         points = new Point [] {\r
196                                                                           new Point(43, 210), new Point (70, 100),\r
197                                                                           new Point (80, 20)};\r
198                         t.Graphics.DrawLines (p, points);\r
199                         t.Graphics.DrawLines (Pens.White, points);\r
200                         t.Show ();\r
201                         Assert.IsTrue (t.Compare (10));\r
202                 }\r
203                 [Test]\r
204                 public void LineJoinTest_MiterClipped () {\r
205                         p.LineJoin = LineJoin.MiterClipped;\r
206                         Point [] points = new Point [] {\r
207                                                                                            new Point(200, 217), new Point (215, 55),\r
208                                                                                            new Point (230, 217)};\r
209                         t.Graphics.DrawLines (p, points);\r
210                         t.Graphics.DrawLines (Pens.White, points);\r
211                         t.Show ();\r
212                         Assert.IsTrue (t.Compare (10));\r
213 \r
214                         p.LineJoin = LineJoin.MiterClipped;\r
215                         points = new Point [] {\r
216                                                                           new Point(140, 217), new Point (155, 75),\r
217                                                                           new Point (170, 217)};\r
218                         t.Graphics.DrawLines (p, points);\r
219                         t.Graphics.DrawLines (Pens.White, points);\r
220                         t.Show ();\r
221                         Assert.IsTrue (t.Compare (10));\r
222 \r
223                         p.LineJoin = LineJoin.MiterClipped;\r
224                         points = new Point [] {\r
225                                                                           new Point(100, 217), new Point (105, 100),\r
226                                                                           new Point (110, 217)};\r
227                         t.Graphics.DrawLines (p, points);\r
228                         t.Graphics.DrawLines (Pens.White, points);\r
229                         t.Show ();\r
230                         Assert.IsTrue (t.Compare (10));\r
231 \r
232                         p.LineJoin = LineJoin.MiterClipped;\r
233                         points = new Point [] {\r
234                                                                           new Point(43, 210), new Point (70, 100),\r
235                                                                           new Point (80, 20)};\r
236                         t.Graphics.DrawLines (p, points);\r
237                         t.Graphics.DrawLines (Pens.White, points);\r
238                         t.Show ();\r
239                         Assert.IsTrue (t.Compare (10));\r
240                 }\r
241                 [Test]\r
242                 public void LineJoinTest_Bevel () {\r
243                         p.LineJoin = LineJoin.Bevel;\r
244                         Point [] points = new Point [] {\r
245                                                                                            new Point(200, 217), new Point (215, 55),\r
246                                                                                            new Point (230, 217)};\r
247                         t.Graphics.DrawLines (p, points);\r
248                         t.Graphics.DrawLines (Pens.White, points);\r
249                         t.Show ();\r
250                         Assert.IsTrue (t.Compare (10));\r
251 \r
252                         p.LineJoin = LineJoin.Bevel;\r
253                         points = new Point [] {\r
254                                                                           new Point(140, 217), new Point (155, 75),\r
255                                                                           new Point (170, 217)};\r
256                         t.Graphics.DrawLines (p, points);\r
257                         t.Graphics.DrawLines (Pens.White, points);\r
258                         t.Show ();\r
259                         Assert.IsTrue (t.Compare (10));\r
260 \r
261                         p.LineJoin = LineJoin.Bevel;\r
262                         points = new Point [] {\r
263                                                                           new Point(100, 217), new Point (105, 100),\r
264                                                                           new Point (110, 217)};\r
265                         t.Graphics.DrawLines (p, points);\r
266                         t.Graphics.DrawLines (Pens.White, points);\r
267                         t.Show ();\r
268                         Assert.IsTrue (t.Compare (10));\r
269 \r
270                         p.LineJoin = LineJoin.Bevel;\r
271                         points = new Point [] {\r
272                                                                           new Point(43, 210), new Point (70, 100),\r
273                                                                           new Point (80, 20)};\r
274                         t.Graphics.DrawLines (p, points);\r
275                         t.Graphics.DrawLines (Pens.White, points);\r
276                         t.Show ();\r
277                         Assert.IsTrue (t.Compare (10));\r
278 \r
279                         p.LineJoin = LineJoin.Bevel;\r
280                         points = new Point [] {\r
281                                                                           new Point(100, 50), new Point (150, 50),\r
282                                                                           new Point (150, 20), new Point (200, 20)};\r
283                         t.Graphics.DrawLines (p, points);\r
284                         t.Graphics.DrawLines (Pens.White, points);\r
285                         t.Show ();\r
286                         Assert.IsTrue (t.Compare (10));\r
287                 }\r
288                 [Test]\r
289                 public void PenAlignmentTest () {\r
290                         Point [] points = new Point [] {\r
291                                                                                            new Point (20, 20), new Point (40, 40), new Point (60, 20),\r
292                                                                                            new Point (60, 60), new Point (20, 60)};\r
293                         GraphicsPath path = new GraphicsPath ();\r
294                         path.AddPolygon (points);\r
295                         Matrix mx = new Matrix (1, 0, 0, 1, 90, 0);\r
296                         Matrix mrx = new Matrix (1, 0, 0, 1, -180, 0);\r
297                         Matrix my = new Matrix (1, 0, 0, 1, 0, 100);\r
298                                                 \r
299                         Assert.AreEqual (PenAlignment.Center, p.Alignment);\r
300                         t.Graphics.DrawPath (p, path);\r
301                         t.Graphics.DrawPath (Pens.White, path);\r
302                         t.Show ();\r
303                         Assert.IsTrue (t.Compare (10));\r
304 \r
305                         p.Alignment = PenAlignment.Left;\r
306                         path.Transform (mx);\r
307                         t.Graphics.DrawPath (p, path);\r
308                         t.Graphics.DrawPath (Pens.White, path);\r
309                         t.Show ();\r
310                         Assert.IsTrue (t.Compare (10));\r
311 \r
312                         p.Alignment = PenAlignment.Inset;\r
313                         path.Transform (mx);\r
314                         t.Graphics.DrawPath (p, path);\r
315                         t.Graphics.DrawPath (Pens.White, path);\r
316                         t.Show ();\r
317                         Assert.IsTrue (t.Compare (10));\r
318 \r
319                         p.Alignment = PenAlignment.Outset;\r
320                         path.Transform (mrx);\r
321                         path.Transform (my);\r
322                         t.Graphics.DrawPath (p, path);\r
323                         t.Graphics.DrawPath (Pens.White, path);\r
324                         t.Show ();\r
325                         Assert.IsTrue (t.Compare (10));\r
326 \r
327                         p.Alignment = PenAlignment.Right;\r
328                         path.Transform (mx);\r
329                         t.Graphics.DrawPath (p, path);\r
330                         t.Graphics.DrawPath (Pens.White, path);\r
331                         t.Show ();\r
332                         Assert.IsTrue (t.Compare (10));\r
333                 }\r
334                 [Test]\r
335                 public void ColorTest () {\r
336                         Assert.AreEqual (Color.Blue, p.Color);\r
337                         t.Graphics.DrawLine (p, 0, 0, 200, 200);\r
338                         t.Show ();\r
339                         Assert.IsTrue (t.Compare (10));\r
340 \r
341                         p.Color = Color.Red;\r
342                         t.Graphics.DrawLine (p, 0, 0, 200, 200);\r
343                         t.Show ();\r
344                         Assert.IsTrue (t.Compare (10));\r
345 \r
346                         p.Color = Color.BurlyWood;\r
347                         t.Graphics.DrawLine (p, 0, 0, 200, 200);\r
348                         t.Show ();\r
349                         Assert.IsTrue (t.Compare (10));\r
350 \r
351                         p.Color = Color.FromArgb (100, 120, 255);\r
352                         t.Graphics.DrawLine (p, 0, 0, 200, 200);\r
353                         t.Show ();\r
354                         Assert.IsTrue (t.Compare (10));\r
355 \r
356                         p.Color = Color.FromArgb (128, Color.White);\r
357                         t.Graphics.DrawLine (p, 0, 200, 200, 0);\r
358                         t.Show ();\r
359                         Assert.IsTrue (t.Compare (10));\r
360                 }\r
361                 [Test]\r
362                 public void MitterLimit () {\r
363                         p.LineJoin = LineJoin.MiterClipped;\r
364                         Point [] points = new Point [] {new Point (0,30), new Point (180, 31),\r
365                                                                                            new Point (0, 90)};\r
366 \r
367                         Assert.AreEqual (10F, p.MiterLimit);\r
368                         t.Graphics.DrawLines (p, points);\r
369                         t.Graphics.DrawLines (Pens.White, points);\r
370                         t.Show ();\r
371                         Assert.IsTrue (t.Compare (10));\r
372 \r
373                         Matrix dy = new Matrix (1, 0, 0, 1, 0, 110);\r
374                         dy.TransformPoints (points);\r
375                         p.MiterLimit=1F;\r
376                         t.Graphics.DrawLines (p, points);\r
377                         t.Graphics.DrawLines (Pens.White, points);\r
378                         t.Show ();\r
379                         Assert.IsTrue (t.Compare (10));\r
380                 }\r
381                 [Test]\r
382                 public void Transform () {\r
383                         p.ScaleTransform (0.5F, 2);\r
384                         t.Graphics.DrawArc (p, 0, 0, 100, 100, 0, 360);\r
385                         t.Graphics.DrawArc (Pens.White, 0, 0, 100, 100, 0, 360);\r
386                         t.Show ();\r
387                 }\r
388                 [Test]\r
389                 [Category ("Extended")]\r
390                 public void StartCap() {\r
391                         Assert.AreEqual(LineCap.Flat, p.StartCap);\r
392 \r
393                         int x = 20;\r
394                         int y = 20;\r
395                         p.StartCap = LineCap.Flat;\r
396                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
397                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
398                         t.Show ();\r
399                         Assert.IsTrue (t.Compare (10));\r
400 \r
401                         y += 30;\r
402                         p.StartCap = LineCap.Round;\r
403                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
404                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
405                         t.Show ();\r
406                         Assert.IsTrue (t.Compare (10));\r
407 \r
408                         y += 30;\r
409                         p.StartCap = LineCap.Square;\r
410                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
411                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
412                         t.Show ();\r
413                         Assert.IsTrue (t.Compare (10));\r
414 \r
415                         y += 30;\r
416                         p.StartCap = LineCap.AnchorMask;\r
417                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
418                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
419                         t.Show ();\r
420                         Assert.IsTrue (t.Compare (10));\r
421 \r
422                         y += 30;\r
423                         p.StartCap = LineCap.ArrowAnchor;\r
424                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
425                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
426                         t.Show ();\r
427                         Assert.IsTrue (t.Compare (10));\r
428 \r
429                         y += 30;\r
430                         p.StartCap = LineCap.DiamondAnchor;\r
431                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
432                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
433                         t.Show ();\r
434                         Assert.IsTrue (t.Compare (10));\r
435 \r
436                         y += 30;\r
437                         p.StartCap = LineCap.NoAnchor;\r
438                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
439                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
440                         t.Show ();\r
441                         Assert.IsTrue (t.Compare (10));\r
442 \r
443                         y = 20;\r
444                         x += 140;\r
445 \r
446                         p.StartCap = LineCap.RoundAnchor;\r
447                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
448                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
449                         t.Show ();\r
450                         Assert.IsTrue (t.Compare (10));\r
451 \r
452                         y += 30;\r
453                         p.StartCap = LineCap.SquareAnchor;\r
454                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
455                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
456                         t.Show ();\r
457                         Assert.IsTrue (t.Compare (10));\r
458 \r
459                         y += 30;\r
460                         p.StartCap = LineCap.Triangle;\r
461                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
462                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
463                         t.Show ();\r
464                         Assert.IsTrue (t.Compare (10));\r
465 \r
466                         y += 30;\r
467                         p.StartCap = LineCap.Custom;\r
468                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
469                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
470                         t.Show ();\r
471                         Assert.IsTrue (t.Compare (10));\r
472 \r
473                 }\r
474                 [Test]\r
475                 [Category ("Extended")]\r
476                 public void EndCap() {\r
477                         Assert.AreEqual(LineCap.Flat, p.EndCap);\r
478 \r
479                         int x = 20;\r
480                         int y = 20;\r
481                         p.EndCap = LineCap.Flat;\r
482                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
483                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
484                         t.Show ();\r
485                         Assert.IsTrue (t.Compare (10));\r
486 \r
487                         y += 30;\r
488                         p.EndCap = LineCap.Round;\r
489                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
490                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
491                         t.Show ();\r
492                         Assert.IsTrue (t.Compare (10));\r
493 \r
494                         y += 30;\r
495                         p.EndCap = LineCap.Square;\r
496                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
497                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
498                         t.Show ();\r
499                         Assert.IsTrue (t.Compare (10));\r
500 \r
501                         y += 30;\r
502                         p.EndCap = LineCap.AnchorMask;\r
503                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
504                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
505                         t.Show ();\r
506                         Assert.IsTrue (t.Compare (10));\r
507 \r
508                         y += 30;\r
509                         p.EndCap = LineCap.ArrowAnchor;\r
510                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
511                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
512                         t.Show ();\r
513                         Assert.IsTrue (t.Compare (10));\r
514 \r
515                         y += 30;\r
516                         p.EndCap = LineCap.DiamondAnchor;\r
517                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
518                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
519                         t.Show ();\r
520                         Assert.IsTrue (t.Compare (10));\r
521 \r
522                         y += 30;\r
523                         p.EndCap = LineCap.NoAnchor;\r
524                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
525                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
526                         t.Show ();\r
527                         Assert.IsTrue (t.Compare (10));\r
528 \r
529                         y = 20;\r
530                         x += 120;\r
531 \r
532                         p.EndCap = LineCap.RoundAnchor;\r
533                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
534                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
535                         t.Show ();\r
536                         Assert.IsTrue (t.Compare (10));\r
537 \r
538                         y += 30;\r
539                         p.EndCap = LineCap.SquareAnchor;\r
540                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
541                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
542                         t.Show ();\r
543                         Assert.IsTrue (t.Compare (10));\r
544 \r
545                         y += 30;\r
546                         p.EndCap = LineCap.Triangle;\r
547                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
548                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
549                         t.Show ();\r
550                         Assert.IsTrue (t.Compare (10));\r
551 \r
552                         y += 30;\r
553                         p.EndCap = LineCap.Custom;\r
554                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
555                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
556                         t.Show ();\r
557                         Assert.IsTrue (t.Compare (10));\r
558 \r
559                 }\r
560                 [Test]\r
561                 public void StartEndCapBasic() {\r
562                         Assert.AreEqual(LineCap.Flat, p.StartCap);\r
563 \r
564                         p.Width = 21;\r
565 \r
566                         int x = 20;\r
567                         int y = 20;\r
568                         p.EndCap = LineCap.Flat;\r
569                         p.StartCap = LineCap.Flat;\r
570                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
571                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
572                         t.Show ();\r
573                         Assert.IsTrue (t.Compare (10));\r
574 \r
575                         y += 50;\r
576                         p.EndCap = LineCap.Round;\r
577                         p.StartCap = LineCap.Round;\r
578                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
579                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
580                         t.Show ();\r
581                         Assert.IsTrue (t.Compare (40));\r
582 \r
583                         y += 50;\r
584                         p.EndCap = LineCap.Square;\r
585                         p.StartCap = LineCap.Square;\r
586                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
587                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
588                         t.Show ();\r
589                         Assert.IsTrue (t.Compare (50));\r
590 \r
591                         y += 50;\r
592                         p.EndCap = LineCap.Round;\r
593                         p.StartCap = LineCap.Round;\r
594                         p.DashCap = DashCap.Round;\r
595                         p.Width = 15;\r
596                         p.DashStyle = DashStyle.DashDotDot;\r
597                         t.Graphics.DrawLine (p, x, y, x+200, y);\r
598                         t.Graphics.DrawLine (Pens.White, x, y, x+200, y);\r
599                         t.Show ();\r
600                         Assert.IsTrue (t.Compare (10));\r
601                 }\r
602                 [Test]\r
603                 public void SetLineCap() {\r
604                         Assert.AreEqual(LineCap.Flat, p.StartCap);\r
605 \r
606                         p.Width = 21;\r
607 \r
608                         int x = 20;\r
609                         int y = 20;\r
610                         p.SetLineCap(LineCap.Flat, LineCap.Flat, DashCap.Flat);\r
611                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
612                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
613                         t.Show ();\r
614                         Assert.IsTrue (t.Compare (10));\r
615 \r
616                         y += 50;\r
617                         p.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);\r
618                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
619                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
620                         t.Show ();\r
621                         Assert.IsTrue (t.Compare (10));\r
622 \r
623                         y += 50;\r
624                         p.SetLineCap(LineCap.Square, LineCap.Square, DashCap.Flat);\r
625                         t.Graphics.DrawLine (p, x, y, x+80, y);\r
626                         t.Graphics.DrawLine (Pens.White, x, y, x+80, y);\r
627                         t.Show ();\r
628                         Assert.IsTrue (t.Compare (10));\r
629                 }\r
630         }\r
631 }\r