2 // Test.System.Drawing.Graphics.cs
\r
5 // Konstantin Triger <kostat@mainsoft.com>
\r
9 // Copyright (C) 2005 Mainsoft, Corp (http://www.mainsoft.com)
\r
11 // Permission is hereby granted, free of charge, to any person obtaining
\r
12 // a copy of this software and associated documentation files (the
\r
13 // "Software"), to deal in the Software without restriction, including
\r
14 // without limitation the rights to use, copy, modify, merge, publish,
\r
15 // distribute, sublicense, and/or sell copies of the Software, and to
\r
16 // permit persons to whom the Software is furnished to do so, subject to
\r
17 // the following conditions:
\r
19 // The above copyright notice and this permission notice shall be
\r
20 // included in all copies or substantial portions of the Software.
\r
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\r
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
\r
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
\r
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
\r
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
32 using System.Collections;
\r
33 using System.Diagnostics;
\r
34 using NUnit.Framework;
\r
35 using System.Drawing;
\r
36 using System.Drawing.Drawing2D;
\r
37 using System.Drawing.Text;
\r
38 using System.Drawing.Imaging;
\r
39 using DrawingTestHelper;
\r
42 namespace Test.Sys.Drawing.GraphicsFixtures {
\r
43 #region GraphicsFixtureProps
\r
46 public class GraphicsFixtureProps {
\r
48 protected DrawingTest t;
\r
49 const int TOLERANCE = 3; //in %
\r
52 public void SetUp() {
\r
53 t = DrawingTest.Create(512, 512);
\r
57 public void TearDown ()
\r
64 public void ClipTest_1() {
\r
65 Region r = new Region();
\r
66 Assert.That(r.Equals(t.Graphics.Clip, t.Graphics), Is.True);
\r
70 public void ClipTest_2() {
\r
71 Region r = new Region(new Rectangle(10, 10, 60, 60));
\r
72 t.Graphics.Clip = r;
\r
73 Assert.That(r.Equals(t.Graphics.Clip, t.Graphics), Is.True);
\r
75 Pen redPen = new Pen(Color.Red, 3);
\r
76 Pen greenPen = new Pen(Color.Green, 3);
\r
77 // Create points that define curve.
\r
78 Point point1 = new Point( 50, 50);
\r
79 Point point2 = new Point(100, 25);
\r
80 Point point3 = new Point(200, 5);
\r
81 Point point4 = new Point(250, 50);
\r
82 Point point5 = new Point(300, 100);
\r
83 Point point6 = new Point(350, 200);
\r
84 Point point7 = new Point(250, 250);
\r
85 Point[] curvePoints = {
\r
94 // Draw lines between original points to screen.
\r
95 t.Graphics.DrawLines(redPen, curvePoints);
\r
97 Assert.That(t.PDCompare(TOLERANCE), Is.True);
\r
101 public void ClipTest_3() {
\r
102 t.Graphics.TranslateTransform(3, 3);
\r
103 t.Graphics.SetClip(new Rectangle(23, 24, 30, 40));
\r
105 RectangleF cb = t.Graphics.VisibleClipBounds;
\r
106 DrawingTest.AssertAlmostEqual(23, cb.X);
\r
107 DrawingTest.AssertAlmostEqual(24, cb.Y);
\r
108 DrawingTest.AssertAlmostEqual(30, cb.Width);
\r
109 DrawingTest.AssertAlmostEqual(40, cb.Height);
\r
111 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
113 t.Graphics.RotateTransform(128);
\r
115 t.Graphics.TranslateTransform(14, 14);
\r
116 t.Graphics.ExcludeClip(new Rectangle(0, 0, 4, 60));
\r
119 t.Graphics.RotateTransform(128);
\r
121 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
123 t.Graphics.TranslateClip(5.2f, 3.1f);
\r
125 t.Graphics.ResetTransform();
\r
126 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
128 cb = t.Graphics.VisibleClipBounds;
\r
129 DrawingTest.AssertAlmostEqual(28, cb.X);
\r
130 DrawingTest.AssertAlmostEqual(22, cb.Y);
\r
131 DrawingTest.AssertAlmostEqual(30, cb.Width);
\r
132 DrawingTest.AssertAlmostEqual(40, cb.Height);
\r
134 t.Graphics.ScaleTransform(5, 7);
\r
135 t.Graphics.IntersectClip(new Rectangle(7, 4, 20, 20));
\r
137 cb = t.Graphics.VisibleClipBounds;
\r
138 DrawingTest.AssertAlmostEqual(7, cb.X);
\r
139 DrawingTest.AssertAlmostEqual(4f, cb.Y);
\r
140 DrawingTest.AssertAlmostEqual(4.6f, cb.Width);
\r
141 DrawingTest.AssertAlmostEqual(4.85714245f, cb.Height);
\r
145 public void ClipBoundsTest() {
\r
146 Region r = new Region();
\r
147 Assert.That(t.Graphics.ClipBounds.Equals(r.GetBounds(t.Graphics)), Is.True);
\r
149 RectangleF rf = new RectangleF(10, 10, 60, 60);
\r
150 r = new Region(rf);
\r
151 t.Graphics.Clip = r;
\r
152 Assert.That(rf.Equals(t.Graphics.ClipBounds), Is.True);
\r
156 public void CompositingModeTest() {
\r
157 //TODO: seems to draw equal images
\r
158 Assert.That (CompositingMode.SourceOver, Is.EqualTo (t.Graphics.CompositingMode));
\r
160 Bitmap b = new Bitmap(100, 100);
\r
161 Graphics g = Graphics.FromImage(b);
\r
163 Color c = Color.FromArgb(100, Color.Red);
\r
165 Brush redBrush = new SolidBrush(c);
\r
166 g.FillEllipse(redBrush, 5, 6, 100, 200);
\r
167 //t.Graphics.FillEllipse(redBrush, 5, 6, 100, 200);
\r
168 t.Graphics.DrawImage(b, 10, 10);
\r
172 t.Graphics.CompositingMode = CompositingMode.SourceCopy;
\r
174 t.Graphics.DrawImage(b, 300, 300);
\r
177 Assert.That(t.PDCompare(TOLERANCE), Is.True);
\r
181 public void CompositingQualityTest() {
\r
185 public void DpiXTest() {
\r
186 Assert.That(t.Graphics.DpiX == 96f, Is.True);
\r
190 public void DpiYTest() {
\r
191 Assert.That(t.Graphics.DpiY == 96f, Is.True);
\r
195 public void InterpolationModeTest() {
\r
196 Assert.That (InterpolationMode.Bilinear, Is.EqualTo (t.Graphics.InterpolationMode));
\r
200 public void IsClipEmtpyTest() {
\r
201 Assert.That (t.Graphics.IsClipEmpty, Is.False);
\r
204 t.Graphics.Clip = null;
\r
205 Assert.Fail("The ArgumentNullException was not thrown");
\r
207 catch(Exception e) {
\r
208 Assert.That (e.GetType(), Is.EqualTo (typeof(ArgumentNullException)));
\r
211 Region r = new Region(new Rectangle(10, 10, 0, 0));
\r
212 t.Graphics.Clip = r;
\r
214 Assert.That( t.Graphics.IsClipEmpty, Is.True);
\r
218 public void IsVisibleClipEmtpyTest() {
\r
219 Assert.That (t.Graphics.IsVisibleClipEmpty, Is.False, "default t.Graphics.IsVisibleClipEmpty");
\r
221 Region r = new Region(new Rectangle(512, 512, 100, 100));
\r
222 t.Graphics.Clip = r;
\r
223 Assert.That (t.Graphics.IsClipEmpty, Is.False);
\r
224 Assert.That(t.Graphics.IsVisibleClipEmpty, Is.True);
\r
228 public void PageScaleTest() {
\r
229 Assert.That (1f, Is.EqualTo (t.Graphics.PageScale));
\r
233 public void PageUnitTest() {
\r
234 Assert.That (GraphicsUnit.Display, Is.EqualTo (t.Graphics.PageUnit));
\r
238 public void PixelOffsetModeTest() {
\r
239 Assert.That (PixelOffsetMode.Default, Is.EqualTo (t.Graphics.PixelOffsetMode));
\r
243 [Category("NotWorking")]
\r
244 public void RenderingOriginTest() {
\r
245 Assert.That (new Point(0,0), Is.EqualTo (t.Graphics.RenderingOrigin));
\r
249 public void SmoothingModeTest() {
\r
250 Assert.That (SmoothingMode.None, Is.EqualTo (t.Graphics.SmoothingMode));
\r
254 public void TextContrastTest() {
\r
255 Assert.That (4, Is.EqualTo (t.Graphics.TextContrast));
\r
259 public void TextRenderingHintTest() {
\r
260 Assert.That (TextRenderingHint.SystemDefault, Is.EqualTo (t.Graphics.TextRenderingHint));
\r
264 public void TransformTest() {
\r
265 Assert.That (new Matrix(), Is.EqualTo (t.Graphics.Transform));
\r
269 public void VisibleClipBoundsTest() {
\r
270 Assert.That (new RectangleF(0, 0, 512, 512), Is.EqualTo (t.Graphics.VisibleClipBounds));
\r
278 public class DrawImage {
\r
279 protected DrawingTest t;
\r
280 protected int TOLERANCE = 10; //in %;
\r
281 protected Hashtable st = new Hashtable();
\r
283 Rectangle src = new Rectangle(0, 0, 50, 50);
\r
284 RectangleF srcF = new Rectangle(0, 0, 50, 50);
\r
285 Rectangle dst = new Rectangle(170, 170, 100, 100);
\r
286 RectangleF dstF = new Rectangle(270, 270, 100, 100);
\r
292 public virtual void SetUp() {
\r
293 SetUp("DrawImage");
\r
294 DrawingTest.ShowForms = false;
\r
296 bmp = Bitmap.FromFile("bitmap50.png");
\r
297 bmp2 = Bitmap.FromFile("bitmap25.png");
\r
299 catch(Exception e) {
\r
300 Console.WriteLine(e.Message);
\r
303 public virtual void SetUp(string ownerClass) {
\r
304 t = DrawingTest.Create(512, 512, ownerClass);
\r
305 t.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
\r
307 // hashtable of differents tolerance values for specified tests.
\r
310 public void TearDown() {
\r
316 public void DrawImage1() {
\r
317 t.Graphics.DrawImage(bmp, new Point[]{new Point(170,10), new Point(250,0), new Point(100,100)}, src, GraphicsUnit.Pixel );
\r
318 t.Graphics.DrawImage(bmp, new PointF[]{new PointF(70,10), new PointF(150,0), new PointF(10,100)}, srcF, GraphicsUnit.Pixel );
\r
320 Assert.That(t.Compare(), Is.True);
\r
323 public void DrawImage2() {
\r
324 t.Graphics.DrawImage(bmp, dst, src, GraphicsUnit.Pixel);
\r
325 t.Graphics.DrawImage(bmp, dstF, srcF, GraphicsUnit.Pixel);
\r
327 Assert.That(t.Compare(), Is.True);
\r
330 public void DrawImage3() {
\r
331 t.Graphics.DrawImage(bmp, 10.0F, 10.0F, srcF, GraphicsUnit.Pixel);
\r
332 t.Graphics.DrawImage(bmp, 70.0F, 150.0F, 250.0F, 150.0F);
\r
334 Assert.That(t.Compare(), Is.True);
\r
337 public void DrawImage4() {
\r
338 t.Graphics.DrawImage(bmp, dst);
\r
339 t.Graphics.DrawImage(bmp, dstF);
\r
341 Assert.That(t.Compare(), Is.True);
\r
344 public void DrawImage5() {
\r
345 t.Graphics.SetClip( new Rectangle(70, 0, 20, 200));
\r
346 t.Graphics.DrawImage(bmp, new Point[]{new Point(50,50), new Point(250,30), new Point(100,150)}, src, GraphicsUnit.Pixel );
\r
348 Assert.That(t.Compare(), Is.True);
\r
351 public void DrawImage6() {
\r
352 t.Graphics.ScaleTransform(2, 2);
\r
353 t.Graphics.SetClip( new Rectangle(70, 0, 20, 200));
\r
354 t.Graphics.DrawImage(bmp, new Point[]{new Point(50,50), new Point(250,30), new Point(100,150)}, src, GraphicsUnit.Pixel );
\r
356 Assert.That(t.Compare(), Is.True);
\r
359 public void DrawImage7() {
\r
360 t.Graphics.DrawImage(bmp, 170, 70, src, GraphicsUnit.Pixel);
\r
361 t.Graphics.DrawImage(bmp, 70, 350, 350, 150);
\r
363 Assert.That(t.Compare(), Is.True);
\r
366 public void DrawImage8() {
\r
367 t.Graphics.DrawImage(bmp, new Point[]{new Point(170,10), new Point(250,10), new Point(100,100)} );
\r
368 t.Graphics.DrawImage(bmp, new PointF[]{new PointF(170,100), new PointF(250,100), new PointF(100,190)} );
\r
370 Assert.That(t.Compare(), Is.True);
\r
373 public void DrawImage9() {
\r
374 t.Graphics.DrawImage(bmp, 0, 0);
\r
375 t.Graphics.DrawImage(bmp, 200, 200);
\r
377 Assert.That(t.Compare(), Is.True);
\r
380 public void DrawImagePageUnit() {
\r
381 t.Graphics.PageUnit = GraphicsUnit.Document;
\r
382 Point [] p = new Point[]{
\r
383 new Point(100, 100),
\r
384 new Point(200, 100),
\r
388 t.Graphics.DrawImage(bmp2, p, new Rectangle(100, 100, 100, 100), GraphicsUnit.Pixel);
\r
390 Assert.That(t.Compare(), Is.True);
\r
393 public void DrawImagePageUnit_2() {
\r
394 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
395 t.Graphics.ScaleTransform(0.3f, 0.3f);
\r
396 Point [] p = new Point[]{
\r
397 new Point(100, 100),
\r
398 new Point(200, 100),
\r
402 t.Graphics.DrawImage(bmp2, p, new Rectangle(100, 100, 100, 100), GraphicsUnit.Pixel);
\r
404 Assert.That(t.Compare(), Is.True);
\r
407 public void DrawImagePageUnit_3() {
\r
408 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
409 t.Graphics.ScaleTransform(0.3f, 0.3f);
\r
410 t.Graphics.DrawImage(bmp2, new Rectangle(100, 100, 100, 100));
\r
412 Assert.That(t.Compare(), Is.True);
\r
415 public void DrawImagePageUnit_4() {
\r
416 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
417 t.Graphics.ScaleTransform(0.5f, 0.5f);
\r
418 t.Graphics.DrawImage(bmp, 50, 50);
\r
420 Assert.That(t.Compare(), Is.True);
\r
423 public void DrawImagePageUnitClip() {
\r
424 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
425 t.Graphics.ScaleTransform(0.3f, 0.3f);
\r
426 Point [] p = new Point[]{
\r
427 new Point(100, 100),
\r
428 new Point(200, 100),
\r
432 t.Graphics.SetClip( new Rectangle(120, 120, 50, 100) );
\r
433 t.Graphics.DrawImage(bmp2, p, new Rectangle(100, 100, 100, 100), GraphicsUnit.Pixel);
\r
435 Assert.That(t.Compare(), Is.True);
\r
438 public void DrawImageWithResolution() {
\r
439 t.Graphics.DrawImage(bmp2, 0, 0);
\r
441 Assert.That(t.Compare(), Is.True);
\r
444 public void DrawImageInContainer1() {
\r
445 t.Graphics.BeginContainer(new Rectangle(10, 10, 50, 50), new Rectangle(70, 70, 100, 100), GraphicsUnit.Pixel);
\r
446 t.Graphics.DrawImage(bmp, 0, 0);
\r
448 Assert.That(t.Compare(), Is.True);
\r
451 public void DrawImageInContainer2() {
\r
452 t.Graphics.BeginContainer(new Rectangle(10, 10, 50, 50), new Rectangle(70, 70, 100, 100), GraphicsUnit.Pixel);
\r
453 t.Graphics.DrawImage(bmp2, 0, 0);
\r
455 Assert.That(t.Compare(), Is.True);
\r
458 public void DrawImageInContainer3() {
\r
459 t.Graphics.BeginContainer(new Rectangle(10, 10, 50, 50), new Rectangle(70, 70, 100, 100), GraphicsUnit.Pixel);
\r
460 t.Graphics.SetClip( new Rectangle(0, 0, 15, 15) );
\r
461 t.Graphics.ScaleTransform(0.5f, 0.5f);
\r
462 t.Graphics.DrawImage(bmp2, 0, 0);
\r
464 Assert.That(t.Compare(), Is.True);
\r
467 public void DrawImageInContainer4() {
\r
468 Point [] p = new Point[]{
\r
469 new Point(100, 100),
\r
470 new Point(200, 100),
\r
474 t.Graphics.SetClip( new Rectangle(70, 70, 70, 70) );
\r
475 GraphicsContainer c = t.Graphics.BeginContainer( new Rectangle(20, 20, 10, 10), new Rectangle(77, 77, 7, 7), GraphicsUnit.Pixel);
\r
476 t.Graphics.DrawImage(bmp2, p, new Rectangle(100, 100, 100, 100), GraphicsUnit.Pixel);
\r
477 t.Graphics.EndContainer( c );
\r
479 Assert.That(t.Compare(), Is.True);
\r
484 #region GraphicsFixtureFillModes
\r
486 public class GraphicsFixtureFillModes {
\r
487 protected DrawingTest t;
\r
488 protected int TOLERANCE = 3; //in %;
\r
491 public virtual void SetUp() {
\r
492 SetUp("GraphicsFixtureFillModes");
\r
494 public virtual void SetUp(string ownerClass) {
\r
495 t = DrawingTest.Create(512, 512, ownerClass);
\r
498 public void TearDown() {
\r
504 public void FillModeAlternate() {
\r
505 GraphicsPath p = new GraphicsPath();
\r
506 Assert.That (FillMode.Alternate, Is.EqualTo (p.FillMode));
\r
509 public void FillModeAlternate_1() {
\r
510 Point [] p = new Point[] {
\r
511 new Point(50, 100),
\r
513 new Point(90, 100),
\r
514 new Point(140, 10),
\r
515 new Point(150, 100),
\r
516 new Point(170, 10),
\r
520 GraphicsPath path = new GraphicsPath();
\r
521 path.AddLines( p );
\r
522 path.FillMode = FillMode.Alternate;
\r
523 t.Graphics.FillPath( Brushes.Blue, path );
\r
525 Assert.That(t.PDCompare(), Is.True);
\r
528 public void FillModeAlternate_2() {
\r
530 Rectangle r1 = new Rectangle(100, 100, 100, 100);
\r
531 Rectangle r2 = new Rectangle(125, 125, 50, 50);
\r
532 GraphicsPath path = new GraphicsPath();
\r
533 path.AddRectangle( r1 );
\r
534 path.AddRectangle( r2 );
\r
535 path.FillMode = FillMode.Alternate;
\r
536 t.Graphics.FillPath( Brushes.Blue, path );
\r
538 Assert.That(t.PDCompare(), Is.True);
\r
541 public void FillModeAlternate_3() {
\r
542 Point [] p = new Point[] {
\r
543 new Point(50, 100),
\r
544 new Point(150, 50),
\r
545 new Point(250, 100),
\r
547 new Point(250, 50),
\r
551 GraphicsPath path = new GraphicsPath();
\r
552 path.AddLines( p );
\r
553 path.FillMode = FillMode.Alternate;
\r
554 t.Graphics.FillPath( Brushes.Blue, path );
\r
556 Assert.That(t.PDCompare(), Is.True);
\r
559 public void FillModeWinding_1() {
\r
560 Point [] p = new Point[] {
\r
561 new Point(50, 100),
\r
563 new Point(90, 100),
\r
564 new Point(140, 10),
\r
565 new Point(150, 100),
\r
566 new Point(170, 10),
\r
570 GraphicsPath path = new GraphicsPath();
\r
571 path.AddLines( p );
\r
572 path.FillMode = FillMode.Winding;
\r
573 t.Graphics.FillPath( Brushes.Blue, path );
\r
575 Assert.That(t.PDCompare(), Is.True);
\r
578 public void FillModeWinding_2() {
\r
580 Rectangle r1 = new Rectangle(100, 100, 100, 100);
\r
581 Rectangle r2 = new Rectangle(125, 125, 50, 50);
\r
582 GraphicsPath path = new GraphicsPath();
\r
583 path.AddRectangle( r1 );
\r
584 path.AddRectangle( r2 );
\r
585 path.FillMode = FillMode.Winding;
\r
586 t.Graphics.FillPath( Brushes.Blue, path );
\r
588 Assert.That(t.PDCompare(), Is.True);
\r
591 public void FillModeWinding_3() {
\r
592 Point [] p = new Point[] {
\r
593 new Point(50, 100),
\r
594 new Point(150, 50),
\r
595 new Point(250, 100),
\r
597 new Point(250, 50),
\r
601 GraphicsPath path = new GraphicsPath();
\r
602 path.AddLines( p );
\r
603 path.FillMode = FillMode.Winding;
\r
604 t.Graphics.FillPath( Brushes.Blue, path );
\r
606 Assert.That(t.PDCompare(), Is.True);
\r
613 #region GraphicsFixture
\r
615 /// Summary description for Graphics.
\r
618 public class GraphicsFixture {
\r
619 protected DrawingTest t;
\r
620 protected int TOLERANCE = 3; //in %;
\r
621 protected Hashtable st = new Hashtable();
\r
624 public virtual void SetUp() {
\r
625 SetUp("GraphicsFixture");
\r
627 public virtual void SetUp(string ownerClass) {
\r
628 t = DrawingTest.Create(512, 512, ownerClass);
\r
630 // hashtable of differents tolerance values for specified tests. (for fft comparer)
\r
631 st["DrawArcTest:6"] = TOLERANCE * 2.5f;
\r
632 st["DrawCurveTestF:4"] = TOLERANCE * 2f;
\r
633 st["DrawPolygonPoint:2"] = TOLERANCE * 2f;
\r
634 st["DrawPolygonPointF:2"] = TOLERANCE * 2f;
\r
635 st["DrawStringFloatFormat:2"] = TOLERANCE * 2f; // in .net the font is shmoothed
\r
636 st["DrawStringFloatFormat:4"] = TOLERANCE * 2.5f; // in .net the font is shmoothed
\r
637 st["DrawStringFloatFormat:6"] = TOLERANCE * 2.5f; // in .net the font is shmoothed
\r
638 st["RotateTransformAngleMatrixOrder1:2"] = TOLERANCE * 2f; // Line width problem
\r
639 st["ScaleTransformFloatMatrixOrder:2"] = TOLERANCE * 2f; // Line width problem
\r
640 st["TranslateTransformAngleMatrixOrder:2"] = TOLERANCE * 2f; // Line width problem
\r
641 t.SpecialTolerance = st;
\r
645 public void TearDown ()
\r
652 public virtual void BeginContainerTest() {
\r
653 // Define transformation for container.
\r
654 RectangleF srcRect = new RectangleF(0.0F, 0.0F, 200.0F, 200.0F);
\r
655 RectangleF destRect = new RectangleF(100.0F, 100.0F, 150.0F, 150.0F);
\r
656 // Begin graphics container.
\r
657 GraphicsContainer containerState = t.Graphics.BeginContainer(
\r
659 GraphicsUnit.Pixel);
\r
660 // Fill red rectangle in container.
\r
661 t.Graphics.FillRectangle(new SolidBrush(Color.Red), 0.0F, 0.0F, 200.0F, 200.0F);
\r
663 // End graphics container.
\r
664 t.Graphics.EndContainer(containerState);
\r
665 // Fill untransformed rectangle with green.
\r
666 t.Graphics.FillRectangle(new SolidBrush(Color.Green), 0.0F, 0.0F, 200.0F, 200.0F);
\r
668 Assert.That(t.PDCompare(), Is.True);
\r
672 public void MeasureString () {
\r
673 Bitmap bmp = new Bitmap (400, 300, PixelFormat.Format32bppArgb);
\r
674 Graphics graphics = Graphics.FromImage (bmp);
\r
675 graphics.PageUnit = GraphicsUnit.Point;
\r
677 string drawString = "Sample Text in points";
\r
678 Font drawFont = new Font ("Arial Black", 70, FontStyle.Regular);
\r
679 SolidBrush drawBrush = new SolidBrush (Color.Blue);
\r
681 float netWidth1 = 836.1719f;
\r
682 float netWidth2 = 1114.896f;
\r
683 float netHeight1 = 98.71094f;
\r
684 float netHeight2 = 131.6146f;
\r
686 SizeF size = graphics.MeasureString (drawString, drawFont, new PointF (0, 0), StringFormat.GenericTypographic);
\r
688 Assert.That (Math.Abs (size.Width - netWidth1) / netWidth1 < 0.01, Is.True);
\r
689 Assert.That (Math.Abs (size.Height - netHeight1) / netHeight1 < 0.01, Is.True);
\r
691 graphics.PageUnit = GraphicsUnit.Pixel;
\r
692 size = graphics.MeasureString (drawString, drawFont, new PointF (0, 0), StringFormat.GenericTypographic);
\r
694 Assert.That (Math.Abs (size.Width - netWidth2) / netWidth2 < 0.01, Is.True);
\r
695 Assert.That (Math.Abs (size.Height - netHeight2) / netHeight2 < 0.01, Is.True);
\r
699 public virtual void BeginContainerTest_2() {
\r
700 t.Graphics.DrawRectangle( Pens.Black, new Rectangle(70, 70, 50, 100) );
\r
701 t.Graphics.DrawRectangle( Pens.Black, new Rectangle(50, 100, 150, 50) );
\r
702 t.Graphics.DrawRectangle( Pens.Black, new Rectangle(80, 120, 10, 10) );
\r
704 t.Graphics.SetClip( new Rectangle(70, 70, 50, 100) );
\r
705 t.Graphics.Clear( Color.Blue );
\r
707 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
708 t.Graphics.SetClip( new Rectangle(50, 100, 150, 50) );
\r
709 t.Graphics.Clear( Color.Green );
\r
711 GraphicsContainer c2 = t.Graphics.BeginContainer();
\r
712 t.Graphics.SetClip( new Rectangle(80, 120, 10, 10) );
\r
713 t.Graphics.Clear( Color.Red );
\r
715 t.Graphics.EndContainer( c2 );
\r
716 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(100, 120, 10, 10) );
\r
717 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(150, 120, 10, 10) );
\r
719 t.Graphics.EndContainer( c1 );
\r
720 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(100, 80, 10, 10) );
\r
721 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(150, 80, 10, 10) );
\r
724 Assert.That(t.PDCompare(), Is.True);
\r
727 public virtual void ClearTest() {
\r
728 // Clear screen with teal background.
\r
730 Assert.That(t.PDCompare(), Is.True);
\r
731 t.Graphics.Clear(Color.Teal);
\r
733 Assert.That(t.PDCompare(), Is.True);
\r
737 public virtual void DrawArcTest() {
\r
739 Pen blackPen= new Pen(Color.Black, 1);
\r
740 // Create coordinates of rectangle to bound ellipse.
\r
743 float width = 400.0F;
\r
744 float height = 100.0F;
\r
745 // Create start and sweep angles on ellipse.
\r
746 float startAngle = 370.0F;
\r
747 float sweepAngle = 70.0F;
\r
748 // Draw arc to screen.
\r
749 t.Graphics.DrawArc(blackPen, (int)x, (int)y, (int)width, (int)height, (int)startAngle, (int)sweepAngle);
\r
751 Assert.That(t.PDCompare(), Is.True);
\r
753 startAngle = 10.0F;
\r
754 sweepAngle = 120.0F;
\r
755 t.Graphics.DrawArc(blackPen, new Rectangle((int)x, (int)y, (int)width, (int)height), startAngle, sweepAngle);
\r
757 Assert.That(t.PDCompare(), Is.True);
\r
759 startAngle = 10.0F;
\r
760 sweepAngle = 190.0F;
\r
761 t.Graphics.DrawArc(blackPen, x, y, width, height, startAngle, sweepAngle);
\r
763 Assert.That(t.PDCompare(), Is.True);
\r
765 startAngle = 10.0F;
\r
766 sweepAngle = 300.0F;
\r
767 t.Graphics.DrawArc(blackPen, new RectangleF(x, y, width, height), startAngle, sweepAngle);
\r
769 Assert.That(t.PDCompare(), Is.True);
\r
771 startAngle = -179.9F;
\r
772 sweepAngle = -359.9F;
\r
773 t.Graphics.DrawArc(blackPen, new RectangleF(x, y, width, height), startAngle, sweepAngle);
\r
775 Assert.That(t.PDCompare(), Is.True);
\r
777 startAngle = -10.0F;
\r
778 sweepAngle = -300.0F;
\r
779 t.Graphics.DrawArc(blackPen, new RectangleF(x, y, width, height), startAngle, sweepAngle);
\r
781 Assert.That(t.PDCompare(), Is.True);
\r
785 public virtual void DrawBezierTest() {
\r
787 Pen blackPen = new Pen(Color.Black, 3);
\r
788 // Create coordinates of points for curve.
\r
789 float startX = 100.0F;
\r
790 float startY = 100.0F;
\r
791 float controlX1 = 200.0F;
\r
792 float controlY1 = 10.0F;
\r
793 float controlX2 = 350.0F;
\r
794 float controlY2 = 50.0F;
\r
795 float endX = 500.0F;
\r
796 float endY = 100.0F;
\r
797 // Draw arc to screen.
\r
798 t.Graphics.DrawBezier(blackPen, startX, startY,
\r
799 controlX1, controlY1,
\r
800 controlX2, controlY2,
\r
803 Assert.That(t.PDCompare(), Is.True);
\r
805 t.Graphics.DrawBezier(blackPen, new PointF( startX, startY),
\r
806 new PointF(controlX1, controlY1),
\r
807 new PointF(controlX2, controlY2),
\r
808 new PointF(endX, endY));
\r
810 Assert.That(t.PDCompare(), Is.True);
\r
812 t.Graphics.DrawBezier(blackPen, new Point((int)startX, (int)startY),
\r
813 new Point((int)controlX1, (int)controlY1),
\r
814 new Point((int)controlX2, (int)controlY2),
\r
815 new Point((int)endX, (int)endY));
\r
817 Assert.That(t.PDCompare(), Is.True);
\r
821 public virtual void DrawBeziersTest() {
\r
823 Pen blackPen = new Pen(Color.Black, 3);
\r
824 // Create points for curve.
\r
825 Point start = new Point(100, 100);
\r
826 Point control1 = new Point(200, 10);
\r
827 Point control2 = new Point(350, 50);
\r
828 Point end1 = new Point(500, 100);
\r
829 Point control3 = new Point(600, 150);
\r
830 Point control4 = new Point(650, 250);
\r
831 Point end2 = new Point(500, 300);
\r
832 Point[] bezierPoints = {
\r
833 start, control1, control2, end1,
\r
834 control3, control4, end2
\r
836 // Draw arc to screen.
\r
837 t.Graphics.DrawBeziers(blackPen, bezierPoints);
\r
839 Assert.That(t.PDCompare(), Is.True);
\r
842 PointF startF = new PointF(100.0F, 100.0F);
\r
843 PointF control1F = new PointF(200.0F, 10.0F);
\r
844 PointF control2F = new PointF(350.0F, 50.0F);
\r
845 PointF end1F = new PointF(500.0F, 100.0F);
\r
846 PointF control3F = new PointF(600.0F, 150.0F);
\r
847 PointF control4F = new PointF(650.0F, 250.0F);
\r
848 PointF end2F = new PointF(500.0F, 300.0F);
\r
849 PointF[] bezierPointsF = {
\r
850 startF, control1F, control2F, end1F,
\r
851 control3F, control4F, end2F
\r
853 // Draw arc to screen.
\r
854 t.Graphics.DrawBeziers(blackPen, bezierPointsF);
\r
856 Assert.That(t.PDCompare(), Is.True);
\r
860 public virtual void DrawClosedCurveTest() {
\r
862 Pen redPen = new Pen(Color.Red, 3);
\r
863 Pen greenPen = new Pen(Color.Green, 3);
\r
864 // Create points that define curve.
\r
865 PointF point1 = new PointF( 50.0F, 50.0F);
\r
866 PointF point2 = new PointF(100.0F, 25.0F);
\r
867 PointF point3 = new PointF(200.0F, 5.0F);
\r
868 PointF point4 = new PointF(250.0F, 50.0F);
\r
869 PointF point5 = new PointF(300.0F, 100.0F);
\r
870 PointF point6 = new PointF(350.0F, 200.0F);
\r
871 PointF point7 = new PointF(250.0F, 250.0F);
\r
872 PointF[] curvePoints = {
\r
881 // Draw lines between original points to screen.
\r
882 t.Graphics.DrawLines(redPen, curvePoints);
\r
883 // Create tension and fill mode.
\r
884 float tension = 0.7F;
\r
885 FillMode aFillMode = FillMode.Alternate;
\r
886 // Draw closed curve to screen.
\r
887 t.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);
\r
889 Assert.That(t.PDCompare(), Is.True);
\r
892 aFillMode = FillMode.Winding;
\r
893 // Draw closed curve to screen.
\r
894 t.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);
\r
896 Assert.That(t.PDCompare(), Is.True);
\r
900 public virtual void DrawCurveTest() {
\r
902 Pen redPen = new Pen(Color.Red, 3);
\r
903 Pen greenPen = new Pen(Color.Green, 3);
\r
904 // Create points that define curve.
\r
905 Point point1 = new Point( 50, 50);
\r
906 Point point2 = new Point(100, 25);
\r
907 Point point3 = new Point(200, 5);
\r
908 Point point4 = new Point(250, 50);
\r
909 Point point5 = new Point(300, 100);
\r
910 Point point6 = new Point(350, 200);
\r
911 Point point7 = new Point(250, 250);
\r
912 Point[] curvePoints = {
\r
921 // Draw lines between original points to screen.
\r
922 t.Graphics.DrawLines(redPen, curvePoints);
\r
923 // Create offset, number of segments, and tension.
\r
925 int numSegments = 4;
\r
926 float tension = 0.7F;
\r
927 // Draw curve to screen.
\r
928 t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);
\r
930 Assert.That(t.PDCompare(), Is.True);
\r
933 t.Graphics.DrawCurve(greenPen, curvePoints, tension);
\r
935 Assert.That(t.PDCompare(), Is.True);
\r
938 t.Graphics.DrawCurve(greenPen, curvePoints);
\r
940 Assert.That(t.PDCompare(), Is.True);
\r
944 public virtual void DrawCurveTestF() {
\r
946 Pen redPen = new Pen(Color.Red, 3);
\r
947 Pen greenPen = new Pen(Color.Green, 3);
\r
948 // Create points that define curve.
\r
949 PointF point1 = new PointF( 50.0F, 50.0F);
\r
950 PointF point2 = new PointF(100.0F, 25.0F);
\r
951 PointF point3 = new PointF(200.0F, 5.0F);
\r
952 PointF point4 = new PointF(250.0F, 50.0F);
\r
953 PointF point5 = new PointF(300.0F, 100.0F);
\r
954 PointF point6 = new PointF(350.0F, 200.0F);
\r
955 PointF point7 = new PointF(250.0F, 250.0F);
\r
956 PointF[] curvePoints = {
\r
965 // Draw lines between original points to screen.
\r
966 t.Graphics.DrawLines(redPen, curvePoints);
\r
967 // Create offset, number of segments, and tension.
\r
969 int numSegments = 4;
\r
970 float tension = 0.7F;
\r
971 // Draw curve to screen.
\r
972 t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);
\r
974 Assert.That(t.PDCompare(), Is.True);
\r
977 t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments);
\r
979 Assert.That(t.PDCompare(), Is.True);
\r
982 t.Graphics.DrawCurve(greenPen, curvePoints, tension);
\r
984 Assert.That(t.PDCompare(), Is.True);
\r
987 t.Graphics.DrawCurve(greenPen, curvePoints);
\r
989 Assert.That(t.PDCompare(), Is.True);
\r
993 public virtual void DrawEllipseTest() {
\r
995 Pen blackPen = new Pen(Color.Black, 3);
\r
996 // Create location and size of ellipse.
\r
1001 // Draw ellipse to screen.
\r
1002 t.Graphics.DrawEllipse(blackPen, x, y, width, height);
\r
1004 Assert.That(t.PDCompare(), Is.True);
\r
1007 t.Graphics.DrawEllipse(blackPen, new Rectangle(x, y, width, height));
\r
1009 Assert.That(t.PDCompare(), Is.True);
\r
1013 public virtual void DrawEllipseTestF() {
\r
1015 Pen blackPen = new Pen(Color.Black, 3);
\r
1016 // Create location and size of ellipse.
\r
1019 float width = 200.0F;
\r
1020 float height = 100.0F;
\r
1021 // Draw ellipse to screen.
\r
1022 t.Graphics.DrawEllipse(blackPen, x, y, width, height);
\r
1024 Assert.That(t.PDCompare(), Is.True);
\r
1027 t.Graphics.DrawEllipse(blackPen, new RectangleF(x, y, width, height));
\r
1029 Assert.That(t.PDCompare(), Is.True);
\r
1032 static string getInFile (string file) {
\r
1035 sRslt = Path.GetFullPath (file);
\r
1037 if (! File.Exists (file))
\r
1038 sRslt = Path.Combine (
\r
1039 Path.Combine ("..", ".."),
\r
1046 [Category("NotWorking")]
\r
1047 public virtual void DrawIconTest() {
\r
1049 Icon newIcon = new Icon(getInFile ("SampIcon.ico"));
\r
1050 // Create coordinates for upper-left corner of icon.
\r
1053 // Draw icon to screen.
\r
1054 t.Graphics.DrawIcon(newIcon, x, y);
\r
1056 Assert.That(t.PDCompare(), Is.True);
\r
1058 t.Graphics.DrawIcon(newIcon, new Rectangle(200, 300, 125, 345));
\r
1060 Assert.That(t.PDCompare(), Is.True);
\r
1064 [Category("NotWorking")]
\r
1065 public virtual void DrawIconUnstretchedTest() {
\r
1067 Icon newIcon = new Icon(getInFile ("SampIcon.ico"));
\r
1068 // Create rectangle for icon.
\r
1069 Rectangle rect = new Rectangle( 100, 100, 200, 200);
\r
1070 // Draw icon to screen.
\r
1071 t.Graphics.DrawIconUnstretched(newIcon, rect);
\r
1073 Assert.That(t.PDCompare(), Is.True);
\r
1075 #if INTPTR_SUPPORTED
\r
1076 // Define DrawImageAbort callback method.
\r
1077 private bool DrawImageCallback(IntPtr callBackData) {
\r
1078 // Test for call that passes callBackData parameter.
\r
1079 if(callBackData==IntPtr.Zero) {
\r
1080 // If no callBackData passed, abort DrawImage method.
\r
1084 // If callBackData passed, continue DrawImage method.
\r
1089 [Test] //TBD: add more overrides
\r
1090 public void DrawImageTest() {
\r
1091 // Create callback method.
\r
1092 Graphics.DrawImageAbort imageCallback
\r
1093 = new Graphics.DrawImageAbort(DrawImageCallback);
\r
1094 IntPtr imageCallbackData = new IntPtr(1);
\r
1096 Image newImage = Image.FromFile("SampIcon.ico");
\r
1097 // Create rectangle for displaying original image.
\r
1098 Rectangle destRect1 = new Rectangle( 100, 25, 450, 150);
\r
1099 // Create coordinates of rectangle for source image.
\r
1102 float width = 150.0F;
\r
1103 float height = 150.0F;
\r
1104 GraphicsUnit units = GraphicsUnit.Pixel;
\r
1105 // Draw original image to screen.
\r
1106 t.Graphics.DrawImage(newImage, destRect1, x, y, width, height, units);
\r
1108 // Create rectangle for adjusted image.
\r
1109 Rectangle destRect2 = new Rectangle(100, 175, 450, 150);
\r
1110 // Create image attributes and set large gamma.
\r
1111 ImageAttributes imageAttr = new ImageAttributes();
\r
1112 imageAttr.SetGamma(4.0F);
\r
1113 // Draw adjusted image to screen.
\r
1115 t.Graphics.DrawImage(
\r
1123 imageCallbackData);
\r
1129 [Category("NotWorking")]
\r
1130 public virtual void DrawImageUnscaledTest() {
\r
1132 Image newImage = Bitmap.FromFile(getInFile ("bitmap_gh.png"));
\r
1133 // Create coordinates for upper-left corner of image.
\r
1136 // Draw image to screen.
\r
1137 t.Graphics.DrawImageUnscaled(newImage, x, y, 100, 125);
\r
1139 Assert.That(t.PDCompare(), Is.True);
\r
1142 t.Graphics.DrawImageUnscaled(newImage, new Rectangle(x, y, 34, 235));
\r
1144 Assert.That(t.PDCompare(), Is.True);
\r
1147 t.Graphics.DrawImageUnscaled(newImage, x, y);
\r
1149 Assert.That(t.PDCompare(), Is.True);
\r
1152 t.Graphics.DrawImageUnscaled(newImage, new Point(x, y));
\r
1154 Assert.That(t.PDCompare(), Is.True);
\r
1158 public virtual void DrawLineTest() {
\r
1160 Pen blackPen = new Pen(Color.Black, 3);
\r
1161 // Create coordinates of points that define line.
\r
1166 // Draw line to screen.
\r
1167 t.Graphics.DrawLine(blackPen, x1, y1, x2, y2);
\r
1169 Assert.That(t.PDCompare(), Is.True);
\r
1172 t.Graphics.DrawLine(blackPen, new Point( x1, y1), new Point( x2, y2));
\r
1174 Assert.That(t.PDCompare(), Is.True);
\r
1178 public virtual void DrawLineTestF() {
\r
1180 Pen blackPen = new Pen(Color.Black, 3);
\r
1181 // Create coordinates of points that define line.
\r
1182 float x1 = 100.0F;
\r
1183 float y1 = 100.0F;
\r
1184 float x2 = 500.0F;
\r
1185 float y2 = 100.0F;
\r
1186 // Draw line to screen.
\r
1187 t.Graphics.DrawLine(blackPen, x1, y1, x2, y2);
\r
1189 Assert.That(t.PDCompare(), Is.True);
\r
1192 t.Graphics.DrawLine(blackPen, new PointF( x1, y1), new PointF( x2, y2));
\r
1194 Assert.That(t.PDCompare(), Is.True);
\r
1198 public virtual void DrawLinesTest() {
\r
1200 Pen pen = new Pen(Color.Black, 3);
\r
1201 // Create array of points that define lines to draw.
\r
1202 Point[] points = {
\r
1203 new Point( 10, 10),
\r
1204 new Point( 10, 100),
\r
1205 new Point(200, 50),
\r
1206 new Point(250, 300)
\r
1208 //Draw lines to screen.
\r
1209 t.Graphics.DrawLines(pen, points);
\r
1211 Assert.That(t.PDCompare(), Is.True);
\r
1215 public virtual void DrawLinesTestF() {
\r
1217 Pen pen = new Pen(Color.Black, 3);
\r
1218 // Create array of points that define lines to draw.
\r
1219 PointF[] points = {
\r
1220 new PointF( 10.0F, 10.0F),
\r
1221 new PointF( 10.0F, 100.0F),
\r
1222 new PointF(200.0F, 50.0F),
\r
1223 new PointF(250.0F, 300.0F)
\r
1225 //Draw lines to screen.
\r
1226 t.Graphics.DrawLines(pen, points);
\r
1228 Assert.That(t.PDCompare(), Is.True);
\r
1232 public virtual void DrawPathTest() {
\r
1233 // Create graphics path object and add ellipse.
\r
1234 GraphicsPath graphPath = new GraphicsPath();
\r
1235 graphPath.AddEllipse(0, 0, 200, 100);
\r
1237 Pen blackPen = new Pen(Color.Black, 3);
\r
1238 // Draw graphics path to screen.
\r
1239 t.Graphics.DrawPath(blackPen, graphPath);
\r
1241 Assert.That(t.PDCompare(), Is.True);
\r
1245 public virtual void DrawPieTestF() {
\r
1247 Pen blackPen = new Pen(Color.Black, 3);
\r
1248 // Create location and size of ellipse.
\r
1251 float width = 200.0F;
\r
1252 float height = 100.0F;
\r
1253 // Create start and sweep angles.
\r
1254 float startAngle = 0.0F;
\r
1255 float sweepAngle = 45.0F;
\r
1256 // Draw pie to screen.
\r
1257 t.Graphics.DrawPie(blackPen, x, y, width, height, startAngle, sweepAngle);
\r
1259 Assert.That(t.PDCompare(), Is.True);
\r
1262 t.Graphics.DrawPie(blackPen, new RectangleF( x, y, width, height), startAngle, sweepAngle);
\r
1264 Assert.That(t.PDCompare(), Is.True);
\r
1268 public virtual void DrawPieTest() {
\r
1270 Pen blackPen = new Pen(Color.Black, 3);
\r
1271 // Create location and size of ellipse.
\r
1276 // Create start and sweep angles.
\r
1277 int startAngle = 0;
\r
1278 int sweepAngle = 45;
\r
1279 // Draw pie to screen.
\r
1280 t.Graphics.DrawPie(blackPen, x, y, width, height, startAngle, sweepAngle);
\r
1282 Assert.That(t.PDCompare(), Is.True);
\r
1285 t.Graphics.DrawPie(blackPen, new Rectangle( x, y, width, height), startAngle, sweepAngle);
\r
1287 Assert.That(t.PDCompare(), Is.True);
\r
1291 public virtual void DrawPolygonPoint() {
\r
1293 Pen blackPen = new Pen(Color.Black, 3);
\r
1294 // Create points that define polygon.
\r
1295 Point point1 = new Point( 50, 50);
\r
1296 Point point2 = new Point(100, 25);
\r
1297 Point point3 = new Point(200, 5);
\r
1298 Point point4 = new Point(250, 50);
\r
1299 Point point5 = new Point(300, 100);
\r
1300 Point point6 = new Point(350, 200);
\r
1301 Point point7 = new Point(250, 250);
\r
1302 Point[] curvePoints = {
\r
1311 // Draw polygon to screen.
\r
1312 t.Graphics.DrawPolygon(blackPen, curvePoints);
\r
1314 Assert.That(t.PDCompare()); // .NET's lines of polygon is more wi, Is.Truede
\r
1318 public virtual void DrawPolygonPointF() {
\r
1320 Pen blackPen = new Pen(Color.Black, 3);
\r
1321 // Create points that define polygon.
\r
1322 PointF point1 = new PointF( 50, 50);
\r
1323 PointF point2 = new PointF(100, 25);
\r
1324 PointF point3 = new PointF(200, 5);
\r
1325 PointF point4 = new PointF(250, 50);
\r
1326 PointF point5 = new PointF(300, 100);
\r
1327 PointF point6 = new PointF(350, 200);
\r
1328 PointF point7 = new PointF(250, 250);
\r
1329 PointF[] curvePoints = {
\r
1338 // Draw polygon to screen.
\r
1339 t.Graphics.DrawPolygon(blackPen, curvePoints);
\r
1341 Assert.That(t.PDCompare(), Is.True);
\r
1345 public virtual void DrawRectangleFloat() {
\r
1347 Pen blackPen = new Pen(Color.Black, 3);
\r
1348 // Create location and size of rectangle.
\r
1351 float width = 200.0F;
\r
1352 float height = 200.0F;
\r
1353 // Draw rectangle to screen.
\r
1354 t.Graphics.DrawRectangle(blackPen, x, y, width, height);
\r
1356 Assert.That(t.PDCompare(), Is.True);
\r
1359 t.Graphics.DrawRectangle(blackPen, (int)x, (int)y, (int)width, (int)height);
\r
1361 Assert.That(t.PDCompare(), Is.True);
\r
1364 t.Graphics.DrawRectangle(blackPen, new Rectangle( (int)x, (int)y, (int)width, (int)height));
\r
1366 Assert.That(t.PDCompare(), Is.True);
\r
1370 public virtual void DrawRectanglesRectangleF() {
\r
1372 Pen blackPen = new Pen(Color.Black, 3);
\r
1373 // Create array of rectangles.
\r
1374 RectangleF[] rects = {
\r
1375 new RectangleF( 20.0F, 20.0F, 100.0F, 200.0F),
\r
1376 new RectangleF(100.0F, 200.0F, 250.0F, 50.0F),
\r
1377 new RectangleF(300.0F, 20.0F, 50.0F, 100.0F)
\r
1379 // Draw rectangles to screen.
\r
1380 t.Graphics.DrawRectangles(blackPen, rects);
\r
1382 Assert.That(t.PDCompare(), Is.True);
\r
1386 public virtual void DrawRectanglesRectangle() {
\r
1388 Pen blackPen = new Pen(Color.Black, 3);
\r
1389 // Create array of rectangles.
\r
1390 Rectangle[] rects = {
\r
1391 new Rectangle( 20, 20, 100, 200),
\r
1392 new Rectangle(100, 200, 250, 50),
\r
1393 new Rectangle(300, 20, 50, 100)
\r
1395 // Draw rectangles to screen.
\r
1396 t.Graphics.DrawRectangles(blackPen, rects);
\r
1398 Assert.That(t.PDCompare(), Is.True);
\r
1401 [Test] //TBD: add more combinations
\r
1402 [Category("NotWorking")]
\r
1403 public virtual void DrawStringFloatFormat() {
\r
1404 // Create string to draw.
\r
1405 String drawString = "Sample Text";
\r
1406 // Create font and brush.
\r
1407 Font drawFont = new Font("Arial", 34, FontStyle.Italic);
\r
1408 SolidBrush drawBrush = new SolidBrush(Color.Black);
\r
1409 // Create point for upper-left corner of drawing.
\r
1412 // Set format of string.
\r
1413 StringFormat drawFormat = new StringFormat();
\r
1414 drawFormat.FormatFlags = StringFormatFlags.DirectionVertical;
\r
1415 // Draw string to screen.
\r
1416 t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
\r
1418 Assert.That(t.PDCompare()); // in .net the font is shmooth, Is.Trueed
\r
1421 drawFormat.FormatFlags = StringFormatFlags.NoClip;
\r
1422 // Draw string to screen.
\r
1423 t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
\r
1425 Assert.That(t.PDCompare(), Is.True);
\r
1428 drawFormat.FormatFlags = StringFormatFlags.FitBlackBox;
\r
1429 // Draw string to screen.
\r
1430 t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
\r
1432 Assert.That(t.PDCompare(), Is.True);
\r
1436 public virtual void EndContainerState() {
\r
1437 // Begin graphics container.
\r
1438 GraphicsContainer containerState = t.Graphics.BeginContainer();
\r
1439 // Translate world transformation.
\r
1440 t.Graphics.TranslateTransform(100.0F, 100.0F);
\r
1441 // Fill translated rectangle in container with red.
\r
1442 t.Graphics.FillRectangle(new SolidBrush(Color.Red), 0, 0, 200, 200);
\r
1444 // End graphics container.
\r
1445 t.Graphics.EndContainer(containerState);
\r
1446 // Fill untransformed rectangle with green.
\r
1447 t.Graphics.FillRectangle(new SolidBrush(Color.Green), 0, 0, 200, 200);
\r
1449 Assert.That(t.PDCompare(), Is.True);
\r
1453 public virtual void EnumerateMetafile() {
\r
1457 public virtual void ExcludeClipRegion() {
\r
1458 // Create rectangle for exclusion.
\r
1459 Rectangle excludeRect = new Rectangle(100, 100, 200, 200);
\r
1460 // Set clipping region to exclude rectangle.
\r
1461 t.Graphics.ExcludeClip(excludeRect);
\r
1462 // Fill large rectangle to show clipping region.
\r
1463 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 300, 300);
\r
1465 Assert.That(t.PDCompare(), Is.True);
\r
1469 public virtual void FillClosedCurvePointFillModeTension() {
\r
1470 // Create solid brush.
\r
1471 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1472 // Create array of points for curve.
\r
1473 Point point1 = new Point(100, 100);
\r
1474 Point point2 = new Point(200, 50);
\r
1475 Point point3 = new Point(250, 200);
\r
1476 Point point4 = new Point( 50, 150);
\r
1477 Point[] points = {point1, point2, point3, point4};
\r
1479 FillMode newFillMode = FillMode.Winding;
\r
1481 float tension = 0.68F;
\r
1482 // Fill curve on screen.
\r
1483 t.Graphics.FillClosedCurve(redBrush, points);
\r
1485 Assert.That(t.PDCompare(), Is.True);
\r
1488 t.Graphics.FillClosedCurve(redBrush, points, newFillMode);
\r
1490 Assert.That(t.PDCompare(), Is.True);
\r
1493 newFillMode = FillMode.Alternate;
\r
1494 t.Graphics.FillClosedCurve(redBrush, points, newFillMode, tension);
\r
1496 Assert.That(t.PDCompare(), Is.True);
\r
1500 public virtual void FillClosedCurvePointFFillModeTension() {
\r
1501 // Create solid brush.
\r
1502 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1503 // Create array of points for curve.
\r
1504 PointF point1 = new PointF(100.0F, 100.0F);
\r
1505 PointF point2 = new PointF(200.0F, 50.0F);
\r
1506 PointF point3 = new PointF(250.0F, 200.0F);
\r
1507 PointF point4 = new PointF( 50.0F, 150.0F);
\r
1508 PointF[] points = {point1, point2, point3, point4};
\r
1510 FillMode newFillMode = FillMode.Winding;
\r
1512 float tension = 0.68F;
\r
1513 // Fill curve on screen.
\r
1514 t.Graphics.FillClosedCurve(redBrush, points);
\r
1516 Assert.That(t.PDCompare(), Is.True);
\r
1519 t.Graphics.FillClosedCurve(redBrush, points, newFillMode);
\r
1521 Assert.That(t.PDCompare(), Is.True);
\r
1524 newFillMode = FillMode.Alternate;
\r
1525 t.Graphics.FillClosedCurve(redBrush, points, newFillMode, tension);
\r
1527 Assert.That(t.PDCompare(), Is.True);
\r
1531 public virtual void FillEllipse() {
\r
1532 // Create solid brush.
\r
1533 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1534 // Create location and size of ellipse.
\r
1539 // Fill ellipse on screen.
\r
1540 t.Graphics.FillEllipse(redBrush, x, y, width, height);
\r
1542 Assert.That(t.PDCompare(), Is.True);
\r
1545 t.Graphics.FillEllipse(redBrush, new Rectangle( x, y, width, height));
\r
1547 Assert.That(t.PDCompare(), Is.True);
\r
1551 public virtual void FillEllipseFloat() {
\r
1552 // Create solid brush.
\r
1553 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1554 // Create location and size of ellipse.
\r
1557 float width = 200.0F;
\r
1558 float height = 100.0F;
\r
1559 // Fill ellipse on screen.
\r
1560 t.Graphics.FillEllipse(redBrush, x, y, width, height);
\r
1562 Assert.That(t.PDCompare(), Is.True);
\r
1565 t.Graphics.FillEllipse(redBrush, new RectangleF( x, y, width, height));
\r
1567 Assert.That(t.PDCompare(), Is.True);
\r
1571 public virtual void FillPathEllipse() {
\r
1572 // Create solid brush.
\r
1573 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1574 // Create graphics path object and add ellipse.
\r
1575 GraphicsPath graphPath = new GraphicsPath();
\r
1576 graphPath.AddEllipse(0, 0, 200, 100);
\r
1577 // Fill graphics path to screen.
\r
1578 t.Graphics.FillPath(redBrush, graphPath);
\r
1580 Assert.That(t.PDCompare(), Is.True);
\r
1584 public virtual void FillPieFloat() {
\r
1585 // Create solid brush.
\r
1586 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1587 // Create location and size of ellipse.
\r
1592 // Create start and sweep angles.
\r
1593 float startAngle = 0.0F;
\r
1594 float sweepAngle = 45.0F;
\r
1595 // Fill pie to screen.
\r
1596 t.Graphics.FillPie(redBrush, new Rectangle(x, y, width, height), startAngle, sweepAngle);
\r
1598 Assert.That(t.PDCompare(), Is.True);
\r
1601 t.Graphics.FillPie(redBrush, x, y, width, height, (int)startAngle, (int)sweepAngle);
\r
1603 Assert.That(t.PDCompare(), Is.True);
\r
1606 t.Graphics.FillPie(redBrush, (float)x, (float)y, (float)width, (float)height, startAngle, sweepAngle);
\r
1608 Assert.That(t.PDCompare(), Is.True);
\r
1612 public virtual void FillPolygonPointFillMode() {
\r
1613 // Create solid brush.
\r
1614 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1615 // Create points that define polygon.
\r
1616 Point point1 = new Point( 50, 50);
\r
1617 Point point2 = new Point(100, 25);
\r
1618 Point point3 = new Point(200, 5);
\r
1619 Point point4 = new Point(250, 50);
\r
1620 Point point5 = new Point(300, 100);
\r
1621 Point point6 = new Point(350, 200);
\r
1622 Point point7 = new Point(250, 250);
\r
1623 Point[] curvePoints = {
\r
1633 // Fill polygon to screen.
\r
1634 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Winding);
\r
1636 Assert.That(t.PDCompare(), Is.True);
\r
1639 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Alternate);
\r
1641 Assert.That(t.PDCompare(), Is.True);
\r
1644 t.Graphics.FillPolygon(blueBrush, curvePoints);
\r
1646 Assert.That(t.PDCompare(), Is.True);
\r
1650 public virtual void FillPolygonPointFFillMode() {
\r
1651 // Create solid brush.
\r
1652 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1653 // Create points that define polygon.
\r
1654 PointF point1 = new PointF( 50.0F, 50.0F);
\r
1655 PointF point2 = new PointF(100.0F, 25.0F);
\r
1656 PointF point3 = new PointF(200.0F, 5.0F);
\r
1657 PointF point4 = new PointF(250.0F, 50.0F);
\r
1658 PointF point5 = new PointF(300.0F, 100.0F);
\r
1659 PointF point6 = new PointF(350.0F, 200.0F);
\r
1660 PointF point7 = new PointF(250.0F, 250.0F);
\r
1661 PointF[] curvePoints = {
\r
1671 // Fill polygon to screen.
\r
1672 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Winding);
\r
1674 Assert.That(t.PDCompare(), Is.True);
\r
1677 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Alternate);
\r
1679 Assert.That(t.PDCompare(), Is.True);
\r
1682 t.Graphics.FillPolygon(blueBrush, curvePoints);
\r
1684 Assert.That(t.PDCompare(), Is.True);
\r
1688 public virtual void FillRectangle() {
\r
1689 // Create solid brush.
\r
1690 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1691 // Create location and size of rectangle.
\r
1696 // Fill rectangle to screen.
\r
1697 t.Graphics.FillRectangle(blueBrush, x, y, width, height);
\r
1699 Assert.That(t.PDCompare(), Is.True);
\r
1702 t.Graphics.FillRectangle(blueBrush, new Rectangle( x, y, width, height));
\r
1704 Assert.That(t.PDCompare(), Is.True);
\r
1708 public virtual void FillRectangleFloat() {
\r
1709 // Create solid brush.
\r
1710 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1711 // Create location and size of rectangle.
\r
1714 float width = 300.0F;
\r
1715 float height = 200.0F;
\r
1716 // Fill rectangle to screen.
\r
1717 t.Graphics.FillRectangle(blueBrush, x, y, width, height);
\r
1719 Assert.That(t.PDCompare(), Is.True);
\r
1722 t.Graphics.FillRectangle(blueBrush, new RectangleF( x, y, width, height));
\r
1724 Assert.That(t.PDCompare(), Is.True);
\r
1728 public virtual void FillRectanglesRectangle() {
\r
1729 // Create solid brush.
\r
1730 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1731 // Create array of rectangles.
\r
1732 Rectangle[] rects = {
\r
1733 new Rectangle( 0, 0, 100, 200),
\r
1734 new Rectangle(100, 200, 250, 50),
\r
1735 new Rectangle(300, 0, 50, 100)
\r
1737 // Fill rectangles to screen.
\r
1738 t.Graphics.FillRectangles(blueBrush, rects);
\r
1740 Assert.That(t.PDCompare(), Is.True);
\r
1744 public virtual void FillRectanglesRectangleF() {
\r
1745 // Create solid brush.
\r
1746 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1747 // Create array of rectangles.
\r
1748 RectangleF[] rects = {
\r
1749 new RectangleF( 0.0F, 0.0F, 100.0F, 200.0F),
\r
1750 new RectangleF(100.0F, 200.0F, 250.0F, 50.0F),
\r
1751 new RectangleF(300.0F, 0.0F, 50.0F, 100.0F)
\r
1753 // Fill rectangles to screen.
\r
1754 t.Graphics.FillRectangles(blueBrush, rects);
\r
1756 Assert.That(t.PDCompare(), Is.True);
\r
1760 public virtual void FillRegionRectangle() {
\r
1761 // Create solid brush.
\r
1762 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1763 // Create rectangle for region.
\r
1764 Rectangle fillRect = new Rectangle(100, 150, 200, 250);
\r
1765 // Create region for fill.
\r
1766 Region fillRegion = new Region(fillRect);
\r
1767 // Fill region to screen.
\r
1768 t.Graphics.FillRegion(blueBrush, fillRegion);
\r
1770 Assert.That(t.PDCompare(), Is.True);
\r
1774 public virtual void FlushTest() {
\r
1775 t.Graphics.Flush();
\r
1776 t.Graphics.Flush(FlushIntention.Flush);
\r
1780 public virtual void IntersectClipRegion() {
\r
1781 // Set clipping region.
\r
1782 Rectangle clipRect = new Rectangle(0, 0, 200, 300);
\r
1783 Region clipRegion = new Region(clipRect);
\r
1784 t.Graphics.SetClip(clipRegion, CombineMode.Replace);
\r
1785 // Update clipping region to intersection of
\r
1786 // existing region with specified rectangle.
\r
1787 Rectangle intersectRect = new Rectangle(100, 100, 200, 300);
\r
1788 Region intersectRegion = new Region(intersectRect);
\r
1789 t.Graphics.IntersectClip(intersectRegion);
\r
1790 // Fill rectangle to demonstrate effective clipping region.
\r
1791 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 600);
\r
1793 // Reset clipping region to infinite.
\r
1794 t.Graphics.ResetClip();
\r
1795 // Draw clipRect and intersectRect to screen.
\r
1796 t.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
\r
1798 t.Graphics.DrawRectangle(new Pen(Color.Red), intersectRect);
\r
1800 Assert.That(t.PDCompare(), Is.True);
\r
1804 public virtual void IsVisible4Float() {
\r
1805 // Set clip region.
\r
1806 Region clipRegion = new Region(new Rectangle(50, 50, 100, 100));
\r
1807 t.Graphics.SetClip(clipRegion, CombineMode.Replace);
\r
1808 // Set up coordinates of rectangles.
\r
1809 float x1 = 100.0F;
\r
1810 float y1 = 100.0F;
\r
1811 float width1 = 20.0F;
\r
1812 float height1 = 20.0F;
\r
1813 float x2 = 200.0F;
\r
1814 float y2 = 200.0F;
\r
1815 float width2 = 20.0F;
\r
1816 float height2 = 20.0F;
\r
1817 // If rectangle is visible, fill it.
\r
1818 if (t.Graphics.IsVisible(x1, y1, width1, height1)) {
\r
1819 t.Graphics.FillRectangle(new SolidBrush(Color.Red), x1, y1, width1, height1);
\r
1822 if (t.Graphics.IsVisible(x2, y2, width2, height2)) {
\r
1823 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), x2, y2, width2, height2);
\r
1827 Assert.That(t.PDCompare(), Is.True);
\r
1831 [Category("NotWorking")]
\r
1832 public virtual void MeasureCharacterRangesRegions() {
\r
1834 string measureString = "First and Second ranges";
\r
1835 Font stringFont = new Font("Times New Roman", 16.0F);
\r
1836 // Set character ranges to "First" and "Second".
\r
1837 CharacterRange[] characterRanges = {
\r
1838 new CharacterRange(0, 5),
\r
1839 new CharacterRange(10, 6)
\r
1841 // Create rectangle for layout.
\r
1844 float width = 35.0F;
\r
1845 float height = 200.0F;
\r
1846 RectangleF layoutRect = new RectangleF(x, y, width, height);
\r
1847 // Set string format.
\r
1848 StringFormat stringFormat = new StringFormat();
\r
1849 stringFormat.FormatFlags = StringFormatFlags.DirectionVertical;
\r
1850 stringFormat.SetMeasurableCharacterRanges(characterRanges);
\r
1851 // Draw string to screen.
\r
1852 t.Graphics.DrawString(
\r
1858 // Measure two ranges in string.
\r
1859 Region[] stringRegions = new Region[2];
\r
1860 stringRegions = t.Graphics.MeasureCharacterRanges(
\r
1865 // Draw rectangle for first measured range.
\r
1866 RectangleF measureRect1 = stringRegions[0].GetBounds(t.Graphics);
\r
1867 t.Graphics.DrawRectangle(
\r
1868 new Pen(Color.Red, 1),
\r
1869 Rectangle.Round(measureRect1));
\r
1871 // Draw rectangle for second measured range.
\r
1872 RectangleF measureRect2 = stringRegions[1].GetBounds(t.Graphics);
\r
1873 t.Graphics.DrawRectangle(
\r
1874 new Pen(Color.Blue, 1),
\r
1875 Rectangle.Round(measureRect2));
\r
1877 Assert.That(t.PDCompare(), Is.True);
\r
1880 [Test] //TBD: add more overloads
\r
1881 [Category("NotWorking")]
\r
1882 public virtual void MeasureStringSizeFFormatInts() {
\r
1884 string measureString = "Measure String";
\r
1885 Font stringFont = new Font("Arial", 16);
\r
1886 // Set maximum layout size.
\r
1887 SizeF layoutSize = new SizeF(100.0F, 200.0F);
\r
1888 // Set string format.
\r
1889 StringFormat newStringFormat = new StringFormat();
\r
1890 newStringFormat.FormatFlags = StringFormatFlags.DirectionVertical;
\r
1891 // Measure string.
\r
1892 int charactersFitted;
\r
1894 SizeF stringSize = new SizeF();
\r
1895 stringSize = t.Graphics.MeasureString(
\r
1900 out charactersFitted,
\r
1902 // Draw rectangle representing size of string.
\r
1903 t.Graphics.DrawRectangle(
\r
1904 new Pen(Color.Red, 1),
\r
1905 0.0F, 0.0F, stringSize.Width, stringSize.Height);
\r
1907 // Draw string to screen.
\r
1908 t.Graphics.DrawString(
\r
1915 // Draw output parameters to screen.
\r
1916 string outString = "chars " + charactersFitted + ", lines " + linesFilled;
\r
1917 t.Graphics.DrawString(
\r
1921 new PointF(100, 0));
\r
1923 Assert.That(t.PDCompare(), Is.True);
\r
1927 public virtual void MultiplyTransform() {
\r
1928 // Create transform matrix.
\r
1929 Matrix transformMatrix = new Matrix();
\r
1930 // Translate matrix, prepending translation vector.
\r
1931 transformMatrix.Translate(200.0F, 100.0F);
\r
1932 // Rotate transformation matrix of graphics object,
\r
1933 // prepending rotation matrix.
\r
1934 t.Graphics.RotateTransform(30.0F);
\r
1935 // Multiply (append to) transformation matrix of
\r
1936 // graphics object to translate graphics transformation.
\r
1937 t.Graphics.MultiplyTransform(transformMatrix);
\r
1938 // Draw rotated, translated ellipse.
\r
1939 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
\r
1941 Assert.That(t.PDCompare(), Is.True);
\r
1945 public virtual void MultiplyTransformMatrixOrder() {
\r
1946 // Create transform matrix.
\r
1947 Matrix transformMatrix = new Matrix();
\r
1948 // Translate matrix, prepending translation vector.
\r
1949 transformMatrix.Translate(200.0F, 100.0F);
\r
1950 // Rotate transformation matrix of graphics object,
\r
1951 // prepending rotation matrix.
\r
1952 t.Graphics.RotateTransform(30.0F);
\r
1953 // Multiply (append to) transformation matrix of
\r
1954 // graphics object to translate graphics transformation.
\r
1955 t.Graphics.MultiplyTransform(transformMatrix, MatrixOrder.Append);
\r
1956 // Draw rotated, translated ellipse.
\r
1957 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
\r
1959 Assert.That(t.PDCompare(), Is.True);
\r
1963 public virtual void MultiplyTransformMatrixOrder1() {
\r
1964 // Create transform matrix.
\r
1965 Matrix transformMatrix = new Matrix();
\r
1966 // Translate matrix, prepending translation vector.
\r
1967 transformMatrix.Translate(200.0F, 100.0F);
\r
1968 // Rotate transformation matrix of graphics object,
\r
1969 // prepending rotation matrix.
\r
1970 t.Graphics.RotateTransform(30.0F);
\r
1971 // Multiply (append to) transformation matrix of
\r
1972 // graphics object to translate graphics transformation.
\r
1973 t.Graphics.MultiplyTransform(transformMatrix, MatrixOrder.Prepend);
\r
1974 // Draw rotated, translated ellipse.
\r
1975 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
\r
1977 Assert.That(t.PDCompare(), Is.True);
\r
1981 public virtual void ResetClipIntersectClipRectangleF() {
\r
1982 // Set clipping region.
\r
1983 Rectangle clipRect = new Rectangle(0, 0, 200, 200);
\r
1984 t.Graphics.SetClip(clipRect);
\r
1985 // Update clipping region to intersection of existing region with new rectangle.
\r
1986 RectangleF intersectRectF = new RectangleF(100.0F, 100.0F, 200.0F, 200.0F);
\r
1987 t.Graphics.IntersectClip(intersectRectF);
\r
1988 // Fill rectangle to demonstrate effective clipping region.
\r
1989 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 500);
\r
1990 // Reset clipping region to infinite.
\r
1991 t.Graphics.ResetClip();
\r
1992 // Draw clipRect and intersectRect to screen.
\r
1993 t.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
\r
1994 t.Graphics.DrawRectangle(new Pen(Color.Red), Rectangle.Round(intersectRectF));
\r
1996 Assert.That(t.PDCompare(), Is.True);
\r
2000 public virtual void SaveRestoreTranslate() {
\r
2001 // Translate transformation matrix.
\r
2002 t.Graphics.TranslateTransform(100, 0);
\r
2003 // Save translated graphics state.
\r
2004 GraphicsState transState = t.Graphics.Save();
\r
2005 // Reset transformation matrix to identity and fill rectangle.
\r
2006 t.Graphics.ResetTransform();
\r
2007 t.Graphics.FillRectangle(new SolidBrush(Color.Red), 0, 0, 100, 100);
\r
2009 // Restore graphics state to translated state and fill second rectangle.
\r
2010 t.Graphics.Restore(transState);
\r
2011 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 100, 100);
\r
2013 Assert.That(t.PDCompare(), Is.True);
\r
2017 public virtual void RotateTransformAngleMatrixOrder() {
\r
2018 // Set world transform of graphics object to translate.
\r
2019 t.Graphics.TranslateTransform(100.0F, 0.0F);
\r
2020 // Then to rotate, appending rotation matrix.
\r
2021 t.Graphics.RotateTransform(30.0F, MatrixOrder.Append);
\r
2022 // Draw translated, rotated ellipse to screen.
\r
2023 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2025 Assert.That(t.PDCompare(), Is.True);
\r
2029 public virtual void RotateTransformAngleMatrixOrder1() {
\r
2030 // Set world transform of graphics object to translate.
\r
2031 t.Graphics.TranslateTransform(100.0F, 0.0F);
\r
2032 // Then to rotate, appending rotation matrix.
\r
2033 t.Graphics.RotateTransform(30.0F, MatrixOrder.Prepend);
\r
2034 // Draw translated, rotated ellipse to screen.
\r
2035 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2037 Assert.That(t.PDCompare()); // Line width probl, Is.Trueem
\r
2041 public virtual void ScaleTransformFloatMatrixOrder() {
\r
2042 // Set world transform of graphics object to rotate.
\r
2043 t.Graphics.RotateTransform(30.0F);
\r
2044 // Then to scale, appending to world transform.
\r
2045 t.Graphics.ScaleTransform(3.0F, 1.0F, MatrixOrder.Append);
\r
2046 // Draw rotated, scaled rectangle to screen.
\r
2047 t.Graphics.DrawRectangle(new Pen(Color.Blue, 3), 50, 0, 100, 40);
\r
2049 Assert.That(t.PDCompare()); // Line width probl, Is.Trueem
\r
2053 public virtual void ScaleTransformFloatMatrixOrder1() {
\r
2054 // Set world transform of graphics object to rotate.
\r
2055 t.Graphics.RotateTransform(30.0F);
\r
2056 // Then to scale, appending to world transform.
\r
2057 t.Graphics.ScaleTransform(3.0F, 1.0F, MatrixOrder.Prepend);
\r
2058 // Draw rotated, scaled rectangle to screen.
\r
2059 t.Graphics.DrawRectangle(new Pen(Color.Blue, 3), 50, 0, 100, 40);
\r
2061 Assert.That(t.PDCompare(), Is.True);
\r
2064 [Test] //TBD: add more combination
\r
2065 public virtual void SetClipRegionCombine() {
\r
2066 // Create region for clipping.
\r
2067 Region clipRegion = new Region(new Rectangle(0, 0, 200, 100));
\r
2068 // Set clipping region of graphics to region.
\r
2069 t.Graphics.SetClip(clipRegion, CombineMode.Replace);
\r
2070 // Fill rectangle to demonstrate clip region.
\r
2071 t.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
\r
2073 Assert.That(t.PDCompare(), Is.True);
\r
2077 public virtual void TransformPointsPointF() {
\r
2078 // Create array of two points.
\r
2079 PointF[] points = {new PointF(0.0F, 0.0F),
\r
2080 new PointF(100.0F, 50.0F)};
\r
2081 // Draw line connecting two untransformed points.
\r
2082 t.Graphics.DrawLine(new Pen(Color.Blue, 3),
\r
2085 // Set world transformation of Graphics object to translate.
\r
2086 t.Graphics.TranslateTransform(40.0F, 30.0F);
\r
2087 // Transform points in array from world to page coordinates.
\r
2088 t.Graphics.TransformPoints(CoordinateSpace.Page,
\r
2089 CoordinateSpace.World,
\r
2091 // Reset world transformation.
\r
2092 t.Graphics.ResetTransform();
\r
2093 // Draw line that connects transformed points.
\r
2094 t.Graphics.DrawLine(new Pen(Color.Red, 3),
\r
2098 Assert.That(t.PDCompare(), Is.True);
\r
2102 public virtual void TranslateClipFloat() {
\r
2103 // Create rectangle for clipping region.
\r
2104 RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);
\r
2105 // Set clipping region of graphics to rectangle.
\r
2106 t.Graphics.SetClip(clipRect);
\r
2107 // Translate clipping region.
\r
2110 t.Graphics.TranslateClip(dx, dy);
\r
2111 // Fill rectangle to demonstrate translated clip region.
\r
2112 t.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
\r
2114 Assert.That(t.PDCompare(), Is.True);
\r
2118 public virtual void TranslateTransformAngleMatrixOrder() {
\r
2119 // Set world transform of graphics object to rotate.
\r
2120 t.Graphics.RotateTransform(30.0F);
\r
2121 // Then to translate, appending to world transform.
\r
2122 t.Graphics.TranslateTransform(100.0F, 0.0F, MatrixOrder.Append);
\r
2123 // Draw rotated, translated ellipse to screen.
\r
2124 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2126 Assert.That(t.PDCompare()); // Line width probl, Is.Trueem
\r
2130 public virtual void TranslateTransformAngleMatrixOrder1() {
\r
2131 // Set world transform of graphics object to rotate.
\r
2132 t.Graphics.RotateTransform(30.0F);
\r
2133 // Then to translate, appending to world transform.
\r
2134 t.Graphics.TranslateTransform(100.0F, 0.0F, MatrixOrder.Prepend);
\r
2135 // Draw rotated, translated ellipse to screen.
\r
2136 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2138 Assert.That(t.PDCompare(), Is.True);
\r
2142 public virtual void TransfromPageScaleUnits() {
\r
2143 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2144 t.Graphics.PageScale = 1.0F;
\r
2145 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2147 t.Graphics.PageUnit = GraphicsUnit.Document;
\r
2148 t.Graphics.PageScale = 10.0F;
\r
2149 t.Graphics.DrawLine(Pens.Blue, 10, 70, 70, 10);
\r
2151 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
2152 t.Graphics.PageScale = 0.055F;
\r
2153 t.Graphics.DrawLine(Pens.Green, 10, 70, 70, 10);
\r
2155 Matrix mx=new Matrix(0.5f,0,0,0.5f,0,0);
\r
2156 t.Graphics.Transform = mx;
\r
2158 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
2159 t.Graphics.DrawLine(Pens.Black, 10, 70, 70, 10);
\r
2161 t.Graphics.PageUnit = GraphicsUnit.Point;
\r
2162 t.Graphics.PageScale = 2.7F;
\r
2163 t.Graphics.DrawLine(Pens.Yellow, 10, 70, 70, 10);
\r
2166 Assert.That(t.PDCompare(), Is.True);
\r
2170 public virtual void TransfromPageScaleUnits_2() {
\r
2171 t.Graphics.RotateTransform(45);
\r
2172 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2173 t.Graphics.PageScale = 1.0F;
\r
2174 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2176 t.Graphics.TranslateTransform(100, 0);
\r
2177 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2178 t.Graphics.PageScale = 2.0F;
\r
2179 t.Graphics.DrawLine(Pens.Blue, 10, 70, 70, 10);
\r
2181 t.Graphics.ResetTransform();
\r
2182 t.Graphics.DrawLine(Pens.Green, 10, 70, 70, 10);
\r
2185 Assert.That(t.PDCompare(), Is.True);
\r
2188 public virtual void TransfromPageScaleUnits_3() {
\r
2189 t.Graphics.TranslateTransform(20, 20);
\r
2190 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2191 t.Graphics.PageScale = 1.0F;
\r
2192 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2194 t.Graphics.TranslateTransform(10, 10);
\r
2195 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2196 t.Graphics.PageScale = 1.0F;
\r
2197 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2199 t.Graphics.RotateTransform(15);
\r
2201 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2202 t.Graphics.PageScale = 0.5F;
\r
2203 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2205 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2206 t.Graphics.PageScale = 0.5F;
\r
2207 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2209 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2210 t.Graphics.TranslateTransform(0, 0);
\r
2211 t.Graphics.PageScale = 1.5F;
\r
2212 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2215 Assert.That(t.PDCompare(), Is.True);
\r
2222 #region GraphicsFixturePropClip
\r
2225 public class GraphicsFixturePropClip : GraphicsFixture {
\r
2226 public override void SetUp() {
\r
2227 base.SetUp ("GraphicsFixturePropClip");
\r
2228 t.Graphics.Clip = new Region(new Rectangle(10, 10, 100, 100));
\r
2230 st["DrawArcTest:6"] = TOLERANCE * 5.0f;
\r
2231 st["DrawArcTest:8"] = TOLERANCE * 3.7f;
\r
2232 st["DrawLinesTest:2"] = TOLERANCE * 3.0f;
\r
2233 st["DrawLinesTestF:2"] = TOLERANCE * 3.0f;
\r
2234 st["DrawPieTestF:2"] = TOLERANCE * 2.0f;
\r
2235 st["DrawPieTestF:4"] = TOLERANCE * 2.0f;
\r
2236 st["DrawPieTest:2"] = TOLERANCE * 2.0f;
\r
2237 st["DrawPieTest:4"] = TOLERANCE * 2.0f;
\r
2238 st["FillClosedCurvePointFillModeTension:2"] = TOLERANCE * 1.5f;
\r
2239 st["FillClosedCurvePointFFillModeTension:2"] = TOLERANCE * 1.5f;
\r
2240 st["FillClosedCurvePointFillModeTension:4"] = TOLERANCE * 1.5f;
\r
2241 st["FillClosedCurvePointFFillModeTension:4"] = TOLERANCE * 1.5f;
\r
2242 st["FillClosedCurvePointFillModeTension:5"] = TOLERANCE * 1.5f;
\r
2243 st["FillClosedCurvePointFFillModeTension:6"] = TOLERANCE * 1.5f;
\r
2244 st["ScaleTransformFloatMatrixOrder1:2"] = TOLERANCE * 3.5f;
\r
2248 [Category("NotWorking")]
\r
2249 public override void DrawIconTest() {
\r
2250 base.DrawIconTest ();
\r
2254 [Category("NotWorking")]
\r
2255 public override void DrawIconUnstretchedTest() {
\r
2256 base.DrawIconUnstretchedTest ();
\r
2260 public override void DrawImageUnscaledTest() {
\r
2261 base.DrawImageUnscaledTest ();
\r
2265 public override void DrawStringFloatFormat() {
\r
2266 base.DrawStringFloatFormat ();
\r
2270 [Category("NotWorking")]
\r
2271 public override void MeasureCharacterRangesRegions() {
\r
2272 base.MeasureCharacterRangesRegions ();
\r
2276 [Category("NotWorking")]
\r
2277 public override void MeasureStringSizeFFormatInts() {
\r
2278 base.MeasureStringSizeFFormatInts ();
\r
2284 #region GraphicsFixturePropCompositingMode
\r
2287 public class GraphicsFixturePropCompositingMode1 : GraphicsFixture {
\r
2288 public override void SetUp() {
\r
2289 base.SetUp ("GraphicsFixturePropCompositingMode1");
\r
2290 t.Graphics.CompositingMode = CompositingMode.SourceCopy;
\r
2294 [Category("NotWorking")]
\r
2295 public override void DrawIconTest() {
\r
2296 base.DrawIconTest ();
\r
2300 [Category("NotWorking")]
\r
2301 public override void DrawIconUnstretchedTest() {
\r
2302 base.DrawIconUnstretchedTest ();
\r
2306 [Category("NotWorking")]
\r
2307 public override void DrawImageUnscaledTest() {
\r
2308 base.DrawImageUnscaledTest ();
\r
2312 [Category("NotWorking")]
\r
2313 public override void DrawStringFloatFormat() {
\r
2314 base.DrawStringFloatFormat ();
\r
2318 [Category("NotWorking")]
\r
2319 public override void MeasureCharacterRangesRegions() {
\r
2320 base.MeasureCharacterRangesRegions ();
\r
2324 [Category("NotWorking")]
\r
2325 public override void MeasureStringSizeFFormatInts() {
\r
2326 base.MeasureStringSizeFFormatInts ();
\r
2331 public class GraphicsFixturePropCompositingMode2 : GraphicsFixture {
\r
2332 public override void SetUp() {
\r
2333 base.SetUp ("GraphicsFixturePropCompositingMode2");
\r
2334 t.Graphics.CompositingMode = CompositingMode.SourceOver;
\r
2338 [Category("NotWorking")]
\r
2339 public override void DrawIconTest() {
\r
2340 base.DrawIconTest ();
\r
2344 [Category("NotWorking")]
\r
2345 public override void DrawIconUnstretchedTest() {
\r
2346 base.DrawIconUnstretchedTest ();
\r
2350 [Category("NotWorking")]
\r
2351 public override void DrawImageUnscaledTest() {
\r
2352 base.DrawImageUnscaledTest ();
\r
2356 [Category("NotWorking")]
\r
2357 public override void DrawStringFloatFormat() {
\r
2358 base.DrawStringFloatFormat ();
\r
2362 [Category("NotWorking")]
\r
2363 public override void MeasureCharacterRangesRegions() {
\r
2364 base.MeasureCharacterRangesRegions ();
\r
2368 [Category("NotWorking")]
\r
2369 public override void MeasureStringSizeFFormatInts() {
\r
2370 base.MeasureStringSizeFFormatInts ();
\r
2376 #region GraphicsFixturePropInterpolationMode
\r
2379 public class GraphicsFixturePropInterpolationMode1 : GraphicsFixture {
\r
2380 public override void SetUp() {
\r
2381 base.SetUp ("GraphicsFixturePropInterpolationMode1");
\r
2382 t.Graphics.InterpolationMode = InterpolationMode.Bilinear;
\r
2386 [Category("NotWorking")]
\r
2387 public override void DrawIconTest() {
\r
2388 base.DrawIconTest ();
\r
2392 [Category("NotWorking")]
\r
2393 public override void DrawIconUnstretchedTest() {
\r
2394 base.DrawIconUnstretchedTest ();
\r
2398 [Category("NotWorking")]
\r
2399 public override void DrawImageUnscaledTest() {
\r
2400 base.DrawImageUnscaledTest ();
\r
2404 [Category("NotWorking")]
\r
2405 public override void DrawStringFloatFormat() {
\r
2406 base.DrawStringFloatFormat ();
\r
2410 [Category("NotWorking")]
\r
2411 public override void MeasureCharacterRangesRegions() {
\r
2412 base.MeasureCharacterRangesRegions ();
\r
2416 [Category("NotWorking")]
\r
2417 public override void MeasureStringSizeFFormatInts() {
\r
2418 base.MeasureStringSizeFFormatInts ();
\r
2423 public class GraphicsFixturePropInterpolationMode2 : GraphicsFixture {
\r
2424 public override void SetUp() {
\r
2425 base.SetUp ("GraphicsFixturePropInterpolationMode2");
\r
2426 t.Graphics.InterpolationMode = InterpolationMode.Bicubic;
\r
2430 [Category("NotWorking")]
\r
2431 public override void DrawIconTest() {
\r
2432 base.DrawIconTest ();
\r
2436 [Category("NotWorking")]
\r
2437 public override void DrawIconUnstretchedTest() {
\r
2438 base.DrawIconUnstretchedTest ();
\r
2442 [Category("NotWorking")]
\r
2443 public override void DrawImageUnscaledTest() {
\r
2444 base.DrawImageUnscaledTest ();
\r
2448 [Category("NotWorking")]
\r
2449 public override void DrawStringFloatFormat() {
\r
2450 base.DrawStringFloatFormat ();
\r
2454 [Category("NotWorking")]
\r
2455 public override void MeasureCharacterRangesRegions() {
\r
2456 base.MeasureCharacterRangesRegions ();
\r
2460 [Category("NotWorking")]
\r
2461 public override void MeasureStringSizeFFormatInts() {
\r
2462 base.MeasureStringSizeFFormatInts ();
\r
2468 #region GraphicsFixturePropPageScale
\r
2471 public class GraphicsFixturePropPageScale : GraphicsFixture {
\r
2472 public override void SetUp() {
\r
2473 base.SetUp ("GraphicsFixturePropPageScale");
\r
2475 t.Graphics.PageScale = 4.34f;
\r
2476 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2478 st["IntersectClipRegion:4"] = TOLERANCE * 1.5f;
\r
2479 st["ResetClipIntersectClipRectangleF:2"] = TOLERANCE * 1.5f;
\r
2483 [Category("NotWorking")]
\r
2484 public override void DrawIconTest() {
\r
2485 base.DrawIconTest ();
\r
2489 [Category("NotWorking")]
\r
2490 public override void DrawIconUnstretchedTest() {
\r
2491 base.DrawIconUnstretchedTest ();
\r
2495 [Category("NotWorking")]
\r
2496 public override void DrawImageUnscaledTest() {
\r
2497 base.DrawImageUnscaledTest ();
\r
2501 public override void DrawStringFloatFormat() {
\r
2502 base.DrawStringFloatFormat ();
\r
2506 [Category("NotWorking")]
\r
2507 public override void MeasureCharacterRangesRegions() {
\r
2508 base.MeasureCharacterRangesRegions ();
\r
2512 [Category("NotWorking")]
\r
2513 public override void MeasureStringSizeFFormatInts() {
\r
2514 base.MeasureStringSizeFFormatInts ();
\r
2520 #region GraphicsFixturePropPageUnit
\r
2523 public class GraphicsFixturePropPageUnit1 : GraphicsFixture {
\r
2524 public override void SetUp() {
\r
2525 base.SetUp ("GraphicsFixturePropPageUnit1");
\r
2526 t.Graphics.PageUnit = GraphicsUnit.Display;
\r
2530 [Category("NotWorking")]
\r
2531 public override void DrawIconTest() {
\r
2532 base.DrawIconTest ();
\r
2536 [Category("NotWorking")]
\r
2537 public override void DrawIconUnstretchedTest() {
\r
2538 base.DrawIconUnstretchedTest ();
\r
2542 [Category("NotWorking")]
\r
2543 public override void DrawImageUnscaledTest() {
\r
2544 base.DrawImageUnscaledTest ();
\r
2548 [Category("NotWorking")]
\r
2549 public override void DrawStringFloatFormat() {
\r
2550 base.DrawStringFloatFormat ();
\r
2554 [Category("NotWorking")]
\r
2555 public override void MeasureCharacterRangesRegions() {
\r
2556 base.MeasureCharacterRangesRegions ();
\r
2560 [Category("NotWorking")]
\r
2561 public override void MeasureStringSizeFFormatInts() {
\r
2562 base.MeasureStringSizeFFormatInts ();
\r
2567 public class GraphicsFixturePropPageUnit2 : GraphicsFixture {
\r
2568 public override void SetUp() {
\r
2569 base.SetUp ("GraphicsFixturePropPageUnit2");
\r
2570 t.Graphics.PageUnit = GraphicsUnit.Document;
\r
2572 // FIXME: scaling down loss some pixels.
\r
2573 st["DrawBezierTest:2"] = TOLERANCE * 2.5f;
\r
2574 st["DrawBezierTest:4"] = TOLERANCE * 2.5f;
\r
2575 st["DrawBezierTest:6"] = TOLERANCE * 2.5f;
\r
2576 st["DrawBeziersTest:2"] = TOLERANCE * 2.0f;
\r
2577 st["DrawBeziersTest:4"] = TOLERANCE * 2.0f;
\r
2578 st["DrawClosedCurveTest:2"] = TOLERANCE * 3.0f;
\r
2579 st["DrawClosedCurveTest:4"] = TOLERANCE * 3.7f;
\r
2580 st["DrawCurveTest:2"] = TOLERANCE * 2.5f;
\r
2581 st["DrawCurveTest:4"] = TOLERANCE * 2.0f;
\r
2582 st["DrawCurveTest:6"] = TOLERANCE * 4.0f;
\r
2583 st["DrawCurveTestF:2"] = TOLERANCE * 2.5f;
\r
2584 st["DrawCurveTestF:4"] = TOLERANCE * 6.0f;
\r
2585 st["DrawCurveTestF:6"] = TOLERANCE * 6.0f;
\r
2586 st["DrawCurveTestF:8"] = TOLERANCE * 6.0f;
\r
2587 st["DrawEllipseTest:2"] = TOLERANCE * 2.0f;
\r
2588 st["DrawEllipseTest:4"] = TOLERANCE * 2.0f;
\r
2589 st["DrawEllipseTestF:2"] = TOLERANCE * 2.0f;
\r
2590 st["DrawEllipseTestF:4"] = TOLERANCE * 2.0f;
\r
2591 st["DrawLinesTest:2"] = TOLERANCE * 2.0f;
\r
2592 st["DrawLinesTestF:2"] = TOLERANCE * 2.0f;
\r
2593 st["DrawPathTest:2"] = TOLERANCE * 2.0f;
\r
2594 st["DrawPolygonPoint:2"] = TOLERANCE * 7.0f;
\r
2595 st["DrawPolygonPointF:2"] = TOLERANCE * 7.0f;
\r
2596 st["FillPieFloat:2"] = TOLERANCE * 1.5f;
\r
2597 st["FillPieFloat:4"] = TOLERANCE * 1.5f;
\r
2598 st["FillPieFloat:6"] = TOLERANCE * 1.5f;
\r
2599 st["IntersectClipRegion:4"] = TOLERANCE * 3.0f;
\r
2600 st["MultiplyTransform:2"] = TOLERANCE * 2.5f;
\r
2601 st["MultiplyTransformMatrixOrder1:2"] = TOLERANCE * 2.5f;
\r
2602 st["TranslateTransformAngleMatrixOrder1:2"] = TOLERANCE * 4.0f;
\r
2603 st["ScaleTransformFloatMatrixOrder:2"] = TOLERANCE * 4.0f;
\r
2604 st["ScaleTransformFloatMatrixOrder1:2"] = TOLERANCE * 5.5f;
\r
2605 st["RotateTransformAngleMatrixOrder:2"] = TOLERANCE * 3.5f;
\r
2609 [Category("NotWorking")]
\r
2610 public override void BeginContainerTest() {
\r
2611 base.BeginContainerTest ();
\r
2615 [Category("NotWorking")]
\r
2616 public override void DrawIconTest() {
\r
2617 base.DrawIconTest ();
\r
2621 [Category("NotWorking")]
\r
2622 public override void DrawIconUnstretchedTest() {
\r
2623 base.DrawIconUnstretchedTest ();
\r
2627 [Category("NotWorking")]
\r
2628 public override void DrawImageUnscaledTest() {
\r
2629 base.DrawImageUnscaledTest ();
\r
2633 [Category("NotWorking")]
\r
2634 public override void DrawStringFloatFormat() {
\r
2635 base.DrawStringFloatFormat ();
\r
2639 [Category("NotWorking")]
\r
2640 public override void EndContainerState() {
\r
2641 base.EndContainerState ();
\r
2645 [Category("NotWorking")]
\r
2646 public override void MeasureCharacterRangesRegions() {
\r
2647 base.MeasureCharacterRangesRegions ();
\r
2651 [Category("NotWorking")]
\r
2652 public override void MeasureStringSizeFFormatInts() {
\r
2653 base.MeasureStringSizeFFormatInts ();
\r
2658 public class GraphicsFixturePropPageUnit3 : GraphicsFixture {
\r
2659 public override void SetUp() {
\r
2660 base.SetUp ("GraphicsFixturePropPageUnit3");
\r
2661 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
2665 [Category("NotWorking")]
\r
2666 public override void DrawIconTest() {
\r
2667 base.DrawIconTest ();
\r
2671 [Category("NotWorking")]
\r
2672 public override void DrawIconUnstretchedTest() {
\r
2673 base.DrawIconUnstretchedTest ();
\r
2677 public override void DrawImageUnscaledTest() {
\r
2678 base.DrawImageUnscaledTest ();
\r
2682 public override void DrawStringFloatFormat() {
\r
2683 base.DrawStringFloatFormat ();
\r
2687 [Category("NotWorking")]
\r
2688 public override void IsVisible4Float() {
\r
2689 base.IsVisible4Float ();
\r
2693 public override void MeasureCharacterRangesRegions() {
\r
2694 base.MeasureCharacterRangesRegions ();
\r
2698 [Category("NotWorking")]
\r
2699 public override void MeasureStringSizeFFormatInts() {
\r
2700 base.MeasureStringSizeFFormatInts ();
\r
2705 public class GraphicsFixturePropPageUnit4 : GraphicsFixture {
\r
2706 public override void SetUp() {
\r
2707 base.SetUp ("GraphicsFixturePropPageUnit4");
\r
2708 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2710 st["DrawArcTest:8"] = TOLERANCE * 1.5f;
\r
2711 st["DrawRectangleFloat:2"] = TOLERANCE * 1.5f; // line width problem
\r
2712 st["DrawRectangleFloat:4"] = TOLERANCE * 1.5f;
\r
2713 st["DrawRectangleFloat:6"] = TOLERANCE * 1.5f;
\r
2714 st["DrawRectanglesRectangle:2"] = TOLERANCE * 1.5f;
\r
2715 st["DrawRectanglesRectangleF:2"] = TOLERANCE * 1.5f;
\r
2719 [Category("NotWorking")]
\r
2720 public override void DrawClosedCurveTest() {
\r
2721 base.DrawClosedCurveTest ();
\r
2725 [Category("NotWorking")]
\r
2726 public override void DrawIconTest() {
\r
2727 base.DrawIconTest ();
\r
2731 [Category("NotWorking")]
\r
2732 public override void DrawIconUnstretchedTest() {
\r
2733 base.DrawIconUnstretchedTest ();
\r
2737 [Category("NotWorking")]
\r
2738 public override void DrawImageUnscaledTest() {
\r
2739 base.DrawImageUnscaledTest ();
\r
2743 public override void DrawStringFloatFormat() {
\r
2744 base.DrawStringFloatFormat ();
\r
2748 [Category("NotWorking")]
\r
2749 public override void MeasureCharacterRangesRegions() {
\r
2750 base.MeasureCharacterRangesRegions ();
\r
2754 [Category("NotWorking")]
\r
2755 public override void MeasureStringSizeFFormatInts() {
\r
2756 base.MeasureStringSizeFFormatInts ();
\r
2761 public class GraphicsFixturePropPageUnit5 : GraphicsFixture {
\r
2762 public override void SetUp() {
\r
2763 base.SetUp ("GraphicsFixturePropPageUnit5");
\r
2765 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2769 [Category("NotWorking")]
\r
2770 public override void DrawIconTest() {
\r
2771 base.DrawIconTest ();
\r
2775 [Category("NotWorking")]
\r
2776 public override void DrawIconUnstretchedTest() {
\r
2777 base.DrawIconUnstretchedTest ();
\r
2781 [Category("NotWorking")]
\r
2782 public override void DrawImageUnscaledTest() {
\r
2783 base.DrawImageUnscaledTest ();
\r
2787 [Category("NotWorking")]
\r
2788 public override void DrawStringFloatFormat() {
\r
2789 base.DrawStringFloatFormat ();
\r
2793 [Category("NotWorking")]
\r
2794 public override void MeasureCharacterRangesRegions() {
\r
2795 base.MeasureCharacterRangesRegions ();
\r
2799 [Category("NotWorking")]
\r
2800 public override void MeasureStringSizeFFormatInts() {
\r
2801 base.MeasureStringSizeFFormatInts ();
\r
2806 public class GraphicsFixturePropPageUnit6 : GraphicsFixture {
\r
2807 public override void SetUp() {
\r
2808 base.SetUp ("GraphicsFixturePropPageUnit6");
\r
2809 t.Graphics.PageUnit = GraphicsUnit.Point;
\r
2811 st["DrawArcTest:2"] = TOLERANCE * 2.5f;
\r
2812 st["DrawArcTest:4"] = TOLERANCE * 8.0f; // big difference in width of line
\r
2813 st["DrawArcTest:6"] = TOLERANCE * 8.0f; // big difference in width of line
\r
2814 st["DrawArcTest:8"] = TOLERANCE * 6.0f; // big difference in width of line
\r
2815 st["IsVisible4Float:2"] = TOLERANCE * 1.5f;
\r
2816 st["TransformPointsPointF:2"] = TOLERANCE * 2.0f;
\r
2820 [Category("NotWorking")]
\r
2821 public override void DrawClosedCurveTest() {
\r
2822 base.DrawClosedCurveTest ();
\r
2826 [Category("NotWorking")]
\r
2827 public override void DrawCurveTest() {
\r
2828 base.DrawCurveTest ();
\r
2832 [Category("NotWorking")]
\r
2833 public override void DrawCurveTestF() {
\r
2834 base.DrawCurveTestF ();
\r
2838 [Category("NotWorking")]
\r
2839 public override void DrawEllipseTest() {
\r
2840 base.DrawEllipseTest ();
\r
2844 [Category("NotWorking")]
\r
2845 public override void DrawEllipseTestF() {
\r
2846 base.DrawEllipseTestF ();
\r
2850 [Category("NotWorking")]
\r
2851 public override void DrawIconTest() {
\r
2852 base.DrawIconTest ();
\r
2856 [Category("NotWorking")]
\r
2857 public override void DrawIconUnstretchedTest() {
\r
2858 base.DrawIconUnstretchedTest ();
\r
2862 [Category("NotWorking")]
\r
2863 public override void DrawImageUnscaledTest() {
\r
2864 base.DrawImageUnscaledTest ();
\r
2868 [Category("NotWorking")]
\r
2869 public override void DrawPathTest() {
\r
2870 base.DrawPathTest ();
\r
2874 [Category("NotWorking")]
\r
2875 public override void DrawStringFloatFormat() {
\r
2876 base.DrawStringFloatFormat ();
\r
2880 [Category("NotWorking")]
\r
2881 public override void EndContainerState() {
\r
2882 base.EndContainerState ();
\r
2886 [Category("NotWorking")]
\r
2887 public override void MeasureCharacterRangesRegions() {
\r
2888 base.MeasureCharacterRangesRegions ();
\r
2892 [Category("NotWorking")]
\r
2893 public override void MeasureStringSizeFFormatInts() {
\r
2894 base.MeasureStringSizeFFormatInts ();
\r
2898 [Category("NotWorking")]
\r
2899 public override void MultiplyTransform() {
\r
2900 base.MultiplyTransform ();
\r
2904 [Category("NotWorking")]
\r
2905 public override void MultiplyTransformMatrixOrder1() {
\r
2906 base.MultiplyTransformMatrixOrder1 ();
\r
2910 [Category("NotWorking")]
\r
2911 public override void RotateTransformAngleMatrixOrder1() {
\r
2912 base.RotateTransformAngleMatrixOrder1 ();
\r
2916 [Category("NotWorking")]
\r
2917 public override void TranslateTransformAngleMatrixOrder() {
\r
2918 base.TranslateTransformAngleMatrixOrder ();
\r
2923 // public class GraphicsFixturePropPageUnit7 : GraphicsFixture {
\r
2924 // public override void SetUp() {
\r
2927 // t.Graphics.PageUnit = GraphicsUnit.World;
\r
2933 #region GraphicsFixturePropPixelOffsetMode
\r
2936 public class GraphicsFixturePropPixelOffsetMode : GraphicsFixture {
\r
2937 public override void SetUp() {
\r
2938 base.SetUp ("GraphicsFixturePropPixelOffsetMode");
\r
2939 t.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
\r
2941 st["TransformPointsPointF:2"] = TOLERANCE * 3.0f;
\r
2945 [Category("NotWorking")]
\r
2946 public override void DrawIconTest() {
\r
2947 base.DrawIconTest ();
\r
2951 [Category("NotWorking")]
\r
2952 public override void DrawIconUnstretchedTest() {
\r
2953 base.DrawIconUnstretchedTest ();
\r
2957 [Category("NotWorking")]
\r
2958 public override void DrawImageUnscaledTest() {
\r
2959 base.DrawImageUnscaledTest ();
\r
2963 [Category("NotWorking")]
\r
2964 public override void DrawStringFloatFormat() {
\r
2965 base.DrawStringFloatFormat ();
\r
2969 [Category("NotWorking")]
\r
2970 public override void MeasureCharacterRangesRegions() {
\r
2971 base.MeasureCharacterRangesRegions ();
\r
2975 [Category("NotWorking")]
\r
2976 public override void MeasureStringSizeFFormatInts() {
\r
2977 base.MeasureStringSizeFFormatInts ();
\r
2982 public class GraphicsFixturePropPixelOffsetMode1 : GraphicsFixture {
\r
2983 public override void SetUp() {
\r
2984 base.SetUp ("GraphicsFixturePropPixelOffsetMode1");
\r
2985 t.Graphics.PixelOffsetMode = PixelOffsetMode.HighSpeed;
\r
2989 [Category("NotWorking")]
\r
2990 public override void DrawIconTest() {
\r
2991 base.DrawIconTest ();
\r
2995 [Category("NotWorking")]
\r
2996 public override void DrawIconUnstretchedTest() {
\r
2997 base.DrawIconUnstretchedTest ();
\r
3001 [Category("NotWorking")]
\r
3002 public override void DrawImageUnscaledTest() {
\r
3003 base.DrawImageUnscaledTest ();
\r
3007 [Category("NotWorking")]
\r
3008 public override void DrawStringFloatFormat() {
\r
3009 base.DrawStringFloatFormat ();
\r
3013 [Category("NotWorking")]
\r
3014 public override void MeasureCharacterRangesRegions() {
\r
3015 base.MeasureCharacterRangesRegions ();
\r
3019 [Category("NotWorking")]
\r
3020 public override void MeasureStringSizeFFormatInts() {
\r
3021 base.MeasureStringSizeFFormatInts ();
\r
3026 public class GraphicsFixturePropPixelOffsetMode2 : GraphicsFixture {
\r
3027 public override void SetUp() {
\r
3028 base.SetUp ("GraphicsFixturePropPixelOffsetMode2");
\r
3029 t.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
\r
3031 st["TransformPointsPointF:2"] = TOLERANCE * 3.0f;
\r
3035 [Category("NotWorking")]
\r
3036 public override void DrawIconTest() {
\r
3037 base.DrawIconTest ();
\r
3041 [Category("NotWorking")]
\r
3042 public override void DrawIconUnstretchedTest() {
\r
3043 base.DrawIconUnstretchedTest ();
\r
3047 [Category("NotWorking")]
\r
3048 public override void DrawImageUnscaledTest() {
\r
3049 base.DrawImageUnscaledTest ();
\r
3053 [Category("NotWorking")]
\r
3054 public override void DrawStringFloatFormat() {
\r
3055 base.DrawStringFloatFormat ();
\r
3059 [Category("NotWorking")]
\r
3060 public override void MeasureCharacterRangesRegions() {
\r
3061 base.MeasureCharacterRangesRegions ();
\r
3065 [Category("NotWorking")]
\r
3066 public override void MeasureStringSizeFFormatInts() {
\r
3067 base.MeasureStringSizeFFormatInts ();
\r
3073 #region GraphicsFixturePropRenderingOrigin
\r
3076 [Category("NotWorking")]
\r
3077 public class GraphicsFixturePropRenderingOrigin : GraphicsFixture {
\r
3078 public override void SetUp() {
\r
3079 base.SetUp ("GraphicsFixturePropRenderingOrigin");
\r
3080 t.Graphics.RenderingOrigin = new Point(12, 23);
\r
3084 [Category("NotWorking")]
\r
3085 public override void BeginContainerTest() {
\r
3086 base.BeginContainerTest ();
\r
3090 [Category("NotWorking")]
\r
3091 public override void BeginContainerTest_2() {
\r
3092 base.BeginContainerTest_2 ();
\r
3096 [Category("NotWorking")]
\r
3097 public override void ClearTest() {
\r
3098 base.ClearTest ();
\r
3102 [Category("NotWorking")]
\r
3103 public override void DrawArcTest() {
\r
3104 base.DrawArcTest ();
\r
3108 [Category("NotWorking")]
\r
3109 public override void DrawBezierTest() {
\r
3110 base.DrawBezierTest ();
\r
3114 [Category("NotWorking")]
\r
3115 public override void DrawBeziersTest() {
\r
3116 base.DrawBeziersTest ();
\r
3120 [Category("NotWorking")]
\r
3121 public override void DrawClosedCurveTest() {
\r
3122 base.DrawClosedCurveTest ();
\r
3126 [Category("NotWorking")]
\r
3127 public override void DrawCurveTest() {
\r
3128 base.DrawCurveTest ();
\r
3132 [Category("NotWorking")]
\r
3133 public override void DrawCurveTestF() {
\r
3134 base.DrawCurveTestF ();
\r
3138 [Category("NotWorking")]
\r
3139 public override void DrawEllipseTest() {
\r
3140 base.DrawEllipseTest ();
\r
3144 [Category("NotWorking")]
\r
3145 public override void DrawEllipseTestF() {
\r
3146 base.DrawEllipseTestF ();
\r
3150 [Category("NotWorking")]
\r
3151 public override void DrawIconTest() {
\r
3152 base.DrawIconTest ();
\r
3156 [Category("NotWorking")]
\r
3157 public override void DrawIconUnstretchedTest() {
\r
3158 base.DrawIconUnstretchedTest ();
\r
3162 [Category("NotWorking")]
\r
3163 public override void DrawImageUnscaledTest() {
\r
3164 base.DrawImageUnscaledTest ();
\r
3168 [Category("NotWorking")]
\r
3169 public override void DrawLineTest() {
\r
3170 base.DrawLineTest ();
\r
3174 [Category("NotWorking")]
\r
3175 public override void DrawLineTestF() {
\r
3176 base.DrawLineTestF ();
\r
3180 [Category("NotWorking")]
\r
3181 public override void DrawLinesTest() {
\r
3182 base.DrawLinesTest ();
\r
3186 [Category("NotWorking")]
\r
3187 public override void DrawLinesTestF() {
\r
3188 base.DrawLinesTestF ();
\r
3192 [Category("NotWorking")]
\r
3193 public override void DrawPathTest() {
\r
3194 base.DrawPathTest ();
\r
3198 [Category("NotWorking")]
\r
3199 public override void DrawPieTestF() {
\r
3200 base.DrawPieTestF ();
\r
3204 [Category("NotWorking")]
\r
3205 public override void DrawPieTest() {
\r
3206 base.DrawPieTest ();
\r
3210 [Category("NotWorking")]
\r
3211 public override void DrawPolygonPoint() {
\r
3212 base.DrawPolygonPoint ();
\r
3216 [Category("NotWorking")]
\r
3217 public override void DrawPolygonPointF() {
\r
3218 base.DrawPolygonPointF ();
\r
3222 [Category("NotWorking")]
\r
3223 public override void DrawRectangleFloat() {
\r
3224 base.DrawRectangleFloat ();
\r
3228 [Category("NotWorking")]
\r
3229 public override void DrawRectanglesRectangleF() {
\r
3230 base.DrawRectanglesRectangleF ();
\r
3234 [Category("NotWorking")]
\r
3235 public override void DrawRectanglesRectangle() {
\r
3236 base.DrawRectanglesRectangle ();
\r
3240 [Category("NotWorking")]
\r
3241 public override void DrawStringFloatFormat() {
\r
3242 base.DrawStringFloatFormat ();
\r
3246 [Category("NotWorking")]
\r
3247 public override void EndContainerState() {
\r
3248 base.EndContainerState ();
\r
3252 [Category("NotWorking")]
\r
3253 public override void EnumerateMetafile() {
\r
3254 base.EnumerateMetafile ();
\r
3258 [Category("NotWorking")]
\r
3259 public override void ExcludeClipRegion() {
\r
3260 base.ExcludeClipRegion ();
\r
3264 [Category("NotWorking")]
\r
3265 public override void FillClosedCurvePointFillModeTension() {
\r
3266 base.FillClosedCurvePointFillModeTension ();
\r
3270 [Category("NotWorking")]
\r
3271 public override void FillClosedCurvePointFFillModeTension() {
\r
3272 base.FillClosedCurvePointFFillModeTension ();
\r
3276 [Category("NotWorking")]
\r
3277 public override void FillEllipse() {
\r
3278 base.FillEllipse ();
\r
3282 [Category("NotWorking")]
\r
3283 public override void FillEllipseFloat() {
\r
3284 base.FillEllipseFloat ();
\r
3288 [Category("NotWorking")]
\r
3289 public override void FillPathEllipse() {
\r
3290 base.FillPathEllipse ();
\r
3294 [Category("NotWorking")]
\r
3295 public override void FillPieFloat() {
\r
3296 base.FillPieFloat ();
\r
3300 [Category("NotWorking")]
\r
3301 public override void FillPolygonPointFillMode() {
\r
3302 base.FillPolygonPointFillMode ();
\r
3306 [Category("NotWorking")]
\r
3307 public override void FillPolygonPointFFillMode() {
\r
3308 base.FillPolygonPointFFillMode ();
\r
3312 [Category("NotWorking")]
\r
3313 public override void FillRectangle() {
\r
3314 base.FillRectangle ();
\r
3318 [Category("NotWorking")]
\r
3319 public override void FillRectangleFloat() {
\r
3320 base.FillRectangleFloat ();
\r
3324 [Category("NotWorking")]
\r
3325 public override void FillRectanglesRectangle() {
\r
3326 base.FillRectanglesRectangle ();
\r
3330 [Category("NotWorking")]
\r
3331 public override void FillRectanglesRectangleF() {
\r
3332 base.FillRectanglesRectangleF ();
\r
3336 [Category("NotWorking")]
\r
3337 public override void FillRegionRectangle() {
\r
3338 base.FillRegionRectangle ();
\r
3342 [Category("NotWorking")]
\r
3343 public override void FlushTest() {
\r
3344 base.FlushTest ();
\r
3348 [Category("NotWorking")]
\r
3349 public override void IsVisible4Float() {
\r
3350 base.IsVisible4Float ();
\r
3354 [Category("NotWorking")]
\r
3355 public override void MeasureCharacterRangesRegions() {
\r
3356 base.MeasureCharacterRangesRegions ();
\r
3360 [Category("NotWorking")]
\r
3361 public override void MeasureStringSizeFFormatInts() {
\r
3362 base.MeasureStringSizeFFormatInts ();
\r
3366 [Category("NotWorking")]
\r
3367 public override void MultiplyTransform() {
\r
3368 base.MultiplyTransform ();
\r
3372 [Category("NotWorking")]
\r
3373 public override void MultiplyTransformMatrixOrder() {
\r
3374 base.MultiplyTransformMatrixOrder ();
\r
3378 [Category("NotWorking")]
\r
3379 public override void MultiplyTransformMatrixOrder1() {
\r
3380 base.MultiplyTransformMatrixOrder1 ();
\r
3384 [Category("NotWorking")]
\r
3385 public override void ResetClipIntersectClipRectangleF() {
\r
3386 base.ResetClipIntersectClipRectangleF ();
\r
3390 [Category("NotWorking")]
\r
3391 public override void SaveRestoreTranslate() {
\r
3392 base.SaveRestoreTranslate ();
\r
3396 [Category("NotWorking")]
\r
3397 public override void RotateTransformAngleMatrixOrder() {
\r
3398 base.RotateTransformAngleMatrixOrder ();
\r
3402 [Category("NotWorking")]
\r
3403 public override void RotateTransformAngleMatrixOrder1() {
\r
3404 base.RotateTransformAngleMatrixOrder1 ();
\r
3408 [Category("NotWorking")]
\r
3409 public override void ScaleTransformFloatMatrixOrder() {
\r
3410 base.ScaleTransformFloatMatrixOrder ();
\r
3414 [Category("NotWorking")]
\r
3415 public override void ScaleTransformFloatMatrixOrder1() {
\r
3416 base.ScaleTransformFloatMatrixOrder1 ();
\r
3420 [Category("NotWorking")]
\r
3421 public override void SetClipRegionCombine() {
\r
3422 base.SetClipRegionCombine ();
\r
3426 [Category("NotWorking")]
\r
3427 public override void TransformPointsPointF() {
\r
3428 base.TransformPointsPointF ();
\r
3432 [Category("NotWorking")]
\r
3433 public override void TranslateClipFloat() {
\r
3434 base.TranslateClipFloat ();
\r
3438 [Category("NotWorking")]
\r
3439 public override void TranslateTransformAngleMatrixOrder() {
\r
3440 base.TranslateTransformAngleMatrixOrder ();
\r
3444 [Category("NotWorking")]
\r
3445 public override void TranslateTransformAngleMatrixOrder1() {
\r
3446 base.TranslateTransformAngleMatrixOrder1 ();
\r
3450 [Category("NotWorking")]
\r
3451 public override void TransfromPageScaleUnits() {
\r
3452 base.TransfromPageScaleUnits ();
\r
3456 [Category("NotWorking")]
\r
3457 public override void TransfromPageScaleUnits_2() {
\r
3458 base.TransfromPageScaleUnits_2 ();
\r
3462 [Category("NotWorking")]
\r
3463 public override void TransfromPageScaleUnits_3() {
\r
3464 base.TransfromPageScaleUnits_3 ();
\r
3471 /// TBD: add more variants
\r
3473 #region GraphicsFixturePropSmoothingMode
\r
3476 public class GraphicsFixturePropSmoothingMode : GraphicsFixture {
\r
3477 public override void SetUp() {
\r
3478 base.SetUp ("GraphicsFixturePropSmoothingMode");
\r
3479 t.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
\r
3481 st["DrawArcTest:4"] = TOLERANCE * 3.0f;
\r
3482 st["DrawLineTest:2"] = TOLERANCE * 3.0f;
\r
3483 st["DrawLineTest:4"] = TOLERANCE * 3.0f; // difference in line width even in horizontal lines
\r
3484 st["DrawLineTestF:2"] = TOLERANCE * 3.0f;
\r
3485 st["DrawLineTestF:4"] = TOLERANCE * 3.0f;
\r
3486 st["DrawPieTest:2"] = TOLERANCE * 1.5f;
\r
3487 st["DrawPieTestF:2"] = TOLERANCE * 1.5f;
\r
3488 st["DrawPieTest:4"] = TOLERANCE * 1.5f;
\r
3489 st["DrawPieTestF:4"] = TOLERANCE * 1.5f;
\r
3490 st["DrawRectangleFloat:2"] = TOLERANCE * 3.0f; // big difference in line width
\r
3491 st["DrawRectangleFloat:4"] = TOLERANCE * 3.0f; // big difference in line width
\r
3492 st["DrawRectangleFloat:6"] = TOLERANCE * 3.0f;
\r
3493 st["DrawRectanglesRectangle:2"] = TOLERANCE * 3.0f;
\r
3494 st["DrawRectanglesRectangleF:2"] = TOLERANCE * 3.0f;
\r
3498 [Category("NotWorking")]
\r
3499 public override void DrawIconTest() {
\r
3500 base.DrawIconTest ();
\r
3504 [Category("NotWorking")]
\r
3505 public override void DrawIconUnstretchedTest() {
\r
3506 base.DrawIconUnstretchedTest ();
\r
3510 [Category("NotWorking")]
\r
3511 public override void DrawImageUnscaledTest() {
\r
3512 base.DrawImageUnscaledTest ();
\r
3516 [Category("NotWorking")]
\r
3517 public override void DrawStringFloatFormat() {
\r
3518 base.DrawStringFloatFormat ();
\r
3522 [Category("NotWorking")]
\r
3523 public override void MeasureCharacterRangesRegions() {
\r
3524 base.MeasureCharacterRangesRegions ();
\r
3528 [Category("NotWorking")]
\r
3529 public override void MeasureStringSizeFFormatInts() {
\r
3530 base.MeasureStringSizeFFormatInts ();
\r
3535 public class GraphicsFixturePropSmoothingMode1 : GraphicsFixture {
\r
3536 public override void SetUp() {
\r
3537 base.SetUp ("GraphicsFixturePropSmoothingMode1");
\r
3538 t.Graphics.SmoothingMode = SmoothingMode.HighSpeed;
\r
3542 [Category("NotWorking")]
\r
3543 public override void DrawIconTest() {
\r
3544 base.DrawIconTest ();
\r
3548 [Category("NotWorking")]
\r
3549 public override void DrawIconUnstretchedTest() {
\r
3550 base.DrawIconUnstretchedTest ();
\r
3554 [Category("NotWorking")]
\r
3555 public override void DrawImageUnscaledTest() {
\r
3556 base.DrawImageUnscaledTest ();
\r
3560 [Category("NotWorking")]
\r
3561 public override void DrawStringFloatFormat() {
\r
3562 base.DrawStringFloatFormat ();
\r
3566 [Category("NotWorking")]
\r
3567 public override void MeasureCharacterRangesRegions() {
\r
3568 base.MeasureCharacterRangesRegions ();
\r
3572 [Category("NotWorking")]
\r
3573 public override void MeasureStringSizeFFormatInts() {
\r
3574 base.MeasureStringSizeFFormatInts ();
\r
3580 #region GraphicsFixturePropTextContrast
\r
3583 public class GraphicsFixturePropTextContrast : GraphicsFixture {
\r
3584 public override void SetUp() {
\r
3585 base.SetUp ("GraphicsFixturePropTextContrast");
\r
3586 t.Graphics.TextContrast = 9;
\r
3590 [Category("NotWorking")]
\r
3591 public override void DrawIconTest() {
\r
3592 base.DrawIconTest ();
\r
3596 [Category("NotWorking")]
\r
3597 public override void DrawIconUnstretchedTest() {
\r
3598 base.DrawIconUnstretchedTest ();
\r
3602 [Category("NotWorking")]
\r
3603 public override void DrawImageUnscaledTest() {
\r
3604 base.DrawImageUnscaledTest ();
\r
3608 [Category("NotWorking")]
\r
3609 public override void DrawStringFloatFormat() {
\r
3610 base.DrawStringFloatFormat ();
\r
3614 [Category("NotWorking")]
\r
3615 public override void MeasureCharacterRangesRegions() {
\r
3616 base.MeasureCharacterRangesRegions ();
\r
3620 [Category("NotWorking")]
\r
3621 public override void MeasureStringSizeFFormatInts() {
\r
3622 base.MeasureStringSizeFFormatInts ();
\r
3628 #region GraphicsFixtureGraphicsState
\r
3631 public class GraphicsFixtureGraphicsState {
\r
3632 protected DrawingTest t;
\r
3633 protected int TOLERANCE = 3; //in %;
\r
3636 public virtual void SetUp() {
\r
3637 t = DrawingTest.Create(512, 512, "GraphicsFixtureGraphicsState");
\r
3641 public void TearDown ()
\r
3648 public void BeginEndContainer() {
\r
3649 t.Graphics.FillRectangle( Brushes.Blue, 0, 0, 100, 100 );
\r
3651 GraphicsContainer c1 = t.Graphics.BeginContainer(
\r
3652 new Rectangle(100, 100, 100, 100),
\r
3653 new Rectangle(0, 0, 100, 100),
\r
3654 GraphicsUnit.Pixel);
\r
3656 t.Graphics.FillRectangle( Brushes.Green, 0, 0, 100, 100 );
\r
3658 GraphicsContainer c2 = t.Graphics.BeginContainer(
\r
3659 new Rectangle(100, 100, 100, 100),
\r
3660 new Rectangle(0, 0, 100, 100),
\r
3661 GraphicsUnit.Pixel);
\r
3663 t.Graphics.FillRectangle( Brushes.Red, 0, 0, 100, 100 );
\r
3665 GraphicsState s1 = t.Graphics.Save();
\r
3666 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
3668 t.Graphics.PageScale = 0.7f;
\r
3669 t.Graphics.FillRectangle( Brushes.SeaGreen, 0, 0, 100, 100 );
\r
3671 t.Graphics.EndContainer(c2);
\r
3672 t.Graphics.PageScale = 0.7f;
\r
3673 t.Graphics.FillRectangle( Brushes.SeaGreen, 0, 0, 100, 100 );
\r
3675 t.Graphics.EndContainer(c1);
\r
3676 t.Graphics.PageScale = 0.7f;
\r
3677 t.Graphics.FillRectangle( Brushes.SeaGreen, 0, 0, 100, 100 );
\r
3680 Assert.That(t.PDCompare(), Is.True);
\r
3684 public void SaveRestoreGraphicsProps() {
\r
3685 t.Graphics.CompositingQuality = CompositingQuality.GammaCorrected;
\r
3686 t.Graphics.CompositingMode = CompositingMode.SourceCopy;
\r
3687 t.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
\r
3688 t.Graphics.PageScale = 7;
\r
3689 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
3690 t.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
\r
3691 t.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
\r
3692 t.Graphics.Transform = new Matrix(1, 2, 3, 4, 5, 6);
\r
3693 t.Graphics.TextContrast = 10;
\r
3694 t.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
\r
3696 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
3698 Assert.That (CompositingQuality.Default, Is.EqualTo (t.Graphics.CompositingQuality));
\r
3699 Assert.That (CompositingMode.SourceOver, Is.EqualTo (t.Graphics.CompositingMode));
\r
3700 Assert.That (InterpolationMode.Bilinear, Is.EqualTo (t.Graphics.InterpolationMode));
\r
3701 Assert.That (1.0F, Is.EqualTo (t.Graphics.PageScale));
\r
3702 Assert.That (GraphicsUnit.Display, Is.EqualTo (t.Graphics.PageUnit));
\r
3703 Assert.That (PixelOffsetMode.Default, Is.EqualTo (t.Graphics.PixelOffsetMode));
\r
3704 Assert.That (SmoothingMode.None, Is.EqualTo (t.Graphics.SmoothingMode));
\r
3705 Assert.That (true, Is.EqualTo (t.Graphics.Transform.IsIdentity));
\r
3706 Assert.That (4.0f, Is.EqualTo (t.Graphics.TextContrast));
\r
3707 Assert.That (TextRenderingHint.SystemDefault, Is.EqualTo (t.Graphics.TextRenderingHint));
\r
3709 t.Graphics.EndContainer(c1);
\r
3712 public void SaveRestoreGraphicsProps_2() {
\r
3713 GraphicsState s = t.Graphics.Save();
\r
3715 t.Graphics.CompositingQuality = CompositingQuality.GammaCorrected;
\r
3716 t.Graphics.CompositingMode = CompositingMode.SourceCopy;
\r
3717 t.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
\r
3718 t.Graphics.PageScale = 7;
\r
3719 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
3720 t.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
\r
3721 t.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
\r
3722 t.Graphics.Transform = new Matrix(1, 2, 3, 4, 5, 6);
\r
3723 t.Graphics.TextContrast = 10;
\r
3724 t.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
\r
3726 t.Graphics.Restore(s);
\r
3728 Assert.That (CompositingQuality.Default, Is.EqualTo (t.Graphics.CompositingQuality));
\r
3729 Assert.That (CompositingMode.SourceOver, Is.EqualTo (t.Graphics.CompositingMode));
\r
3730 Assert.That (InterpolationMode.Bilinear, Is.EqualTo (t.Graphics.InterpolationMode));
\r
3731 Assert.That (1.0F, Is.EqualTo (t.Graphics.PageScale));
\r
3732 Assert.That (GraphicsUnit.Display, Is.EqualTo (t.Graphics.PageUnit));
\r
3733 Assert.That (PixelOffsetMode.Default, Is.EqualTo (t.Graphics.PixelOffsetMode));
\r
3734 Assert.That (SmoothingMode.None, Is.EqualTo (t.Graphics.SmoothingMode));
\r
3735 Assert.That (true, Is.EqualTo (t.Graphics.Transform.IsIdentity));
\r
3736 Assert.That (4.0f, Is.EqualTo (t.Graphics.TextContrast));
\r
3737 Assert.That (TextRenderingHint.SystemDefault, Is.EqualTo (t.Graphics.TextRenderingHint));
\r
3741 public void SaveRestoreGraphicsProps_3() {
\r
3742 t.Graphics.PageScale = 2;
\r
3743 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
3745 t.Graphics.PageScale = 3;
\r
3746 GraphicsContainer c2 = t.Graphics.BeginContainer();
\r
3748 t.Graphics.PageScale = 4;
\r
3749 GraphicsContainer c3 = t.Graphics.BeginContainer();
\r
3751 t.Graphics.EndContainer(c2);
\r
3752 Assert.That (3, Is.EqualTo (t.Graphics.PageScale));
\r
3754 t.Graphics.PageScale = 5;
\r
3755 GraphicsState c5 = t.Graphics.Save();
\r
3757 t.Graphics.EndContainer(c3);
\r
3758 Assert.That (5, Is.EqualTo (t.Graphics.PageScale));
\r
3760 t.Graphics.Restore(c5);
\r
3761 Assert.That (5, Is.EqualTo (t.Graphics.PageScale));
\r
3763 t.Graphics.EndContainer(c1);
\r
3764 Assert.That (2, Is.EqualTo (t.Graphics.PageScale));
\r
3767 public void SaveRestoreGraphicsProps_4() {
\r
3768 t.Graphics.PageScale = 2;
\r
3769 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
3771 t.Graphics.PageScale = 3;
\r
3772 GraphicsState c2 = t.Graphics.Save();
\r
3774 t.Graphics.EndContainer(c1);
\r
3775 Assert.That (2, Is.EqualTo (t.Graphics.PageScale));
\r
3777 t.Graphics.Restore(c2);
\r
3778 Assert.That (2, Is.EqualTo (t.Graphics.PageScale));
\r
3783 #region GraphicsFixturePropTextRenderingHint
\r
3786 public class GraphicsFixturePropTextRenderingHint : GraphicsFixture {
\r
3787 public override void SetUp() {
\r
3788 base.SetUp ("GraphicsFixturePropTextRenderingHint");
\r
3789 t.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
\r
3793 [Category("NotWorking")]
\r
3794 public override void DrawIconTest() {
\r
3795 base.DrawIconTest ();
\r
3799 [Category("NotWorking")]
\r
3800 public override void DrawIconUnstretchedTest() {
\r
3801 base.DrawIconUnstretchedTest ();
\r
3805 [Category("NotWorking")]
\r
3806 public override void DrawImageUnscaledTest() {
\r
3807 base.DrawImageUnscaledTest ();
\r
3811 [Category("NotWorking")]
\r
3812 public override void DrawStringFloatFormat() {
\r
3813 base.DrawStringFloatFormat ();
\r
3817 [Category("NotWorking")]
\r
3818 public override void MeasureCharacterRangesRegions() {
\r
3819 base.MeasureCharacterRangesRegions ();
\r
3823 [Category("NotWorking")]
\r
3824 public override void MeasureStringSizeFFormatInts() {
\r
3825 base.MeasureStringSizeFFormatInts ();
\r
3830 public class GraphicsFixturePropTextRenderingHint1 : GraphicsFixture {
\r
3831 public override void SetUp() {
\r
3832 base.SetUp ("GraphicsFixturePropTextRenderingHint1");
\r
3833 t.Graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
\r
3837 [Category("NotWorking")]
\r
3838 public override void DrawIconTest() {
\r
3839 base.DrawIconTest ();
\r
3843 [Category("NotWorking")]
\r
3844 public override void DrawIconUnstretchedTest() {
\r
3845 base.DrawIconUnstretchedTest ();
\r
3849 [Category("NotWorking")]
\r
3850 public override void DrawImageUnscaledTest() {
\r
3851 base.DrawImageUnscaledTest ();
\r
3855 [Category("NotWorking")]
\r
3856 public override void DrawStringFloatFormat() {
\r
3857 base.DrawStringFloatFormat ();
\r
3861 [Category("NotWorking")]
\r
3862 public override void MeasureCharacterRangesRegions() {
\r
3863 base.MeasureCharacterRangesRegions ();
\r
3867 [Category("NotWorking")]
\r
3868 public override void MeasureStringSizeFFormatInts() {
\r
3869 base.MeasureStringSizeFFormatInts ();
\r
3874 public class GraphicsFixturePropTextRenderingHint2 : GraphicsFixture {
\r
3875 public override void SetUp() {
\r
3876 base.SetUp ("GraphicsFixturePropTextRenderingHint2");
\r
3877 t.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
\r
3881 [Category("NotWorking")]
\r
3882 public override void DrawIconTest() {
\r
3883 base.DrawIconTest ();
\r
3887 [Category("NotWorking")]
\r
3888 public override void DrawIconUnstretchedTest() {
\r
3889 base.DrawIconUnstretchedTest ();
\r
3893 [Category("NotWorking")]
\r
3894 public override void DrawImageUnscaledTest() {
\r
3895 base.DrawImageUnscaledTest ();
\r
3899 [Category("NotWorking")]
\r
3900 public override void DrawStringFloatFormat() {
\r
3901 base.DrawStringFloatFormat ();
\r
3905 [Category("NotWorking")]
\r
3906 public override void MeasureCharacterRangesRegions() {
\r
3907 base.MeasureCharacterRangesRegions ();
\r
3911 [Category("NotWorking")]
\r
3912 public override void MeasureStringSizeFFormatInts() {
\r
3913 base.MeasureStringSizeFFormatInts ();
\r
3918 public class GraphicsFixturePropTextRenderingHint3 : GraphicsFixture {
\r
3919 public override void SetUp() {
\r
3920 base.SetUp ("GraphicsFixturePropTextRenderingHint3");
\r
3921 t.Graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
\r
3925 [Category("NotWorking")]
\r
3926 public override void DrawIconTest() {
\r
3927 base.DrawIconTest ();
\r
3931 [Category("NotWorking")]
\r
3932 public override void DrawIconUnstretchedTest() {
\r
3933 base.DrawIconUnstretchedTest ();
\r
3937 [Category("NotWorking")]
\r
3938 public override void DrawImageUnscaledTest() {
\r
3939 base.DrawImageUnscaledTest ();
\r
3943 [Category("NotWorking")]
\r
3944 public override void DrawStringFloatFormat() {
\r
3945 base.DrawStringFloatFormat ();
\r
3949 [Category("NotWorking")]
\r
3950 public override void MeasureCharacterRangesRegions() {
\r
3951 base.MeasureCharacterRangesRegions ();
\r
3955 [Category("NotWorking")]
\r
3956 public override void MeasureStringSizeFFormatInts() {
\r
3957 base.MeasureStringSizeFFormatInts ();
\r
3962 public class GraphicsFixturePropTextRenderingHint4 : GraphicsFixture {
\r
3963 public override void SetUp() {
\r
3964 base.SetUp ("GraphicsFixturePropTextRenderingHint4");
\r
3965 t.Graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
\r
3969 [Category("NotWorking")]
\r
3970 public override void DrawIconTest() {
\r
3971 base.DrawIconTest ();
\r
3975 [Category("NotWorking")]
\r
3976 public override void DrawIconUnstretchedTest() {
\r
3977 base.DrawIconUnstretchedTest ();
\r
3981 [Category("NotWorking")]
\r
3982 public override void DrawImageUnscaledTest() {
\r
3983 base.DrawImageUnscaledTest ();
\r
3987 [Category("NotWorking")]
\r
3988 public override void DrawStringFloatFormat() {
\r
3989 base.DrawStringFloatFormat ();
\r
3993 [Category("NotWorking")]
\r
3994 public override void MeasureCharacterRangesRegions() {
\r
3995 base.MeasureCharacterRangesRegions ();
\r
3999 [Category("NotWorking")]
\r
4000 public override void MeasureStringSizeFFormatInts() {
\r
4001 base.MeasureStringSizeFFormatInts ();
\r
4006 public class GraphicsFixturePropTextRenderingHint5 : GraphicsFixture {
\r
4007 public override void SetUp() {
\r
4008 base.SetUp ("GraphicsFixturePropTextRenderingHint5");
\r
4009 t.Graphics.TextRenderingHint = TextRenderingHint.SystemDefault;
\r
4013 [Category("NotWorking")]
\r
4014 public override void DrawIconTest() {
\r
4015 base.DrawIconTest ();
\r
4019 [Category("NotWorking")]
\r
4020 public override void DrawIconUnstretchedTest() {
\r
4021 base.DrawIconUnstretchedTest ();
\r
4025 [Category("NotWorking")]
\r
4026 public override void DrawImageUnscaledTest() {
\r
4027 base.DrawImageUnscaledTest ();
\r
4031 [Category("NotWorking")]
\r
4032 public override void DrawStringFloatFormat() {
\r
4033 base.DrawStringFloatFormat ();
\r
4037 [Category("NotWorking")]
\r
4038 public override void MeasureCharacterRangesRegions() {
\r
4039 base.MeasureCharacterRangesRegions ();
\r
4043 [Category("NotWorking")]
\r
4044 public override void MeasureStringSizeFFormatInts() {
\r
4045 base.MeasureStringSizeFFormatInts ();
\r
4051 #region GraphicsFixturePropTransform
\r
4054 public class GraphicsFixturePropTransform : GraphicsFixture {
\r
4055 public override void SetUp() {
\r
4056 base.SetUp ("GraphicsFixturePropTransform");
\r
4057 t.Graphics.Transform = new Matrix(0, 1, 2, 0, 0, 0);
\r
4059 st["DrawArcTest:2"] = TOLERANCE * 11.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4060 st["DrawArcTest:4"] = TOLERANCE * 12.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4061 st["DrawArcTest:6"] = TOLERANCE * 12.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4062 st["DrawArcTest:8"] = TOLERANCE * 10.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4063 st["DrawClosedCurveTest:4"] = TOLERANCE * 2.0f;
\r
4064 st["RotateTransformAngleMatrixOrder:2"] = TOLERANCE * 1.5f;
\r
4065 st["TransformPointsPointF:2"] = TOLERANCE * 3.5f;
\r
4069 [Category("NotWorking")]
\r
4070 public override void DrawIconTest() {
\r
4071 base.DrawIconTest ();
\r
4075 [Category("NotWorking")]
\r
4076 public override void DrawIconUnstretchedTest() {
\r
4077 base.DrawIconUnstretchedTest ();
\r
4081 [Category("NotWorking")]
\r
4082 public override void DrawImageUnscaledTest() {
\r
4083 base.DrawImageUnscaledTest ();
\r
4087 [Category("NotWorking")]
\r
4088 public override void DrawStringFloatFormat() {
\r
4089 base.DrawStringFloatFormat ();
\r
4093 [Category("NotWorking")]
\r
4094 public override void MeasureCharacterRangesRegions() {
\r
4095 base.MeasureCharacterRangesRegions ();
\r
4099 [Category("NotWorking")]
\r
4100 public override void MeasureStringSizeFFormatInts() {
\r
4101 base.MeasureStringSizeFFormatInts ();
\r