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 using NUnit.Framework.SyntaxHelpers;
\r
45 namespace Test.Sys.Drawing.GraphicsFixtures {
\r
46 #region GraphicsFixtureProps
\r
49 public class GraphicsFixtureProps {
\r
51 protected DrawingTest t;
\r
52 const int TOLERANCE = 3; //in %
\r
55 public void SetUp() {
\r
56 t = DrawingTest.Create(512, 512);
\r
60 public void TearDown ()
\r
67 public void ClipTest_1() {
\r
68 Region r = new Region();
\r
69 Assert.That(r.Equals(t.Graphics.Clip, t.Graphics), Is.True);
\r
73 public void ClipTest_2() {
\r
74 Region r = new Region(new Rectangle(10, 10, 60, 60));
\r
75 t.Graphics.Clip = r;
\r
76 Assert.That(r.Equals(t.Graphics.Clip, t.Graphics), Is.True);
\r
78 Pen redPen = new Pen(Color.Red, 3);
\r
79 Pen greenPen = new Pen(Color.Green, 3);
\r
80 // Create points that define curve.
\r
81 Point point1 = new Point( 50, 50);
\r
82 Point point2 = new Point(100, 25);
\r
83 Point point3 = new Point(200, 5);
\r
84 Point point4 = new Point(250, 50);
\r
85 Point point5 = new Point(300, 100);
\r
86 Point point6 = new Point(350, 200);
\r
87 Point point7 = new Point(250, 250);
\r
88 Point[] curvePoints = {
\r
97 // Draw lines between original points to screen.
\r
98 t.Graphics.DrawLines(redPen, curvePoints);
\r
100 Assert.That(t.PDCompare(TOLERANCE), Is.True);
\r
104 public void ClipTest_3() {
\r
105 t.Graphics.TranslateTransform(3, 3);
\r
106 t.Graphics.SetClip(new Rectangle(23, 24, 30, 40));
\r
108 RectangleF cb = t.Graphics.VisibleClipBounds;
\r
109 DrawingTest.AssertAlmostEqual(23, cb.X);
\r
110 DrawingTest.AssertAlmostEqual(24, cb.Y);
\r
111 DrawingTest.AssertAlmostEqual(30, cb.Width);
\r
112 DrawingTest.AssertAlmostEqual(40, cb.Height);
\r
114 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
116 t.Graphics.RotateTransform(128);
\r
118 t.Graphics.TranslateTransform(14, 14);
\r
119 t.Graphics.ExcludeClip(new Rectangle(0, 0, 4, 60));
\r
122 t.Graphics.RotateTransform(128);
\r
124 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
126 t.Graphics.TranslateClip(5.2f, 3.1f);
\r
128 t.Graphics.ResetTransform();
\r
129 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
131 cb = t.Graphics.VisibleClipBounds;
\r
132 DrawingTest.AssertAlmostEqual(28, cb.X);
\r
133 DrawingTest.AssertAlmostEqual(22, cb.Y);
\r
134 DrawingTest.AssertAlmostEqual(30, cb.Width);
\r
135 DrawingTest.AssertAlmostEqual(40, cb.Height);
\r
137 t.Graphics.ScaleTransform(5, 7);
\r
138 t.Graphics.IntersectClip(new Rectangle(7, 4, 20, 20));
\r
140 cb = t.Graphics.VisibleClipBounds;
\r
141 DrawingTest.AssertAlmostEqual(7, cb.X);
\r
142 DrawingTest.AssertAlmostEqual(4f, cb.Y);
\r
143 DrawingTest.AssertAlmostEqual(4.6f, cb.Width);
\r
144 DrawingTest.AssertAlmostEqual(4.85714245f, cb.Height);
\r
148 public void ClipBoundsTest() {
\r
149 Region r = new Region();
\r
150 Assert.That(t.Graphics.ClipBounds.Equals(r.GetBounds(t.Graphics)), Is.True);
\r
152 RectangleF rf = new RectangleF(10, 10, 60, 60);
\r
153 r = new Region(rf);
\r
154 t.Graphics.Clip = r;
\r
155 Assert.That(rf.Equals(t.Graphics.ClipBounds), Is.True);
\r
159 public void CompositingModeTest() {
\r
160 //TODO: seems to draw equal images
\r
161 Assert.That (CompositingMode.SourceOver, Is.EqualTo (t.Graphics.CompositingMode));
\r
163 Bitmap b = new Bitmap(100, 100);
\r
164 Graphics g = Graphics.FromImage(b);
\r
166 Color c = Color.FromArgb(100, Color.Red);
\r
168 Brush redBrush = new SolidBrush(c);
\r
169 g.FillEllipse(redBrush, 5, 6, 100, 200);
\r
170 //t.Graphics.FillEllipse(redBrush, 5, 6, 100, 200);
\r
171 t.Graphics.DrawImage(b, 10, 10);
\r
175 t.Graphics.CompositingMode = CompositingMode.SourceCopy;
\r
177 t.Graphics.DrawImage(b, 300, 300);
\r
180 Assert.That(t.PDCompare(TOLERANCE), Is.True);
\r
184 public void CompositingQualityTest() {
\r
188 public void DpiXTest() {
\r
189 Assert.That(t.Graphics.DpiX == 96f, Is.True);
\r
193 public void DpiYTest() {
\r
194 Assert.That(t.Graphics.DpiY == 96f, Is.True);
\r
198 public void InterpolationModeTest() {
\r
199 Assert.That (InterpolationMode.Bilinear, Is.EqualTo (t.Graphics.InterpolationMode));
\r
203 public void IsClipEmtpyTest() {
\r
204 Assert.That (t.Graphics.IsClipEmpty, Is.False);
\r
207 t.Graphics.Clip = null;
\r
208 Assert.Fail("The ArgumentNullException was not thrown");
\r
210 catch(Exception e) {
\r
211 Assert.That (e.GetType(), Is.EqualTo (typeof(ArgumentNullException)));
\r
214 Region r = new Region(new Rectangle(10, 10, 0, 0));
\r
215 t.Graphics.Clip = r;
\r
217 Assert.That( t.Graphics.IsClipEmpty, Is.True);
\r
221 public void IsVisibleClipEmtpyTest() {
\r
222 Assert.That (t.Graphics.IsVisibleClipEmpty, Is.False, "default t.Graphics.IsVisibleClipEmpty");
\r
224 Region r = new Region(new Rectangle(512, 512, 100, 100));
\r
225 t.Graphics.Clip = r;
\r
226 Assert.That (t.Graphics.IsClipEmpty, Is.False);
\r
227 Assert.That(t.Graphics.IsVisibleClipEmpty, Is.True);
\r
231 public void PageScaleTest() {
\r
232 Assert.That (1f, Is.EqualTo (t.Graphics.PageScale));
\r
236 public void PageUnitTest() {
\r
237 Assert.That (GraphicsUnit.Display, Is.EqualTo (t.Graphics.PageUnit));
\r
241 public void PixelOffsetModeTest() {
\r
242 Assert.That (PixelOffsetMode.Default, Is.EqualTo (t.Graphics.PixelOffsetMode));
\r
246 [Category("NotWorking")]
\r
247 public void RenderingOriginTest() {
\r
248 Assert.That (new Point(0,0), Is.EqualTo (t.Graphics.RenderingOrigin));
\r
252 public void SmoothingModeTest() {
\r
253 Assert.That (SmoothingMode.None, Is.EqualTo (t.Graphics.SmoothingMode));
\r
257 public void TextContrastTest() {
\r
258 Assert.That (4, Is.EqualTo (t.Graphics.TextContrast));
\r
262 public void TextRenderingHintTest() {
\r
263 Assert.That (TextRenderingHint.SystemDefault, Is.EqualTo (t.Graphics.TextRenderingHint));
\r
267 public void TransformTest() {
\r
268 Assert.That (new Matrix(), Is.EqualTo (t.Graphics.Transform));
\r
272 public void VisibleClipBoundsTest() {
\r
273 Assert.That (new RectangleF(0, 0, 512, 512), Is.EqualTo (t.Graphics.VisibleClipBounds));
\r
281 public class DrawImage {
\r
282 protected DrawingTest t;
\r
283 protected int TOLERANCE = 10; //in %;
\r
284 protected Hashtable st = new Hashtable();
\r
286 Rectangle src = new Rectangle(0, 0, 50, 50);
\r
287 RectangleF srcF = new Rectangle(0, 0, 50, 50);
\r
288 Rectangle dst = new Rectangle(170, 170, 100, 100);
\r
289 RectangleF dstF = new Rectangle(270, 270, 100, 100);
\r
295 public virtual void SetUp() {
\r
296 SetUp("DrawImage");
\r
297 DrawingTest.ShowForms = false;
\r
299 bmp = Bitmap.FromFile("bitmap50.png");
\r
300 bmp2 = Bitmap.FromFile("bitmap25.png");
\r
302 catch(Exception e) {
\r
303 Console.WriteLine(e.Message);
\r
306 public virtual void SetUp(string ownerClass) {
\r
307 t = DrawingTest.Create(512, 512, ownerClass);
\r
308 t.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
\r
310 // hashtable of differents tolerance values for specified tests.
\r
313 public void TearDown() {
\r
319 public void DrawImage1() {
\r
320 t.Graphics.DrawImage(bmp, new Point[]{new Point(170,10), new Point(250,0), new Point(100,100)}, src, GraphicsUnit.Pixel );
\r
321 t.Graphics.DrawImage(bmp, new PointF[]{new PointF(70,10), new PointF(150,0), new PointF(10,100)}, srcF, GraphicsUnit.Pixel );
\r
323 Assert.That(t.Compare(), Is.True);
\r
326 public void DrawImage2() {
\r
327 t.Graphics.DrawImage(bmp, dst, src, GraphicsUnit.Pixel);
\r
328 t.Graphics.DrawImage(bmp, dstF, srcF, GraphicsUnit.Pixel);
\r
330 Assert.That(t.Compare(), Is.True);
\r
333 public void DrawImage3() {
\r
334 t.Graphics.DrawImage(bmp, 10.0F, 10.0F, srcF, GraphicsUnit.Pixel);
\r
335 t.Graphics.DrawImage(bmp, 70.0F, 150.0F, 250.0F, 150.0F);
\r
337 Assert.That(t.Compare(), Is.True);
\r
340 public void DrawImage4() {
\r
341 t.Graphics.DrawImage(bmp, dst);
\r
342 t.Graphics.DrawImage(bmp, dstF);
\r
344 Assert.That(t.Compare(), Is.True);
\r
347 public void DrawImage5() {
\r
348 t.Graphics.SetClip( new Rectangle(70, 0, 20, 200));
\r
349 t.Graphics.DrawImage(bmp, new Point[]{new Point(50,50), new Point(250,30), new Point(100,150)}, src, GraphicsUnit.Pixel );
\r
351 Assert.That(t.Compare(), Is.True);
\r
354 public void DrawImage6() {
\r
355 t.Graphics.ScaleTransform(2, 2);
\r
356 t.Graphics.SetClip( new Rectangle(70, 0, 20, 200));
\r
357 t.Graphics.DrawImage(bmp, new Point[]{new Point(50,50), new Point(250,30), new Point(100,150)}, src, GraphicsUnit.Pixel );
\r
359 Assert.That(t.Compare(), Is.True);
\r
362 public void DrawImage7() {
\r
363 t.Graphics.DrawImage(bmp, 170, 70, src, GraphicsUnit.Pixel);
\r
364 t.Graphics.DrawImage(bmp, 70, 350, 350, 150);
\r
366 Assert.That(t.Compare(), Is.True);
\r
369 public void DrawImage8() {
\r
370 t.Graphics.DrawImage(bmp, new Point[]{new Point(170,10), new Point(250,10), new Point(100,100)} );
\r
371 t.Graphics.DrawImage(bmp, new PointF[]{new PointF(170,100), new PointF(250,100), new PointF(100,190)} );
\r
373 Assert.That(t.Compare(), Is.True);
\r
376 public void DrawImage9() {
\r
377 t.Graphics.DrawImage(bmp, 0, 0);
\r
378 t.Graphics.DrawImage(bmp, 200, 200);
\r
380 Assert.That(t.Compare(), Is.True);
\r
383 public void DrawImagePageUnit() {
\r
384 t.Graphics.PageUnit = GraphicsUnit.Document;
\r
385 Point [] p = new Point[]{
\r
386 new Point(100, 100),
\r
387 new Point(200, 100),
\r
391 t.Graphics.DrawImage(bmp2, p, new Rectangle(100, 100, 100, 100), GraphicsUnit.Pixel);
\r
393 Assert.That(t.Compare(), Is.True);
\r
396 public void DrawImagePageUnit_2() {
\r
397 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
398 t.Graphics.ScaleTransform(0.3f, 0.3f);
\r
399 Point [] p = new Point[]{
\r
400 new Point(100, 100),
\r
401 new Point(200, 100),
\r
405 t.Graphics.DrawImage(bmp2, p, new Rectangle(100, 100, 100, 100), GraphicsUnit.Pixel);
\r
407 Assert.That(t.Compare(), Is.True);
\r
410 public void DrawImagePageUnit_3() {
\r
411 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
412 t.Graphics.ScaleTransform(0.3f, 0.3f);
\r
413 t.Graphics.DrawImage(bmp2, new Rectangle(100, 100, 100, 100));
\r
415 Assert.That(t.Compare(), Is.True);
\r
418 public void DrawImagePageUnit_4() {
\r
419 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
420 t.Graphics.ScaleTransform(0.5f, 0.5f);
\r
421 t.Graphics.DrawImage(bmp, 50, 50);
\r
423 Assert.That(t.Compare(), Is.True);
\r
426 public void DrawImagePageUnitClip() {
\r
427 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
428 t.Graphics.ScaleTransform(0.3f, 0.3f);
\r
429 Point [] p = new Point[]{
\r
430 new Point(100, 100),
\r
431 new Point(200, 100),
\r
435 t.Graphics.SetClip( new Rectangle(120, 120, 50, 100) );
\r
436 t.Graphics.DrawImage(bmp2, p, new Rectangle(100, 100, 100, 100), GraphicsUnit.Pixel);
\r
438 Assert.That(t.Compare(), Is.True);
\r
441 public void DrawImageWithResolution() {
\r
442 t.Graphics.DrawImage(bmp2, 0, 0);
\r
444 Assert.That(t.Compare(), Is.True);
\r
447 public void DrawImageInContainer1() {
\r
448 t.Graphics.BeginContainer(new Rectangle(10, 10, 50, 50), new Rectangle(70, 70, 100, 100), GraphicsUnit.Pixel);
\r
449 t.Graphics.DrawImage(bmp, 0, 0);
\r
451 Assert.That(t.Compare(), Is.True);
\r
454 public void DrawImageInContainer2() {
\r
455 t.Graphics.BeginContainer(new Rectangle(10, 10, 50, 50), new Rectangle(70, 70, 100, 100), GraphicsUnit.Pixel);
\r
456 t.Graphics.DrawImage(bmp2, 0, 0);
\r
458 Assert.That(t.Compare(), Is.True);
\r
461 public void DrawImageInContainer3() {
\r
462 t.Graphics.BeginContainer(new Rectangle(10, 10, 50, 50), new Rectangle(70, 70, 100, 100), GraphicsUnit.Pixel);
\r
463 t.Graphics.SetClip( new Rectangle(0, 0, 15, 15) );
\r
464 t.Graphics.ScaleTransform(0.5f, 0.5f);
\r
465 t.Graphics.DrawImage(bmp2, 0, 0);
\r
467 Assert.That(t.Compare(), Is.True);
\r
470 public void DrawImageInContainer4() {
\r
471 Point [] p = new Point[]{
\r
472 new Point(100, 100),
\r
473 new Point(200, 100),
\r
477 t.Graphics.SetClip( new Rectangle(70, 70, 70, 70) );
\r
478 GraphicsContainer c = t.Graphics.BeginContainer( new Rectangle(20, 20, 10, 10), new Rectangle(77, 77, 7, 7), GraphicsUnit.Pixel);
\r
479 t.Graphics.DrawImage(bmp2, p, new Rectangle(100, 100, 100, 100), GraphicsUnit.Pixel);
\r
480 t.Graphics.EndContainer( c );
\r
482 Assert.That(t.Compare(), Is.True);
\r
487 #region GraphicsFixtureFillModes
\r
489 public class GraphicsFixtureFillModes {
\r
490 protected DrawingTest t;
\r
491 protected int TOLERANCE = 3; //in %;
\r
494 public virtual void SetUp() {
\r
495 SetUp("GraphicsFixtureFillModes");
\r
497 public virtual void SetUp(string ownerClass) {
\r
498 t = DrawingTest.Create(512, 512, ownerClass);
\r
501 public void TearDown() {
\r
507 public void FillModeAlternate() {
\r
508 GraphicsPath p = new GraphicsPath();
\r
509 Assert.That (FillMode.Alternate, Is.EqualTo (p.FillMode));
\r
512 public void FillModeAlternate_1() {
\r
513 Point [] p = new Point[] {
\r
514 new Point(50, 100),
\r
516 new Point(90, 100),
\r
517 new Point(140, 10),
\r
518 new Point(150, 100),
\r
519 new Point(170, 10),
\r
523 GraphicsPath path = new GraphicsPath();
\r
524 path.AddLines( p );
\r
525 path.FillMode = FillMode.Alternate;
\r
526 t.Graphics.FillPath( Brushes.Blue, path );
\r
528 Assert.That(t.PDCompare(), Is.True);
\r
531 public void FillModeAlternate_2() {
\r
533 Rectangle r1 = new Rectangle(100, 100, 100, 100);
\r
534 Rectangle r2 = new Rectangle(125, 125, 50, 50);
\r
535 GraphicsPath path = new GraphicsPath();
\r
536 path.AddRectangle( r1 );
\r
537 path.AddRectangle( r2 );
\r
538 path.FillMode = FillMode.Alternate;
\r
539 t.Graphics.FillPath( Brushes.Blue, path );
\r
541 Assert.That(t.PDCompare(), Is.True);
\r
544 public void FillModeAlternate_3() {
\r
545 Point [] p = new Point[] {
\r
546 new Point(50, 100),
\r
547 new Point(150, 50),
\r
548 new Point(250, 100),
\r
550 new Point(250, 50),
\r
554 GraphicsPath path = new GraphicsPath();
\r
555 path.AddLines( p );
\r
556 path.FillMode = FillMode.Alternate;
\r
557 t.Graphics.FillPath( Brushes.Blue, path );
\r
559 Assert.That(t.PDCompare(), Is.True);
\r
562 public void FillModeWinding_1() {
\r
563 Point [] p = new Point[] {
\r
564 new Point(50, 100),
\r
566 new Point(90, 100),
\r
567 new Point(140, 10),
\r
568 new Point(150, 100),
\r
569 new Point(170, 10),
\r
573 GraphicsPath path = new GraphicsPath();
\r
574 path.AddLines( p );
\r
575 path.FillMode = FillMode.Winding;
\r
576 t.Graphics.FillPath( Brushes.Blue, path );
\r
578 Assert.That(t.PDCompare(), Is.True);
\r
581 public void FillModeWinding_2() {
\r
583 Rectangle r1 = new Rectangle(100, 100, 100, 100);
\r
584 Rectangle r2 = new Rectangle(125, 125, 50, 50);
\r
585 GraphicsPath path = new GraphicsPath();
\r
586 path.AddRectangle( r1 );
\r
587 path.AddRectangle( r2 );
\r
588 path.FillMode = FillMode.Winding;
\r
589 t.Graphics.FillPath( Brushes.Blue, path );
\r
591 Assert.That(t.PDCompare(), Is.True);
\r
594 public void FillModeWinding_3() {
\r
595 Point [] p = new Point[] {
\r
596 new Point(50, 100),
\r
597 new Point(150, 50),
\r
598 new Point(250, 100),
\r
600 new Point(250, 50),
\r
604 GraphicsPath path = new GraphicsPath();
\r
605 path.AddLines( p );
\r
606 path.FillMode = FillMode.Winding;
\r
607 t.Graphics.FillPath( Brushes.Blue, path );
\r
609 Assert.That(t.PDCompare(), Is.True);
\r
616 #region GraphicsFixture
\r
618 /// Summary description for Graphics.
\r
621 public class GraphicsFixture {
\r
622 protected DrawingTest t;
\r
623 protected int TOLERANCE = 3; //in %;
\r
624 protected Hashtable st = new Hashtable();
\r
627 public virtual void SetUp() {
\r
628 SetUp("GraphicsFixture");
\r
630 public virtual void SetUp(string ownerClass) {
\r
631 t = DrawingTest.Create(512, 512, ownerClass);
\r
633 // hashtable of differents tolerance values for specified tests. (for fft comparer)
\r
634 st["DrawArcTest:6"] = TOLERANCE * 2.5f;
\r
635 st["DrawCurveTestF:4"] = TOLERANCE * 2f;
\r
636 st["DrawPolygonPoint:2"] = TOLERANCE * 2f;
\r
637 st["DrawPolygonPointF:2"] = TOLERANCE * 2f;
\r
638 st["DrawStringFloatFormat:2"] = TOLERANCE * 2f; // in .net the font is shmoothed
\r
639 st["DrawStringFloatFormat:4"] = TOLERANCE * 2.5f; // in .net the font is shmoothed
\r
640 st["DrawStringFloatFormat:6"] = TOLERANCE * 2.5f; // in .net the font is shmoothed
\r
641 st["RotateTransformAngleMatrixOrder1:2"] = TOLERANCE * 2f; // Line width problem
\r
642 st["ScaleTransformFloatMatrixOrder:2"] = TOLERANCE * 2f; // Line width problem
\r
643 st["TranslateTransformAngleMatrixOrder:2"] = TOLERANCE * 2f; // Line width problem
\r
644 t.SpecialTolerance = st;
\r
648 public void TearDown ()
\r
655 public virtual void BeginContainerTest() {
\r
656 // Define transformation for container.
\r
657 RectangleF srcRect = new RectangleF(0.0F, 0.0F, 200.0F, 200.0F);
\r
658 RectangleF destRect = new RectangleF(100.0F, 100.0F, 150.0F, 150.0F);
\r
659 // Begin graphics container.
\r
660 GraphicsContainer containerState = t.Graphics.BeginContainer(
\r
662 GraphicsUnit.Pixel);
\r
663 // Fill red rectangle in container.
\r
664 t.Graphics.FillRectangle(new SolidBrush(Color.Red), 0.0F, 0.0F, 200.0F, 200.0F);
\r
666 // End graphics container.
\r
667 t.Graphics.EndContainer(containerState);
\r
668 // Fill untransformed rectangle with green.
\r
669 t.Graphics.FillRectangle(new SolidBrush(Color.Green), 0.0F, 0.0F, 200.0F, 200.0F);
\r
671 Assert.That(t.PDCompare(), Is.True);
\r
675 public void MeasureString () {
\r
676 Bitmap bmp = new Bitmap (400, 300, PixelFormat.Format32bppArgb);
\r
677 Graphics graphics = Graphics.FromImage (bmp);
\r
678 graphics.PageUnit = GraphicsUnit.Point;
\r
680 string drawString = "Sample Text in points";
\r
681 Font drawFont = new Font ("Arial Black", 70, FontStyle.Regular);
\r
682 SolidBrush drawBrush = new SolidBrush (Color.Blue);
\r
684 float netWidth1 = 836.1719f;
\r
685 float netWidth2 = 1114.896f;
\r
686 float netHeight1 = 98.71094f;
\r
687 float netHeight2 = 131.6146f;
\r
689 SizeF size = graphics.MeasureString (drawString, drawFont, new PointF (0, 0), StringFormat.GenericTypographic);
\r
691 Assert.That (Math.Abs (size.Width - netWidth1) / netWidth1 < 0.01, Is.True);
\r
692 Assert.That (Math.Abs (size.Height - netHeight1) / netHeight1 < 0.01, Is.True);
\r
694 graphics.PageUnit = GraphicsUnit.Pixel;
\r
695 size = graphics.MeasureString (drawString, drawFont, new PointF (0, 0), StringFormat.GenericTypographic);
\r
697 Assert.That (Math.Abs (size.Width - netWidth2) / netWidth2 < 0.01, Is.True);
\r
698 Assert.That (Math.Abs (size.Height - netHeight2) / netHeight2 < 0.01, Is.True);
\r
702 public virtual void BeginContainerTest_2() {
\r
703 t.Graphics.DrawRectangle( Pens.Black, new Rectangle(70, 70, 50, 100) );
\r
704 t.Graphics.DrawRectangle( Pens.Black, new Rectangle(50, 100, 150, 50) );
\r
705 t.Graphics.DrawRectangle( Pens.Black, new Rectangle(80, 120, 10, 10) );
\r
707 t.Graphics.SetClip( new Rectangle(70, 70, 50, 100) );
\r
708 t.Graphics.Clear( Color.Blue );
\r
710 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
711 t.Graphics.SetClip( new Rectangle(50, 100, 150, 50) );
\r
712 t.Graphics.Clear( Color.Green );
\r
714 GraphicsContainer c2 = t.Graphics.BeginContainer();
\r
715 t.Graphics.SetClip( new Rectangle(80, 120, 10, 10) );
\r
716 t.Graphics.Clear( Color.Red );
\r
718 t.Graphics.EndContainer( c2 );
\r
719 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(100, 120, 10, 10) );
\r
720 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(150, 120, 10, 10) );
\r
722 t.Graphics.EndContainer( c1 );
\r
723 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(100, 80, 10, 10) );
\r
724 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(150, 80, 10, 10) );
\r
727 Assert.That(t.PDCompare(), Is.True);
\r
730 public virtual void ClearTest() {
\r
731 // Clear screen with teal background.
\r
733 Assert.That(t.PDCompare(), Is.True);
\r
734 t.Graphics.Clear(Color.Teal);
\r
736 Assert.That(t.PDCompare(), Is.True);
\r
740 public virtual void DrawArcTest() {
\r
742 Pen blackPen= new Pen(Color.Black, 1);
\r
743 // Create coordinates of rectangle to bound ellipse.
\r
746 float width = 400.0F;
\r
747 float height = 100.0F;
\r
748 // Create start and sweep angles on ellipse.
\r
749 float startAngle = 370.0F;
\r
750 float sweepAngle = 70.0F;
\r
751 // Draw arc to screen.
\r
752 t.Graphics.DrawArc(blackPen, (int)x, (int)y, (int)width, (int)height, (int)startAngle, (int)sweepAngle);
\r
754 Assert.That(t.PDCompare(), Is.True);
\r
756 startAngle = 10.0F;
\r
757 sweepAngle = 120.0F;
\r
758 t.Graphics.DrawArc(blackPen, new Rectangle((int)x, (int)y, (int)width, (int)height), startAngle, sweepAngle);
\r
760 Assert.That(t.PDCompare(), Is.True);
\r
762 startAngle = 10.0F;
\r
763 sweepAngle = 190.0F;
\r
764 t.Graphics.DrawArc(blackPen, x, y, width, height, startAngle, sweepAngle);
\r
766 Assert.That(t.PDCompare(), Is.True);
\r
768 startAngle = 10.0F;
\r
769 sweepAngle = 300.0F;
\r
770 t.Graphics.DrawArc(blackPen, new RectangleF(x, y, width, height), startAngle, sweepAngle);
\r
772 Assert.That(t.PDCompare(), Is.True);
\r
774 startAngle = -179.9F;
\r
775 sweepAngle = -359.9F;
\r
776 t.Graphics.DrawArc(blackPen, new RectangleF(x, y, width, height), startAngle, sweepAngle);
\r
778 Assert.That(t.PDCompare(), Is.True);
\r
780 startAngle = -10.0F;
\r
781 sweepAngle = -300.0F;
\r
782 t.Graphics.DrawArc(blackPen, new RectangleF(x, y, width, height), startAngle, sweepAngle);
\r
784 Assert.That(t.PDCompare(), Is.True);
\r
788 public virtual void DrawBezierTest() {
\r
790 Pen blackPen = new Pen(Color.Black, 3);
\r
791 // Create coordinates of points for curve.
\r
792 float startX = 100.0F;
\r
793 float startY = 100.0F;
\r
794 float controlX1 = 200.0F;
\r
795 float controlY1 = 10.0F;
\r
796 float controlX2 = 350.0F;
\r
797 float controlY2 = 50.0F;
\r
798 float endX = 500.0F;
\r
799 float endY = 100.0F;
\r
800 // Draw arc to screen.
\r
801 t.Graphics.DrawBezier(blackPen, startX, startY,
\r
802 controlX1, controlY1,
\r
803 controlX2, controlY2,
\r
806 Assert.That(t.PDCompare(), Is.True);
\r
808 t.Graphics.DrawBezier(blackPen, new PointF( startX, startY),
\r
809 new PointF(controlX1, controlY1),
\r
810 new PointF(controlX2, controlY2),
\r
811 new PointF(endX, endY));
\r
813 Assert.That(t.PDCompare(), Is.True);
\r
815 t.Graphics.DrawBezier(blackPen, new Point((int)startX, (int)startY),
\r
816 new Point((int)controlX1, (int)controlY1),
\r
817 new Point((int)controlX2, (int)controlY2),
\r
818 new Point((int)endX, (int)endY));
\r
820 Assert.That(t.PDCompare(), Is.True);
\r
824 public virtual void DrawBeziersTest() {
\r
826 Pen blackPen = new Pen(Color.Black, 3);
\r
827 // Create points for curve.
\r
828 Point start = new Point(100, 100);
\r
829 Point control1 = new Point(200, 10);
\r
830 Point control2 = new Point(350, 50);
\r
831 Point end1 = new Point(500, 100);
\r
832 Point control3 = new Point(600, 150);
\r
833 Point control4 = new Point(650, 250);
\r
834 Point end2 = new Point(500, 300);
\r
835 Point[] bezierPoints = {
\r
836 start, control1, control2, end1,
\r
837 control3, control4, end2
\r
839 // Draw arc to screen.
\r
840 t.Graphics.DrawBeziers(blackPen, bezierPoints);
\r
842 Assert.That(t.PDCompare(), Is.True);
\r
845 PointF startF = new PointF(100.0F, 100.0F);
\r
846 PointF control1F = new PointF(200.0F, 10.0F);
\r
847 PointF control2F = new PointF(350.0F, 50.0F);
\r
848 PointF end1F = new PointF(500.0F, 100.0F);
\r
849 PointF control3F = new PointF(600.0F, 150.0F);
\r
850 PointF control4F = new PointF(650.0F, 250.0F);
\r
851 PointF end2F = new PointF(500.0F, 300.0F);
\r
852 PointF[] bezierPointsF = {
\r
853 startF, control1F, control2F, end1F,
\r
854 control3F, control4F, end2F
\r
856 // Draw arc to screen.
\r
857 t.Graphics.DrawBeziers(blackPen, bezierPointsF);
\r
859 Assert.That(t.PDCompare(), Is.True);
\r
863 public virtual void DrawClosedCurveTest() {
\r
865 Pen redPen = new Pen(Color.Red, 3);
\r
866 Pen greenPen = new Pen(Color.Green, 3);
\r
867 // Create points that define curve.
\r
868 PointF point1 = new PointF( 50.0F, 50.0F);
\r
869 PointF point2 = new PointF(100.0F, 25.0F);
\r
870 PointF point3 = new PointF(200.0F, 5.0F);
\r
871 PointF point4 = new PointF(250.0F, 50.0F);
\r
872 PointF point5 = new PointF(300.0F, 100.0F);
\r
873 PointF point6 = new PointF(350.0F, 200.0F);
\r
874 PointF point7 = new PointF(250.0F, 250.0F);
\r
875 PointF[] curvePoints = {
\r
884 // Draw lines between original points to screen.
\r
885 t.Graphics.DrawLines(redPen, curvePoints);
\r
886 // Create tension and fill mode.
\r
887 float tension = 0.7F;
\r
888 FillMode aFillMode = FillMode.Alternate;
\r
889 // Draw closed curve to screen.
\r
890 t.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);
\r
892 Assert.That(t.PDCompare(), Is.True);
\r
895 aFillMode = FillMode.Winding;
\r
896 // Draw closed curve to screen.
\r
897 t.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);
\r
899 Assert.That(t.PDCompare(), Is.True);
\r
903 public virtual void DrawCurveTest() {
\r
905 Pen redPen = new Pen(Color.Red, 3);
\r
906 Pen greenPen = new Pen(Color.Green, 3);
\r
907 // Create points that define curve.
\r
908 Point point1 = new Point( 50, 50);
\r
909 Point point2 = new Point(100, 25);
\r
910 Point point3 = new Point(200, 5);
\r
911 Point point4 = new Point(250, 50);
\r
912 Point point5 = new Point(300, 100);
\r
913 Point point6 = new Point(350, 200);
\r
914 Point point7 = new Point(250, 250);
\r
915 Point[] curvePoints = {
\r
924 // Draw lines between original points to screen.
\r
925 t.Graphics.DrawLines(redPen, curvePoints);
\r
926 // Create offset, number of segments, and tension.
\r
928 int numSegments = 4;
\r
929 float tension = 0.7F;
\r
930 // Draw curve to screen.
\r
931 t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);
\r
933 Assert.That(t.PDCompare(), Is.True);
\r
936 t.Graphics.DrawCurve(greenPen, curvePoints, tension);
\r
938 Assert.That(t.PDCompare(), Is.True);
\r
941 t.Graphics.DrawCurve(greenPen, curvePoints);
\r
943 Assert.That(t.PDCompare(), Is.True);
\r
947 public virtual void DrawCurveTestF() {
\r
949 Pen redPen = new Pen(Color.Red, 3);
\r
950 Pen greenPen = new Pen(Color.Green, 3);
\r
951 // Create points that define curve.
\r
952 PointF point1 = new PointF( 50.0F, 50.0F);
\r
953 PointF point2 = new PointF(100.0F, 25.0F);
\r
954 PointF point3 = new PointF(200.0F, 5.0F);
\r
955 PointF point4 = new PointF(250.0F, 50.0F);
\r
956 PointF point5 = new PointF(300.0F, 100.0F);
\r
957 PointF point6 = new PointF(350.0F, 200.0F);
\r
958 PointF point7 = new PointF(250.0F, 250.0F);
\r
959 PointF[] curvePoints = {
\r
968 // Draw lines between original points to screen.
\r
969 t.Graphics.DrawLines(redPen, curvePoints);
\r
970 // Create offset, number of segments, and tension.
\r
972 int numSegments = 4;
\r
973 float tension = 0.7F;
\r
974 // Draw curve to screen.
\r
975 t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);
\r
977 Assert.That(t.PDCompare(), Is.True);
\r
980 t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments);
\r
982 Assert.That(t.PDCompare(), Is.True);
\r
985 t.Graphics.DrawCurve(greenPen, curvePoints, tension);
\r
987 Assert.That(t.PDCompare(), Is.True);
\r
990 t.Graphics.DrawCurve(greenPen, curvePoints);
\r
992 Assert.That(t.PDCompare(), Is.True);
\r
996 public virtual void DrawEllipseTest() {
\r
998 Pen blackPen = new Pen(Color.Black, 3);
\r
999 // Create location and size of ellipse.
\r
1004 // Draw ellipse to screen.
\r
1005 t.Graphics.DrawEllipse(blackPen, x, y, width, height);
\r
1007 Assert.That(t.PDCompare(), Is.True);
\r
1010 t.Graphics.DrawEllipse(blackPen, new Rectangle(x, y, width, height));
\r
1012 Assert.That(t.PDCompare(), Is.True);
\r
1016 public virtual void DrawEllipseTestF() {
\r
1018 Pen blackPen = new Pen(Color.Black, 3);
\r
1019 // Create location and size of ellipse.
\r
1022 float width = 200.0F;
\r
1023 float height = 100.0F;
\r
1024 // Draw ellipse to screen.
\r
1025 t.Graphics.DrawEllipse(blackPen, x, y, width, height);
\r
1027 Assert.That(t.PDCompare(), Is.True);
\r
1030 t.Graphics.DrawEllipse(blackPen, new RectangleF(x, y, width, height));
\r
1032 Assert.That(t.PDCompare(), Is.True);
\r
1035 static string getInFile (string file) {
\r
1038 sRslt = Path.GetFullPath (file);
\r
1040 if (! File.Exists (file))
\r
1041 sRslt = Path.Combine (
\r
1042 Path.Combine ("..", ".."),
\r
1049 [Category("NotWorking")]
\r
1050 public virtual void DrawIconTest() {
\r
1052 Icon newIcon = new Icon(getInFile ("SampIcon.ico"));
\r
1053 // Create coordinates for upper-left corner of icon.
\r
1056 // Draw icon to screen.
\r
1057 t.Graphics.DrawIcon(newIcon, x, y);
\r
1059 Assert.That(t.PDCompare(), Is.True);
\r
1061 t.Graphics.DrawIcon(newIcon, new Rectangle(200, 300, 125, 345));
\r
1063 Assert.That(t.PDCompare(), Is.True);
\r
1067 [Category("NotWorking")]
\r
1068 public virtual void DrawIconUnstretchedTest() {
\r
1070 Icon newIcon = new Icon(getInFile ("SampIcon.ico"));
\r
1071 // Create rectangle for icon.
\r
1072 Rectangle rect = new Rectangle( 100, 100, 200, 200);
\r
1073 // Draw icon to screen.
\r
1074 t.Graphics.DrawIconUnstretched(newIcon, rect);
\r
1076 Assert.That(t.PDCompare(), Is.True);
\r
1078 #if INTPTR_SUPPORTED
\r
1079 // Define DrawImageAbort callback method.
\r
1080 private bool DrawImageCallback(IntPtr callBackData) {
\r
1081 // Test for call that passes callBackData parameter.
\r
1082 if(callBackData==IntPtr.Zero) {
\r
1083 // If no callBackData passed, abort DrawImage method.
\r
1087 // If callBackData passed, continue DrawImage method.
\r
1092 [Test] //TBD: add more overrides
\r
1093 public void DrawImageTest() {
\r
1094 // Create callback method.
\r
1095 Graphics.DrawImageAbort imageCallback
\r
1096 = new Graphics.DrawImageAbort(DrawImageCallback);
\r
1097 IntPtr imageCallbackData = new IntPtr(1);
\r
1099 Image newImage = Image.FromFile("SampIcon.ico");
\r
1100 // Create rectangle for displaying original image.
\r
1101 Rectangle destRect1 = new Rectangle( 100, 25, 450, 150);
\r
1102 // Create coordinates of rectangle for source image.
\r
1105 float width = 150.0F;
\r
1106 float height = 150.0F;
\r
1107 GraphicsUnit units = GraphicsUnit.Pixel;
\r
1108 // Draw original image to screen.
\r
1109 t.Graphics.DrawImage(newImage, destRect1, x, y, width, height, units);
\r
1111 // Create rectangle for adjusted image.
\r
1112 Rectangle destRect2 = new Rectangle(100, 175, 450, 150);
\r
1113 // Create image attributes and set large gamma.
\r
1114 ImageAttributes imageAttr = new ImageAttributes();
\r
1115 imageAttr.SetGamma(4.0F);
\r
1116 // Draw adjusted image to screen.
\r
1118 t.Graphics.DrawImage(
\r
1126 imageCallbackData);
\r
1132 [Category("NotWorking")]
\r
1133 public virtual void DrawImageUnscaledTest() {
\r
1135 Image newImage = Bitmap.FromFile(getInFile ("bitmap_gh.png"));
\r
1136 // Create coordinates for upper-left corner of image.
\r
1139 // Draw image to screen.
\r
1140 t.Graphics.DrawImageUnscaled(newImage, x, y, 100, 125);
\r
1142 Assert.That(t.PDCompare(), Is.True);
\r
1145 t.Graphics.DrawImageUnscaled(newImage, new Rectangle(x, y, 34, 235));
\r
1147 Assert.That(t.PDCompare(), Is.True);
\r
1150 t.Graphics.DrawImageUnscaled(newImage, x, y);
\r
1152 Assert.That(t.PDCompare(), Is.True);
\r
1155 t.Graphics.DrawImageUnscaled(newImage, new Point(x, y));
\r
1157 Assert.That(t.PDCompare(), Is.True);
\r
1161 public virtual void DrawLineTest() {
\r
1163 Pen blackPen = new Pen(Color.Black, 3);
\r
1164 // Create coordinates of points that define line.
\r
1169 // Draw line to screen.
\r
1170 t.Graphics.DrawLine(blackPen, x1, y1, x2, y2);
\r
1172 Assert.That(t.PDCompare(), Is.True);
\r
1175 t.Graphics.DrawLine(blackPen, new Point( x1, y1), new Point( x2, y2));
\r
1177 Assert.That(t.PDCompare(), Is.True);
\r
1181 public virtual void DrawLineTestF() {
\r
1183 Pen blackPen = new Pen(Color.Black, 3);
\r
1184 // Create coordinates of points that define line.
\r
1185 float x1 = 100.0F;
\r
1186 float y1 = 100.0F;
\r
1187 float x2 = 500.0F;
\r
1188 float y2 = 100.0F;
\r
1189 // Draw line to screen.
\r
1190 t.Graphics.DrawLine(blackPen, x1, y1, x2, y2);
\r
1192 Assert.That(t.PDCompare(), Is.True);
\r
1195 t.Graphics.DrawLine(blackPen, new PointF( x1, y1), new PointF( x2, y2));
\r
1197 Assert.That(t.PDCompare(), Is.True);
\r
1201 public virtual void DrawLinesTest() {
\r
1203 Pen pen = new Pen(Color.Black, 3);
\r
1204 // Create array of points that define lines to draw.
\r
1205 Point[] points = {
\r
1206 new Point( 10, 10),
\r
1207 new Point( 10, 100),
\r
1208 new Point(200, 50),
\r
1209 new Point(250, 300)
\r
1211 //Draw lines to screen.
\r
1212 t.Graphics.DrawLines(pen, points);
\r
1214 Assert.That(t.PDCompare(), Is.True);
\r
1218 public virtual void DrawLinesTestF() {
\r
1220 Pen pen = new Pen(Color.Black, 3);
\r
1221 // Create array of points that define lines to draw.
\r
1222 PointF[] points = {
\r
1223 new PointF( 10.0F, 10.0F),
\r
1224 new PointF( 10.0F, 100.0F),
\r
1225 new PointF(200.0F, 50.0F),
\r
1226 new PointF(250.0F, 300.0F)
\r
1228 //Draw lines to screen.
\r
1229 t.Graphics.DrawLines(pen, points);
\r
1231 Assert.That(t.PDCompare(), Is.True);
\r
1235 public virtual void DrawPathTest() {
\r
1236 // Create graphics path object and add ellipse.
\r
1237 GraphicsPath graphPath = new GraphicsPath();
\r
1238 graphPath.AddEllipse(0, 0, 200, 100);
\r
1240 Pen blackPen = new Pen(Color.Black, 3);
\r
1241 // Draw graphics path to screen.
\r
1242 t.Graphics.DrawPath(blackPen, graphPath);
\r
1244 Assert.That(t.PDCompare(), Is.True);
\r
1248 public virtual void DrawPieTestF() {
\r
1250 Pen blackPen = new Pen(Color.Black, 3);
\r
1251 // Create location and size of ellipse.
\r
1254 float width = 200.0F;
\r
1255 float height = 100.0F;
\r
1256 // Create start and sweep angles.
\r
1257 float startAngle = 0.0F;
\r
1258 float sweepAngle = 45.0F;
\r
1259 // Draw pie to screen.
\r
1260 t.Graphics.DrawPie(blackPen, x, y, width, height, startAngle, sweepAngle);
\r
1262 Assert.That(t.PDCompare(), Is.True);
\r
1265 t.Graphics.DrawPie(blackPen, new RectangleF( x, y, width, height), startAngle, sweepAngle);
\r
1267 Assert.That(t.PDCompare(), Is.True);
\r
1271 public virtual void DrawPieTest() {
\r
1273 Pen blackPen = new Pen(Color.Black, 3);
\r
1274 // Create location and size of ellipse.
\r
1279 // Create start and sweep angles.
\r
1280 int startAngle = 0;
\r
1281 int sweepAngle = 45;
\r
1282 // Draw pie to screen.
\r
1283 t.Graphics.DrawPie(blackPen, x, y, width, height, startAngle, sweepAngle);
\r
1285 Assert.That(t.PDCompare(), Is.True);
\r
1288 t.Graphics.DrawPie(blackPen, new Rectangle( x, y, width, height), startAngle, sweepAngle);
\r
1290 Assert.That(t.PDCompare(), Is.True);
\r
1294 public virtual void DrawPolygonPoint() {
\r
1296 Pen blackPen = new Pen(Color.Black, 3);
\r
1297 // Create points that define polygon.
\r
1298 Point point1 = new Point( 50, 50);
\r
1299 Point point2 = new Point(100, 25);
\r
1300 Point point3 = new Point(200, 5);
\r
1301 Point point4 = new Point(250, 50);
\r
1302 Point point5 = new Point(300, 100);
\r
1303 Point point6 = new Point(350, 200);
\r
1304 Point point7 = new Point(250, 250);
\r
1305 Point[] curvePoints = {
\r
1314 // Draw polygon to screen.
\r
1315 t.Graphics.DrawPolygon(blackPen, curvePoints);
\r
1317 Assert.That(t.PDCompare()); // .NET's lines of polygon is more wi, Is.Truede
\r
1321 public virtual void DrawPolygonPointF() {
\r
1323 Pen blackPen = new Pen(Color.Black, 3);
\r
1324 // Create points that define polygon.
\r
1325 PointF point1 = new PointF( 50, 50);
\r
1326 PointF point2 = new PointF(100, 25);
\r
1327 PointF point3 = new PointF(200, 5);
\r
1328 PointF point4 = new PointF(250, 50);
\r
1329 PointF point5 = new PointF(300, 100);
\r
1330 PointF point6 = new PointF(350, 200);
\r
1331 PointF point7 = new PointF(250, 250);
\r
1332 PointF[] curvePoints = {
\r
1341 // Draw polygon to screen.
\r
1342 t.Graphics.DrawPolygon(blackPen, curvePoints);
\r
1344 Assert.That(t.PDCompare(), Is.True);
\r
1348 public virtual void DrawRectangleFloat() {
\r
1350 Pen blackPen = new Pen(Color.Black, 3);
\r
1351 // Create location and size of rectangle.
\r
1354 float width = 200.0F;
\r
1355 float height = 200.0F;
\r
1356 // Draw rectangle to screen.
\r
1357 t.Graphics.DrawRectangle(blackPen, x, y, width, height);
\r
1359 Assert.That(t.PDCompare(), Is.True);
\r
1362 t.Graphics.DrawRectangle(blackPen, (int)x, (int)y, (int)width, (int)height);
\r
1364 Assert.That(t.PDCompare(), Is.True);
\r
1367 t.Graphics.DrawRectangle(blackPen, new Rectangle( (int)x, (int)y, (int)width, (int)height));
\r
1369 Assert.That(t.PDCompare(), Is.True);
\r
1373 public virtual void DrawRectanglesRectangleF() {
\r
1375 Pen blackPen = new Pen(Color.Black, 3);
\r
1376 // Create array of rectangles.
\r
1377 RectangleF[] rects = {
\r
1378 new RectangleF( 20.0F, 20.0F, 100.0F, 200.0F),
\r
1379 new RectangleF(100.0F, 200.0F, 250.0F, 50.0F),
\r
1380 new RectangleF(300.0F, 20.0F, 50.0F, 100.0F)
\r
1382 // Draw rectangles to screen.
\r
1383 t.Graphics.DrawRectangles(blackPen, rects);
\r
1385 Assert.That(t.PDCompare(), Is.True);
\r
1389 public virtual void DrawRectanglesRectangle() {
\r
1391 Pen blackPen = new Pen(Color.Black, 3);
\r
1392 // Create array of rectangles.
\r
1393 Rectangle[] rects = {
\r
1394 new Rectangle( 20, 20, 100, 200),
\r
1395 new Rectangle(100, 200, 250, 50),
\r
1396 new Rectangle(300, 20, 50, 100)
\r
1398 // Draw rectangles to screen.
\r
1399 t.Graphics.DrawRectangles(blackPen, rects);
\r
1401 Assert.That(t.PDCompare(), Is.True);
\r
1404 [Test] //TBD: add more combinations
\r
1405 [Category("NotWorking")]
\r
1406 public virtual void DrawStringFloatFormat() {
\r
1407 // Create string to draw.
\r
1408 String drawString = "Sample Text";
\r
1409 // Create font and brush.
\r
1410 Font drawFont = new Font("Arial", 34, FontStyle.Italic);
\r
1411 SolidBrush drawBrush = new SolidBrush(Color.Black);
\r
1412 // Create point for upper-left corner of drawing.
\r
1415 // Set format of string.
\r
1416 StringFormat drawFormat = new StringFormat();
\r
1417 drawFormat.FormatFlags = StringFormatFlags.DirectionVertical;
\r
1418 // Draw string to screen.
\r
1419 t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
\r
1421 Assert.That(t.PDCompare()); // in .net the font is shmooth, Is.Trueed
\r
1424 drawFormat.FormatFlags = StringFormatFlags.NoClip;
\r
1425 // Draw string to screen.
\r
1426 t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
\r
1428 Assert.That(t.PDCompare(), Is.True);
\r
1431 drawFormat.FormatFlags = StringFormatFlags.FitBlackBox;
\r
1432 // Draw string to screen.
\r
1433 t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
\r
1435 Assert.That(t.PDCompare(), Is.True);
\r
1439 public virtual void EndContainerState() {
\r
1440 // Begin graphics container.
\r
1441 GraphicsContainer containerState = t.Graphics.BeginContainer();
\r
1442 // Translate world transformation.
\r
1443 t.Graphics.TranslateTransform(100.0F, 100.0F);
\r
1444 // Fill translated rectangle in container with red.
\r
1445 t.Graphics.FillRectangle(new SolidBrush(Color.Red), 0, 0, 200, 200);
\r
1447 // End graphics container.
\r
1448 t.Graphics.EndContainer(containerState);
\r
1449 // Fill untransformed rectangle with green.
\r
1450 t.Graphics.FillRectangle(new SolidBrush(Color.Green), 0, 0, 200, 200);
\r
1452 Assert.That(t.PDCompare(), Is.True);
\r
1456 public virtual void EnumerateMetafile() {
\r
1460 public virtual void ExcludeClipRegion() {
\r
1461 // Create rectangle for exclusion.
\r
1462 Rectangle excludeRect = new Rectangle(100, 100, 200, 200);
\r
1463 // Set clipping region to exclude rectangle.
\r
1464 t.Graphics.ExcludeClip(excludeRect);
\r
1465 // Fill large rectangle to show clipping region.
\r
1466 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 300, 300);
\r
1468 Assert.That(t.PDCompare(), Is.True);
\r
1472 public virtual void FillClosedCurvePointFillModeTension() {
\r
1473 // Create solid brush.
\r
1474 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1475 // Create array of points for curve.
\r
1476 Point point1 = new Point(100, 100);
\r
1477 Point point2 = new Point(200, 50);
\r
1478 Point point3 = new Point(250, 200);
\r
1479 Point point4 = new Point( 50, 150);
\r
1480 Point[] points = {point1, point2, point3, point4};
\r
1482 FillMode newFillMode = FillMode.Winding;
\r
1484 float tension = 0.68F;
\r
1485 // Fill curve on screen.
\r
1486 t.Graphics.FillClosedCurve(redBrush, points);
\r
1488 Assert.That(t.PDCompare(), Is.True);
\r
1491 t.Graphics.FillClosedCurve(redBrush, points, newFillMode);
\r
1493 Assert.That(t.PDCompare(), Is.True);
\r
1496 newFillMode = FillMode.Alternate;
\r
1497 t.Graphics.FillClosedCurve(redBrush, points, newFillMode, tension);
\r
1499 Assert.That(t.PDCompare(), Is.True);
\r
1503 public virtual void FillClosedCurvePointFFillModeTension() {
\r
1504 // Create solid brush.
\r
1505 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1506 // Create array of points for curve.
\r
1507 PointF point1 = new PointF(100.0F, 100.0F);
\r
1508 PointF point2 = new PointF(200.0F, 50.0F);
\r
1509 PointF point3 = new PointF(250.0F, 200.0F);
\r
1510 PointF point4 = new PointF( 50.0F, 150.0F);
\r
1511 PointF[] points = {point1, point2, point3, point4};
\r
1513 FillMode newFillMode = FillMode.Winding;
\r
1515 float tension = 0.68F;
\r
1516 // Fill curve on screen.
\r
1517 t.Graphics.FillClosedCurve(redBrush, points);
\r
1519 Assert.That(t.PDCompare(), Is.True);
\r
1522 t.Graphics.FillClosedCurve(redBrush, points, newFillMode);
\r
1524 Assert.That(t.PDCompare(), Is.True);
\r
1527 newFillMode = FillMode.Alternate;
\r
1528 t.Graphics.FillClosedCurve(redBrush, points, newFillMode, tension);
\r
1530 Assert.That(t.PDCompare(), Is.True);
\r
1534 public virtual void FillEllipse() {
\r
1535 // Create solid brush.
\r
1536 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1537 // Create location and size of ellipse.
\r
1542 // Fill ellipse on screen.
\r
1543 t.Graphics.FillEllipse(redBrush, x, y, width, height);
\r
1545 Assert.That(t.PDCompare(), Is.True);
\r
1548 t.Graphics.FillEllipse(redBrush, new Rectangle( x, y, width, height));
\r
1550 Assert.That(t.PDCompare(), Is.True);
\r
1554 public virtual void FillEllipseFloat() {
\r
1555 // Create solid brush.
\r
1556 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1557 // Create location and size of ellipse.
\r
1560 float width = 200.0F;
\r
1561 float height = 100.0F;
\r
1562 // Fill ellipse on screen.
\r
1563 t.Graphics.FillEllipse(redBrush, x, y, width, height);
\r
1565 Assert.That(t.PDCompare(), Is.True);
\r
1568 t.Graphics.FillEllipse(redBrush, new RectangleF( x, y, width, height));
\r
1570 Assert.That(t.PDCompare(), Is.True);
\r
1574 public virtual void FillPathEllipse() {
\r
1575 // Create solid brush.
\r
1576 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1577 // Create graphics path object and add ellipse.
\r
1578 GraphicsPath graphPath = new GraphicsPath();
\r
1579 graphPath.AddEllipse(0, 0, 200, 100);
\r
1580 // Fill graphics path to screen.
\r
1581 t.Graphics.FillPath(redBrush, graphPath);
\r
1583 Assert.That(t.PDCompare(), Is.True);
\r
1587 public virtual void FillPieFloat() {
\r
1588 // Create solid brush.
\r
1589 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1590 // Create location and size of ellipse.
\r
1595 // Create start and sweep angles.
\r
1596 float startAngle = 0.0F;
\r
1597 float sweepAngle = 45.0F;
\r
1598 // Fill pie to screen.
\r
1599 t.Graphics.FillPie(redBrush, new Rectangle(x, y, width, height), startAngle, sweepAngle);
\r
1601 Assert.That(t.PDCompare(), Is.True);
\r
1604 t.Graphics.FillPie(redBrush, x, y, width, height, (int)startAngle, (int)sweepAngle);
\r
1606 Assert.That(t.PDCompare(), Is.True);
\r
1609 t.Graphics.FillPie(redBrush, (float)x, (float)y, (float)width, (float)height, startAngle, sweepAngle);
\r
1611 Assert.That(t.PDCompare(), Is.True);
\r
1615 public virtual void FillPolygonPointFillMode() {
\r
1616 // Create solid brush.
\r
1617 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1618 // Create points that define polygon.
\r
1619 Point point1 = new Point( 50, 50);
\r
1620 Point point2 = new Point(100, 25);
\r
1621 Point point3 = new Point(200, 5);
\r
1622 Point point4 = new Point(250, 50);
\r
1623 Point point5 = new Point(300, 100);
\r
1624 Point point6 = new Point(350, 200);
\r
1625 Point point7 = new Point(250, 250);
\r
1626 Point[] curvePoints = {
\r
1636 // Fill polygon to screen.
\r
1637 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Winding);
\r
1639 Assert.That(t.PDCompare(), Is.True);
\r
1642 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Alternate);
\r
1644 Assert.That(t.PDCompare(), Is.True);
\r
1647 t.Graphics.FillPolygon(blueBrush, curvePoints);
\r
1649 Assert.That(t.PDCompare(), Is.True);
\r
1653 public virtual void FillPolygonPointFFillMode() {
\r
1654 // Create solid brush.
\r
1655 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1656 // Create points that define polygon.
\r
1657 PointF point1 = new PointF( 50.0F, 50.0F);
\r
1658 PointF point2 = new PointF(100.0F, 25.0F);
\r
1659 PointF point3 = new PointF(200.0F, 5.0F);
\r
1660 PointF point4 = new PointF(250.0F, 50.0F);
\r
1661 PointF point5 = new PointF(300.0F, 100.0F);
\r
1662 PointF point6 = new PointF(350.0F, 200.0F);
\r
1663 PointF point7 = new PointF(250.0F, 250.0F);
\r
1664 PointF[] curvePoints = {
\r
1674 // Fill polygon to screen.
\r
1675 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Winding);
\r
1677 Assert.That(t.PDCompare(), Is.True);
\r
1680 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Alternate);
\r
1682 Assert.That(t.PDCompare(), Is.True);
\r
1685 t.Graphics.FillPolygon(blueBrush, curvePoints);
\r
1687 Assert.That(t.PDCompare(), Is.True);
\r
1691 public virtual void FillRectangle() {
\r
1692 // Create solid brush.
\r
1693 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1694 // Create location and size of rectangle.
\r
1699 // Fill rectangle to screen.
\r
1700 t.Graphics.FillRectangle(blueBrush, x, y, width, height);
\r
1702 Assert.That(t.PDCompare(), Is.True);
\r
1705 t.Graphics.FillRectangle(blueBrush, new Rectangle( x, y, width, height));
\r
1707 Assert.That(t.PDCompare(), Is.True);
\r
1711 public virtual void FillRectangleFloat() {
\r
1712 // Create solid brush.
\r
1713 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1714 // Create location and size of rectangle.
\r
1717 float width = 300.0F;
\r
1718 float height = 200.0F;
\r
1719 // Fill rectangle to screen.
\r
1720 t.Graphics.FillRectangle(blueBrush, x, y, width, height);
\r
1722 Assert.That(t.PDCompare(), Is.True);
\r
1725 t.Graphics.FillRectangle(blueBrush, new RectangleF( x, y, width, height));
\r
1727 Assert.That(t.PDCompare(), Is.True);
\r
1731 public virtual void FillRectanglesRectangle() {
\r
1732 // Create solid brush.
\r
1733 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1734 // Create array of rectangles.
\r
1735 Rectangle[] rects = {
\r
1736 new Rectangle( 0, 0, 100, 200),
\r
1737 new Rectangle(100, 200, 250, 50),
\r
1738 new Rectangle(300, 0, 50, 100)
\r
1740 // Fill rectangles to screen.
\r
1741 t.Graphics.FillRectangles(blueBrush, rects);
\r
1743 Assert.That(t.PDCompare(), Is.True);
\r
1747 public virtual void FillRectanglesRectangleF() {
\r
1748 // Create solid brush.
\r
1749 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1750 // Create array of rectangles.
\r
1751 RectangleF[] rects = {
\r
1752 new RectangleF( 0.0F, 0.0F, 100.0F, 200.0F),
\r
1753 new RectangleF(100.0F, 200.0F, 250.0F, 50.0F),
\r
1754 new RectangleF(300.0F, 0.0F, 50.0F, 100.0F)
\r
1756 // Fill rectangles to screen.
\r
1757 t.Graphics.FillRectangles(blueBrush, rects);
\r
1759 Assert.That(t.PDCompare(), Is.True);
\r
1763 public virtual void FillRegionRectangle() {
\r
1764 // Create solid brush.
\r
1765 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1766 // Create rectangle for region.
\r
1767 Rectangle fillRect = new Rectangle(100, 150, 200, 250);
\r
1768 // Create region for fill.
\r
1769 Region fillRegion = new Region(fillRect);
\r
1770 // Fill region to screen.
\r
1771 t.Graphics.FillRegion(blueBrush, fillRegion);
\r
1773 Assert.That(t.PDCompare(), Is.True);
\r
1777 public virtual void FlushTest() {
\r
1778 t.Graphics.Flush();
\r
1779 t.Graphics.Flush(FlushIntention.Flush);
\r
1783 public virtual void IntersectClipRegion() {
\r
1784 // Set clipping region.
\r
1785 Rectangle clipRect = new Rectangle(0, 0, 200, 300);
\r
1786 Region clipRegion = new Region(clipRect);
\r
1787 t.Graphics.SetClip(clipRegion, CombineMode.Replace);
\r
1788 // Update clipping region to intersection of
\r
1789 // existing region with specified rectangle.
\r
1790 Rectangle intersectRect = new Rectangle(100, 100, 200, 300);
\r
1791 Region intersectRegion = new Region(intersectRect);
\r
1792 t.Graphics.IntersectClip(intersectRegion);
\r
1793 // Fill rectangle to demonstrate effective clipping region.
\r
1794 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 600);
\r
1796 // Reset clipping region to infinite.
\r
1797 t.Graphics.ResetClip();
\r
1798 // Draw clipRect and intersectRect to screen.
\r
1799 t.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
\r
1801 t.Graphics.DrawRectangle(new Pen(Color.Red), intersectRect);
\r
1803 Assert.That(t.PDCompare(), Is.True);
\r
1807 public virtual void IsVisible4Float() {
\r
1808 // Set clip region.
\r
1809 Region clipRegion = new Region(new Rectangle(50, 50, 100, 100));
\r
1810 t.Graphics.SetClip(clipRegion, CombineMode.Replace);
\r
1811 // Set up coordinates of rectangles.
\r
1812 float x1 = 100.0F;
\r
1813 float y1 = 100.0F;
\r
1814 float width1 = 20.0F;
\r
1815 float height1 = 20.0F;
\r
1816 float x2 = 200.0F;
\r
1817 float y2 = 200.0F;
\r
1818 float width2 = 20.0F;
\r
1819 float height2 = 20.0F;
\r
1820 // If rectangle is visible, fill it.
\r
1821 if (t.Graphics.IsVisible(x1, y1, width1, height1)) {
\r
1822 t.Graphics.FillRectangle(new SolidBrush(Color.Red), x1, y1, width1, height1);
\r
1825 if (t.Graphics.IsVisible(x2, y2, width2, height2)) {
\r
1826 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), x2, y2, width2, height2);
\r
1830 Assert.That(t.PDCompare(), Is.True);
\r
1834 [Category("NotWorking")]
\r
1835 public virtual void MeasureCharacterRangesRegions() {
\r
1837 string measureString = "First and Second ranges";
\r
1838 Font stringFont = new Font("Times New Roman", 16.0F);
\r
1839 // Set character ranges to "First" and "Second".
\r
1840 CharacterRange[] characterRanges = {
\r
1841 new CharacterRange(0, 5),
\r
1842 new CharacterRange(10, 6)
\r
1844 // Create rectangle for layout.
\r
1847 float width = 35.0F;
\r
1848 float height = 200.0F;
\r
1849 RectangleF layoutRect = new RectangleF(x, y, width, height);
\r
1850 // Set string format.
\r
1851 StringFormat stringFormat = new StringFormat();
\r
1852 stringFormat.FormatFlags = StringFormatFlags.DirectionVertical;
\r
1853 stringFormat.SetMeasurableCharacterRanges(characterRanges);
\r
1854 // Draw string to screen.
\r
1855 t.Graphics.DrawString(
\r
1861 // Measure two ranges in string.
\r
1862 Region[] stringRegions = new Region[2];
\r
1863 stringRegions = t.Graphics.MeasureCharacterRanges(
\r
1868 // Draw rectangle for first measured range.
\r
1869 RectangleF measureRect1 = stringRegions[0].GetBounds(t.Graphics);
\r
1870 t.Graphics.DrawRectangle(
\r
1871 new Pen(Color.Red, 1),
\r
1872 Rectangle.Round(measureRect1));
\r
1874 // Draw rectangle for second measured range.
\r
1875 RectangleF measureRect2 = stringRegions[1].GetBounds(t.Graphics);
\r
1876 t.Graphics.DrawRectangle(
\r
1877 new Pen(Color.Blue, 1),
\r
1878 Rectangle.Round(measureRect2));
\r
1880 Assert.That(t.PDCompare(), Is.True);
\r
1883 [Test] //TBD: add more overloads
\r
1884 [Category("NotWorking")]
\r
1885 public virtual void MeasureStringSizeFFormatInts() {
\r
1887 string measureString = "Measure String";
\r
1888 Font stringFont = new Font("Arial", 16);
\r
1889 // Set maximum layout size.
\r
1890 SizeF layoutSize = new SizeF(100.0F, 200.0F);
\r
1891 // Set string format.
\r
1892 StringFormat newStringFormat = new StringFormat();
\r
1893 newStringFormat.FormatFlags = StringFormatFlags.DirectionVertical;
\r
1894 // Measure string.
\r
1895 int charactersFitted;
\r
1897 SizeF stringSize = new SizeF();
\r
1898 stringSize = t.Graphics.MeasureString(
\r
1903 out charactersFitted,
\r
1905 // Draw rectangle representing size of string.
\r
1906 t.Graphics.DrawRectangle(
\r
1907 new Pen(Color.Red, 1),
\r
1908 0.0F, 0.0F, stringSize.Width, stringSize.Height);
\r
1910 // Draw string to screen.
\r
1911 t.Graphics.DrawString(
\r
1918 // Draw output parameters to screen.
\r
1919 string outString = "chars " + charactersFitted + ", lines " + linesFilled;
\r
1920 t.Graphics.DrawString(
\r
1924 new PointF(100, 0));
\r
1926 Assert.That(t.PDCompare(), Is.True);
\r
1930 public virtual void MultiplyTransform() {
\r
1931 // Create transform matrix.
\r
1932 Matrix transformMatrix = new Matrix();
\r
1933 // Translate matrix, prepending translation vector.
\r
1934 transformMatrix.Translate(200.0F, 100.0F);
\r
1935 // Rotate transformation matrix of graphics object,
\r
1936 // prepending rotation matrix.
\r
1937 t.Graphics.RotateTransform(30.0F);
\r
1938 // Multiply (append to) transformation matrix of
\r
1939 // graphics object to translate graphics transformation.
\r
1940 t.Graphics.MultiplyTransform(transformMatrix);
\r
1941 // Draw rotated, translated ellipse.
\r
1942 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
\r
1944 Assert.That(t.PDCompare(), Is.True);
\r
1948 public virtual void MultiplyTransformMatrixOrder() {
\r
1949 // Create transform matrix.
\r
1950 Matrix transformMatrix = new Matrix();
\r
1951 // Translate matrix, prepending translation vector.
\r
1952 transformMatrix.Translate(200.0F, 100.0F);
\r
1953 // Rotate transformation matrix of graphics object,
\r
1954 // prepending rotation matrix.
\r
1955 t.Graphics.RotateTransform(30.0F);
\r
1956 // Multiply (append to) transformation matrix of
\r
1957 // graphics object to translate graphics transformation.
\r
1958 t.Graphics.MultiplyTransform(transformMatrix, MatrixOrder.Append);
\r
1959 // Draw rotated, translated ellipse.
\r
1960 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
\r
1962 Assert.That(t.PDCompare(), Is.True);
\r
1966 public virtual void MultiplyTransformMatrixOrder1() {
\r
1967 // Create transform matrix.
\r
1968 Matrix transformMatrix = new Matrix();
\r
1969 // Translate matrix, prepending translation vector.
\r
1970 transformMatrix.Translate(200.0F, 100.0F);
\r
1971 // Rotate transformation matrix of graphics object,
\r
1972 // prepending rotation matrix.
\r
1973 t.Graphics.RotateTransform(30.0F);
\r
1974 // Multiply (append to) transformation matrix of
\r
1975 // graphics object to translate graphics transformation.
\r
1976 t.Graphics.MultiplyTransform(transformMatrix, MatrixOrder.Prepend);
\r
1977 // Draw rotated, translated ellipse.
\r
1978 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
\r
1980 Assert.That(t.PDCompare(), Is.True);
\r
1984 public virtual void ResetClipIntersectClipRectangleF() {
\r
1985 // Set clipping region.
\r
1986 Rectangle clipRect = new Rectangle(0, 0, 200, 200);
\r
1987 t.Graphics.SetClip(clipRect);
\r
1988 // Update clipping region to intersection of existing region with new rectangle.
\r
1989 RectangleF intersectRectF = new RectangleF(100.0F, 100.0F, 200.0F, 200.0F);
\r
1990 t.Graphics.IntersectClip(intersectRectF);
\r
1991 // Fill rectangle to demonstrate effective clipping region.
\r
1992 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 500);
\r
1993 // Reset clipping region to infinite.
\r
1994 t.Graphics.ResetClip();
\r
1995 // Draw clipRect and intersectRect to screen.
\r
1996 t.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
\r
1997 t.Graphics.DrawRectangle(new Pen(Color.Red), Rectangle.Round(intersectRectF));
\r
1999 Assert.That(t.PDCompare(), Is.True);
\r
2003 public virtual void SaveRestoreTranslate() {
\r
2004 // Translate transformation matrix.
\r
2005 t.Graphics.TranslateTransform(100, 0);
\r
2006 // Save translated graphics state.
\r
2007 GraphicsState transState = t.Graphics.Save();
\r
2008 // Reset transformation matrix to identity and fill rectangle.
\r
2009 t.Graphics.ResetTransform();
\r
2010 t.Graphics.FillRectangle(new SolidBrush(Color.Red), 0, 0, 100, 100);
\r
2012 // Restore graphics state to translated state and fill second rectangle.
\r
2013 t.Graphics.Restore(transState);
\r
2014 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 100, 100);
\r
2016 Assert.That(t.PDCompare(), Is.True);
\r
2020 public virtual void RotateTransformAngleMatrixOrder() {
\r
2021 // Set world transform of graphics object to translate.
\r
2022 t.Graphics.TranslateTransform(100.0F, 0.0F);
\r
2023 // Then to rotate, appending rotation matrix.
\r
2024 t.Graphics.RotateTransform(30.0F, MatrixOrder.Append);
\r
2025 // Draw translated, rotated ellipse to screen.
\r
2026 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2028 Assert.That(t.PDCompare(), Is.True);
\r
2032 public virtual void RotateTransformAngleMatrixOrder1() {
\r
2033 // Set world transform of graphics object to translate.
\r
2034 t.Graphics.TranslateTransform(100.0F, 0.0F);
\r
2035 // Then to rotate, appending rotation matrix.
\r
2036 t.Graphics.RotateTransform(30.0F, MatrixOrder.Prepend);
\r
2037 // Draw translated, rotated ellipse to screen.
\r
2038 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2040 Assert.That(t.PDCompare()); // Line width probl, Is.Trueem
\r
2044 public virtual void ScaleTransformFloatMatrixOrder() {
\r
2045 // Set world transform of graphics object to rotate.
\r
2046 t.Graphics.RotateTransform(30.0F);
\r
2047 // Then to scale, appending to world transform.
\r
2048 t.Graphics.ScaleTransform(3.0F, 1.0F, MatrixOrder.Append);
\r
2049 // Draw rotated, scaled rectangle to screen.
\r
2050 t.Graphics.DrawRectangle(new Pen(Color.Blue, 3), 50, 0, 100, 40);
\r
2052 Assert.That(t.PDCompare()); // Line width probl, Is.Trueem
\r
2056 public virtual void ScaleTransformFloatMatrixOrder1() {
\r
2057 // Set world transform of graphics object to rotate.
\r
2058 t.Graphics.RotateTransform(30.0F);
\r
2059 // Then to scale, appending to world transform.
\r
2060 t.Graphics.ScaleTransform(3.0F, 1.0F, MatrixOrder.Prepend);
\r
2061 // Draw rotated, scaled rectangle to screen.
\r
2062 t.Graphics.DrawRectangle(new Pen(Color.Blue, 3), 50, 0, 100, 40);
\r
2064 Assert.That(t.PDCompare(), Is.True);
\r
2067 [Test] //TBD: add more combination
\r
2068 public virtual void SetClipRegionCombine() {
\r
2069 // Create region for clipping.
\r
2070 Region clipRegion = new Region(new Rectangle(0, 0, 200, 100));
\r
2071 // Set clipping region of graphics to region.
\r
2072 t.Graphics.SetClip(clipRegion, CombineMode.Replace);
\r
2073 // Fill rectangle to demonstrate clip region.
\r
2074 t.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
\r
2076 Assert.That(t.PDCompare(), Is.True);
\r
2080 public virtual void TransformPointsPointF() {
\r
2081 // Create array of two points.
\r
2082 PointF[] points = {new PointF(0.0F, 0.0F),
\r
2083 new PointF(100.0F, 50.0F)};
\r
2084 // Draw line connecting two untransformed points.
\r
2085 t.Graphics.DrawLine(new Pen(Color.Blue, 3),
\r
2088 // Set world transformation of Graphics object to translate.
\r
2089 t.Graphics.TranslateTransform(40.0F, 30.0F);
\r
2090 // Transform points in array from world to page coordinates.
\r
2091 t.Graphics.TransformPoints(CoordinateSpace.Page,
\r
2092 CoordinateSpace.World,
\r
2094 // Reset world transformation.
\r
2095 t.Graphics.ResetTransform();
\r
2096 // Draw line that connects transformed points.
\r
2097 t.Graphics.DrawLine(new Pen(Color.Red, 3),
\r
2101 Assert.That(t.PDCompare(), Is.True);
\r
2105 public virtual void TranslateClipFloat() {
\r
2106 // Create rectangle for clipping region.
\r
2107 RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);
\r
2108 // Set clipping region of graphics to rectangle.
\r
2109 t.Graphics.SetClip(clipRect);
\r
2110 // Translate clipping region.
\r
2113 t.Graphics.TranslateClip(dx, dy);
\r
2114 // Fill rectangle to demonstrate translated clip region.
\r
2115 t.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
\r
2117 Assert.That(t.PDCompare(), Is.True);
\r
2121 public virtual void TranslateTransformAngleMatrixOrder() {
\r
2122 // Set world transform of graphics object to rotate.
\r
2123 t.Graphics.RotateTransform(30.0F);
\r
2124 // Then to translate, appending to world transform.
\r
2125 t.Graphics.TranslateTransform(100.0F, 0.0F, MatrixOrder.Append);
\r
2126 // Draw rotated, translated ellipse to screen.
\r
2127 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2129 Assert.That(t.PDCompare()); // Line width probl, Is.Trueem
\r
2133 public virtual void TranslateTransformAngleMatrixOrder1() {
\r
2134 // Set world transform of graphics object to rotate.
\r
2135 t.Graphics.RotateTransform(30.0F);
\r
2136 // Then to translate, appending to world transform.
\r
2137 t.Graphics.TranslateTransform(100.0F, 0.0F, MatrixOrder.Prepend);
\r
2138 // Draw rotated, translated ellipse to screen.
\r
2139 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2141 Assert.That(t.PDCompare(), Is.True);
\r
2145 public virtual void TransfromPageScaleUnits() {
\r
2146 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2147 t.Graphics.PageScale = 1.0F;
\r
2148 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2150 t.Graphics.PageUnit = GraphicsUnit.Document;
\r
2151 t.Graphics.PageScale = 10.0F;
\r
2152 t.Graphics.DrawLine(Pens.Blue, 10, 70, 70, 10);
\r
2154 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
2155 t.Graphics.PageScale = 0.055F;
\r
2156 t.Graphics.DrawLine(Pens.Green, 10, 70, 70, 10);
\r
2158 Matrix mx=new Matrix(0.5f,0,0,0.5f,0,0);
\r
2159 t.Graphics.Transform = mx;
\r
2161 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
2162 t.Graphics.DrawLine(Pens.Black, 10, 70, 70, 10);
\r
2164 t.Graphics.PageUnit = GraphicsUnit.Point;
\r
2165 t.Graphics.PageScale = 2.7F;
\r
2166 t.Graphics.DrawLine(Pens.Yellow, 10, 70, 70, 10);
\r
2169 Assert.That(t.PDCompare(), Is.True);
\r
2173 public virtual void TransfromPageScaleUnits_2() {
\r
2174 t.Graphics.RotateTransform(45);
\r
2175 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2176 t.Graphics.PageScale = 1.0F;
\r
2177 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2179 t.Graphics.TranslateTransform(100, 0);
\r
2180 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2181 t.Graphics.PageScale = 2.0F;
\r
2182 t.Graphics.DrawLine(Pens.Blue, 10, 70, 70, 10);
\r
2184 t.Graphics.ResetTransform();
\r
2185 t.Graphics.DrawLine(Pens.Green, 10, 70, 70, 10);
\r
2188 Assert.That(t.PDCompare(), Is.True);
\r
2191 public virtual void TransfromPageScaleUnits_3() {
\r
2192 t.Graphics.TranslateTransform(20, 20);
\r
2193 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2194 t.Graphics.PageScale = 1.0F;
\r
2195 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2197 t.Graphics.TranslateTransform(10, 10);
\r
2198 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2199 t.Graphics.PageScale = 1.0F;
\r
2200 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2202 t.Graphics.RotateTransform(15);
\r
2204 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2205 t.Graphics.PageScale = 0.5F;
\r
2206 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2208 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2209 t.Graphics.PageScale = 0.5F;
\r
2210 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2212 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2213 t.Graphics.TranslateTransform(0, 0);
\r
2214 t.Graphics.PageScale = 1.5F;
\r
2215 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2218 Assert.That(t.PDCompare(), Is.True);
\r
2225 #region GraphicsFixturePropClip
\r
2228 public class GraphicsFixturePropClip : GraphicsFixture {
\r
2229 public override void SetUp() {
\r
2230 base.SetUp ("GraphicsFixturePropClip");
\r
2231 t.Graphics.Clip = new Region(new Rectangle(10, 10, 100, 100));
\r
2233 st["DrawArcTest:6"] = TOLERANCE * 5.0f;
\r
2234 st["DrawArcTest:8"] = TOLERANCE * 3.7f;
\r
2235 st["DrawLinesTest:2"] = TOLERANCE * 3.0f;
\r
2236 st["DrawLinesTestF:2"] = TOLERANCE * 3.0f;
\r
2237 st["DrawPieTestF:2"] = TOLERANCE * 2.0f;
\r
2238 st["DrawPieTestF:4"] = TOLERANCE * 2.0f;
\r
2239 st["DrawPieTest:2"] = TOLERANCE * 2.0f;
\r
2240 st["DrawPieTest:4"] = TOLERANCE * 2.0f;
\r
2241 st["FillClosedCurvePointFillModeTension:2"] = TOLERANCE * 1.5f;
\r
2242 st["FillClosedCurvePointFFillModeTension:2"] = TOLERANCE * 1.5f;
\r
2243 st["FillClosedCurvePointFillModeTension:4"] = TOLERANCE * 1.5f;
\r
2244 st["FillClosedCurvePointFFillModeTension:4"] = TOLERANCE * 1.5f;
\r
2245 st["FillClosedCurvePointFillModeTension:5"] = TOLERANCE * 1.5f;
\r
2246 st["FillClosedCurvePointFFillModeTension:6"] = TOLERANCE * 1.5f;
\r
2247 st["ScaleTransformFloatMatrixOrder1:2"] = TOLERANCE * 3.5f;
\r
2251 [Category("NotWorking")]
\r
2252 public override void DrawIconTest() {
\r
2253 base.DrawIconTest ();
\r
2257 [Category("NotWorking")]
\r
2258 public override void DrawIconUnstretchedTest() {
\r
2259 base.DrawIconUnstretchedTest ();
\r
2263 public override void DrawImageUnscaledTest() {
\r
2264 base.DrawImageUnscaledTest ();
\r
2268 public override void DrawStringFloatFormat() {
\r
2269 base.DrawStringFloatFormat ();
\r
2273 [Category("NotWorking")]
\r
2274 public override void MeasureCharacterRangesRegions() {
\r
2275 base.MeasureCharacterRangesRegions ();
\r
2279 [Category("NotWorking")]
\r
2280 public override void MeasureStringSizeFFormatInts() {
\r
2281 base.MeasureStringSizeFFormatInts ();
\r
2287 #region GraphicsFixturePropCompositingMode
\r
2290 public class GraphicsFixturePropCompositingMode1 : GraphicsFixture {
\r
2291 public override void SetUp() {
\r
2292 base.SetUp ("GraphicsFixturePropCompositingMode1");
\r
2293 t.Graphics.CompositingMode = CompositingMode.SourceCopy;
\r
2297 [Category("NotWorking")]
\r
2298 public override void DrawIconTest() {
\r
2299 base.DrawIconTest ();
\r
2303 [Category("NotWorking")]
\r
2304 public override void DrawIconUnstretchedTest() {
\r
2305 base.DrawIconUnstretchedTest ();
\r
2309 [Category("NotWorking")]
\r
2310 public override void DrawImageUnscaledTest() {
\r
2311 base.DrawImageUnscaledTest ();
\r
2315 [Category("NotWorking")]
\r
2316 public override void DrawStringFloatFormat() {
\r
2317 base.DrawStringFloatFormat ();
\r
2321 [Category("NotWorking")]
\r
2322 public override void MeasureCharacterRangesRegions() {
\r
2323 base.MeasureCharacterRangesRegions ();
\r
2327 [Category("NotWorking")]
\r
2328 public override void MeasureStringSizeFFormatInts() {
\r
2329 base.MeasureStringSizeFFormatInts ();
\r
2334 public class GraphicsFixturePropCompositingMode2 : GraphicsFixture {
\r
2335 public override void SetUp() {
\r
2336 base.SetUp ("GraphicsFixturePropCompositingMode2");
\r
2337 t.Graphics.CompositingMode = CompositingMode.SourceOver;
\r
2341 [Category("NotWorking")]
\r
2342 public override void DrawIconTest() {
\r
2343 base.DrawIconTest ();
\r
2347 [Category("NotWorking")]
\r
2348 public override void DrawIconUnstretchedTest() {
\r
2349 base.DrawIconUnstretchedTest ();
\r
2353 [Category("NotWorking")]
\r
2354 public override void DrawImageUnscaledTest() {
\r
2355 base.DrawImageUnscaledTest ();
\r
2359 [Category("NotWorking")]
\r
2360 public override void DrawStringFloatFormat() {
\r
2361 base.DrawStringFloatFormat ();
\r
2365 [Category("NotWorking")]
\r
2366 public override void MeasureCharacterRangesRegions() {
\r
2367 base.MeasureCharacterRangesRegions ();
\r
2371 [Category("NotWorking")]
\r
2372 public override void MeasureStringSizeFFormatInts() {
\r
2373 base.MeasureStringSizeFFormatInts ();
\r
2379 #region GraphicsFixturePropInterpolationMode
\r
2382 public class GraphicsFixturePropInterpolationMode1 : GraphicsFixture {
\r
2383 public override void SetUp() {
\r
2384 base.SetUp ("GraphicsFixturePropInterpolationMode1");
\r
2385 t.Graphics.InterpolationMode = InterpolationMode.Bilinear;
\r
2389 [Category("NotWorking")]
\r
2390 public override void DrawIconTest() {
\r
2391 base.DrawIconTest ();
\r
2395 [Category("NotWorking")]
\r
2396 public override void DrawIconUnstretchedTest() {
\r
2397 base.DrawIconUnstretchedTest ();
\r
2401 [Category("NotWorking")]
\r
2402 public override void DrawImageUnscaledTest() {
\r
2403 base.DrawImageUnscaledTest ();
\r
2407 [Category("NotWorking")]
\r
2408 public override void DrawStringFloatFormat() {
\r
2409 base.DrawStringFloatFormat ();
\r
2413 [Category("NotWorking")]
\r
2414 public override void MeasureCharacterRangesRegions() {
\r
2415 base.MeasureCharacterRangesRegions ();
\r
2419 [Category("NotWorking")]
\r
2420 public override void MeasureStringSizeFFormatInts() {
\r
2421 base.MeasureStringSizeFFormatInts ();
\r
2426 public class GraphicsFixturePropInterpolationMode2 : GraphicsFixture {
\r
2427 public override void SetUp() {
\r
2428 base.SetUp ("GraphicsFixturePropInterpolationMode2");
\r
2429 t.Graphics.InterpolationMode = InterpolationMode.Bicubic;
\r
2433 [Category("NotWorking")]
\r
2434 public override void DrawIconTest() {
\r
2435 base.DrawIconTest ();
\r
2439 [Category("NotWorking")]
\r
2440 public override void DrawIconUnstretchedTest() {
\r
2441 base.DrawIconUnstretchedTest ();
\r
2445 [Category("NotWorking")]
\r
2446 public override void DrawImageUnscaledTest() {
\r
2447 base.DrawImageUnscaledTest ();
\r
2451 [Category("NotWorking")]
\r
2452 public override void DrawStringFloatFormat() {
\r
2453 base.DrawStringFloatFormat ();
\r
2457 [Category("NotWorking")]
\r
2458 public override void MeasureCharacterRangesRegions() {
\r
2459 base.MeasureCharacterRangesRegions ();
\r
2463 [Category("NotWorking")]
\r
2464 public override void MeasureStringSizeFFormatInts() {
\r
2465 base.MeasureStringSizeFFormatInts ();
\r
2471 #region GraphicsFixturePropPageScale
\r
2474 public class GraphicsFixturePropPageScale : GraphicsFixture {
\r
2475 public override void SetUp() {
\r
2476 base.SetUp ("GraphicsFixturePropPageScale");
\r
2478 t.Graphics.PageScale = 4.34f;
\r
2479 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2481 st["IntersectClipRegion:4"] = TOLERANCE * 1.5f;
\r
2482 st["ResetClipIntersectClipRectangleF:2"] = TOLERANCE * 1.5f;
\r
2486 [Category("NotWorking")]
\r
2487 public override void DrawIconTest() {
\r
2488 base.DrawIconTest ();
\r
2492 [Category("NotWorking")]
\r
2493 public override void DrawIconUnstretchedTest() {
\r
2494 base.DrawIconUnstretchedTest ();
\r
2498 [Category("NotWorking")]
\r
2499 public override void DrawImageUnscaledTest() {
\r
2500 base.DrawImageUnscaledTest ();
\r
2504 public override void DrawStringFloatFormat() {
\r
2505 base.DrawStringFloatFormat ();
\r
2509 [Category("NotWorking")]
\r
2510 public override void MeasureCharacterRangesRegions() {
\r
2511 base.MeasureCharacterRangesRegions ();
\r
2515 [Category("NotWorking")]
\r
2516 public override void MeasureStringSizeFFormatInts() {
\r
2517 base.MeasureStringSizeFFormatInts ();
\r
2523 #region GraphicsFixturePropPageUnit
\r
2526 public class GraphicsFixturePropPageUnit1 : GraphicsFixture {
\r
2527 public override void SetUp() {
\r
2528 base.SetUp ("GraphicsFixturePropPageUnit1");
\r
2529 t.Graphics.PageUnit = GraphicsUnit.Display;
\r
2533 [Category("NotWorking")]
\r
2534 public override void DrawIconTest() {
\r
2535 base.DrawIconTest ();
\r
2539 [Category("NotWorking")]
\r
2540 public override void DrawIconUnstretchedTest() {
\r
2541 base.DrawIconUnstretchedTest ();
\r
2545 [Category("NotWorking")]
\r
2546 public override void DrawImageUnscaledTest() {
\r
2547 base.DrawImageUnscaledTest ();
\r
2551 [Category("NotWorking")]
\r
2552 public override void DrawStringFloatFormat() {
\r
2553 base.DrawStringFloatFormat ();
\r
2557 [Category("NotWorking")]
\r
2558 public override void MeasureCharacterRangesRegions() {
\r
2559 base.MeasureCharacterRangesRegions ();
\r
2563 [Category("NotWorking")]
\r
2564 public override void MeasureStringSizeFFormatInts() {
\r
2565 base.MeasureStringSizeFFormatInts ();
\r
2570 public class GraphicsFixturePropPageUnit2 : GraphicsFixture {
\r
2571 public override void SetUp() {
\r
2572 base.SetUp ("GraphicsFixturePropPageUnit2");
\r
2573 t.Graphics.PageUnit = GraphicsUnit.Document;
\r
2575 // FIXME: scaling down loss some pixels.
\r
2576 st["DrawBezierTest:2"] = TOLERANCE * 2.5f;
\r
2577 st["DrawBezierTest:4"] = TOLERANCE * 2.5f;
\r
2578 st["DrawBezierTest:6"] = TOLERANCE * 2.5f;
\r
2579 st["DrawBeziersTest:2"] = TOLERANCE * 2.0f;
\r
2580 st["DrawBeziersTest:4"] = TOLERANCE * 2.0f;
\r
2581 st["DrawClosedCurveTest:2"] = TOLERANCE * 3.0f;
\r
2582 st["DrawClosedCurveTest:4"] = TOLERANCE * 3.7f;
\r
2583 st["DrawCurveTest:2"] = TOLERANCE * 2.5f;
\r
2584 st["DrawCurveTest:4"] = TOLERANCE * 2.0f;
\r
2585 st["DrawCurveTest:6"] = TOLERANCE * 4.0f;
\r
2586 st["DrawCurveTestF:2"] = TOLERANCE * 2.5f;
\r
2587 st["DrawCurveTestF:4"] = TOLERANCE * 6.0f;
\r
2588 st["DrawCurveTestF:6"] = TOLERANCE * 6.0f;
\r
2589 st["DrawCurveTestF:8"] = TOLERANCE * 6.0f;
\r
2590 st["DrawEllipseTest:2"] = TOLERANCE * 2.0f;
\r
2591 st["DrawEllipseTest:4"] = TOLERANCE * 2.0f;
\r
2592 st["DrawEllipseTestF:2"] = TOLERANCE * 2.0f;
\r
2593 st["DrawEllipseTestF:4"] = TOLERANCE * 2.0f;
\r
2594 st["DrawLinesTest:2"] = TOLERANCE * 2.0f;
\r
2595 st["DrawLinesTestF:2"] = TOLERANCE * 2.0f;
\r
2596 st["DrawPathTest:2"] = TOLERANCE * 2.0f;
\r
2597 st["DrawPolygonPoint:2"] = TOLERANCE * 7.0f;
\r
2598 st["DrawPolygonPointF:2"] = TOLERANCE * 7.0f;
\r
2599 st["FillPieFloat:2"] = TOLERANCE * 1.5f;
\r
2600 st["FillPieFloat:4"] = TOLERANCE * 1.5f;
\r
2601 st["FillPieFloat:6"] = TOLERANCE * 1.5f;
\r
2602 st["IntersectClipRegion:4"] = TOLERANCE * 3.0f;
\r
2603 st["MultiplyTransform:2"] = TOLERANCE * 2.5f;
\r
2604 st["MultiplyTransformMatrixOrder1:2"] = TOLERANCE * 2.5f;
\r
2605 st["TranslateTransformAngleMatrixOrder1:2"] = TOLERANCE * 4.0f;
\r
2606 st["ScaleTransformFloatMatrixOrder:2"] = TOLERANCE * 4.0f;
\r
2607 st["ScaleTransformFloatMatrixOrder1:2"] = TOLERANCE * 5.5f;
\r
2608 st["RotateTransformAngleMatrixOrder:2"] = TOLERANCE * 3.5f;
\r
2612 [Category("NotWorking")]
\r
2613 public override void BeginContainerTest() {
\r
2614 base.BeginContainerTest ();
\r
2618 [Category("NotWorking")]
\r
2619 public override void DrawIconTest() {
\r
2620 base.DrawIconTest ();
\r
2624 [Category("NotWorking")]
\r
2625 public override void DrawIconUnstretchedTest() {
\r
2626 base.DrawIconUnstretchedTest ();
\r
2630 [Category("NotWorking")]
\r
2631 public override void DrawImageUnscaledTest() {
\r
2632 base.DrawImageUnscaledTest ();
\r
2636 [Category("NotWorking")]
\r
2637 public override void DrawStringFloatFormat() {
\r
2638 base.DrawStringFloatFormat ();
\r
2642 [Category("NotWorking")]
\r
2643 public override void EndContainerState() {
\r
2644 base.EndContainerState ();
\r
2648 [Category("NotWorking")]
\r
2649 public override void MeasureCharacterRangesRegions() {
\r
2650 base.MeasureCharacterRangesRegions ();
\r
2654 [Category("NotWorking")]
\r
2655 public override void MeasureStringSizeFFormatInts() {
\r
2656 base.MeasureStringSizeFFormatInts ();
\r
2661 public class GraphicsFixturePropPageUnit3 : GraphicsFixture {
\r
2662 public override void SetUp() {
\r
2663 base.SetUp ("GraphicsFixturePropPageUnit3");
\r
2664 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
2668 [Category("NotWorking")]
\r
2669 public override void DrawIconTest() {
\r
2670 base.DrawIconTest ();
\r
2674 [Category("NotWorking")]
\r
2675 public override void DrawIconUnstretchedTest() {
\r
2676 base.DrawIconUnstretchedTest ();
\r
2680 public override void DrawImageUnscaledTest() {
\r
2681 base.DrawImageUnscaledTest ();
\r
2685 public override void DrawStringFloatFormat() {
\r
2686 base.DrawStringFloatFormat ();
\r
2690 [Category("NotWorking")]
\r
2691 public override void IsVisible4Float() {
\r
2692 base.IsVisible4Float ();
\r
2696 public override void MeasureCharacterRangesRegions() {
\r
2697 base.MeasureCharacterRangesRegions ();
\r
2701 [Category("NotWorking")]
\r
2702 public override void MeasureStringSizeFFormatInts() {
\r
2703 base.MeasureStringSizeFFormatInts ();
\r
2708 public class GraphicsFixturePropPageUnit4 : GraphicsFixture {
\r
2709 public override void SetUp() {
\r
2710 base.SetUp ("GraphicsFixturePropPageUnit4");
\r
2711 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2713 st["DrawArcTest:8"] = TOLERANCE * 1.5f;
\r
2714 st["DrawRectangleFloat:2"] = TOLERANCE * 1.5f; // line width problem
\r
2715 st["DrawRectangleFloat:4"] = TOLERANCE * 1.5f;
\r
2716 st["DrawRectangleFloat:6"] = TOLERANCE * 1.5f;
\r
2717 st["DrawRectanglesRectangle:2"] = TOLERANCE * 1.5f;
\r
2718 st["DrawRectanglesRectangleF:2"] = TOLERANCE * 1.5f;
\r
2722 [Category("NotWorking")]
\r
2723 public override void DrawClosedCurveTest() {
\r
2724 base.DrawClosedCurveTest ();
\r
2728 [Category("NotWorking")]
\r
2729 public override void DrawIconTest() {
\r
2730 base.DrawIconTest ();
\r
2734 [Category("NotWorking")]
\r
2735 public override void DrawIconUnstretchedTest() {
\r
2736 base.DrawIconUnstretchedTest ();
\r
2740 [Category("NotWorking")]
\r
2741 public override void DrawImageUnscaledTest() {
\r
2742 base.DrawImageUnscaledTest ();
\r
2746 public override void DrawStringFloatFormat() {
\r
2747 base.DrawStringFloatFormat ();
\r
2751 [Category("NotWorking")]
\r
2752 public override void MeasureCharacterRangesRegions() {
\r
2753 base.MeasureCharacterRangesRegions ();
\r
2757 [Category("NotWorking")]
\r
2758 public override void MeasureStringSizeFFormatInts() {
\r
2759 base.MeasureStringSizeFFormatInts ();
\r
2764 public class GraphicsFixturePropPageUnit5 : GraphicsFixture {
\r
2765 public override void SetUp() {
\r
2766 base.SetUp ("GraphicsFixturePropPageUnit5");
\r
2768 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2772 [Category("NotWorking")]
\r
2773 public override void DrawIconTest() {
\r
2774 base.DrawIconTest ();
\r
2778 [Category("NotWorking")]
\r
2779 public override void DrawIconUnstretchedTest() {
\r
2780 base.DrawIconUnstretchedTest ();
\r
2784 [Category("NotWorking")]
\r
2785 public override void DrawImageUnscaledTest() {
\r
2786 base.DrawImageUnscaledTest ();
\r
2790 [Category("NotWorking")]
\r
2791 public override void DrawStringFloatFormat() {
\r
2792 base.DrawStringFloatFormat ();
\r
2796 [Category("NotWorking")]
\r
2797 public override void MeasureCharacterRangesRegions() {
\r
2798 base.MeasureCharacterRangesRegions ();
\r
2802 [Category("NotWorking")]
\r
2803 public override void MeasureStringSizeFFormatInts() {
\r
2804 base.MeasureStringSizeFFormatInts ();
\r
2809 public class GraphicsFixturePropPageUnit6 : GraphicsFixture {
\r
2810 public override void SetUp() {
\r
2811 base.SetUp ("GraphicsFixturePropPageUnit6");
\r
2812 t.Graphics.PageUnit = GraphicsUnit.Point;
\r
2814 st["DrawArcTest:2"] = TOLERANCE * 2.5f;
\r
2815 st["DrawArcTest:4"] = TOLERANCE * 8.0f; // big difference in width of line
\r
2816 st["DrawArcTest:6"] = TOLERANCE * 8.0f; // big difference in width of line
\r
2817 st["DrawArcTest:8"] = TOLERANCE * 6.0f; // big difference in width of line
\r
2818 st["IsVisible4Float:2"] = TOLERANCE * 1.5f;
\r
2819 st["TransformPointsPointF:2"] = TOLERANCE * 2.0f;
\r
2823 [Category("NotWorking")]
\r
2824 public override void DrawClosedCurveTest() {
\r
2825 base.DrawClosedCurveTest ();
\r
2829 [Category("NotWorking")]
\r
2830 public override void DrawCurveTest() {
\r
2831 base.DrawCurveTest ();
\r
2835 [Category("NotWorking")]
\r
2836 public override void DrawCurveTestF() {
\r
2837 base.DrawCurveTestF ();
\r
2841 [Category("NotWorking")]
\r
2842 public override void DrawEllipseTest() {
\r
2843 base.DrawEllipseTest ();
\r
2847 [Category("NotWorking")]
\r
2848 public override void DrawEllipseTestF() {
\r
2849 base.DrawEllipseTestF ();
\r
2853 [Category("NotWorking")]
\r
2854 public override void DrawIconTest() {
\r
2855 base.DrawIconTest ();
\r
2859 [Category("NotWorking")]
\r
2860 public override void DrawIconUnstretchedTest() {
\r
2861 base.DrawIconUnstretchedTest ();
\r
2865 [Category("NotWorking")]
\r
2866 public override void DrawImageUnscaledTest() {
\r
2867 base.DrawImageUnscaledTest ();
\r
2871 [Category("NotWorking")]
\r
2872 public override void DrawPathTest() {
\r
2873 base.DrawPathTest ();
\r
2877 [Category("NotWorking")]
\r
2878 public override void DrawStringFloatFormat() {
\r
2879 base.DrawStringFloatFormat ();
\r
2883 [Category("NotWorking")]
\r
2884 public override void EndContainerState() {
\r
2885 base.EndContainerState ();
\r
2889 [Category("NotWorking")]
\r
2890 public override void MeasureCharacterRangesRegions() {
\r
2891 base.MeasureCharacterRangesRegions ();
\r
2895 [Category("NotWorking")]
\r
2896 public override void MeasureStringSizeFFormatInts() {
\r
2897 base.MeasureStringSizeFFormatInts ();
\r
2901 [Category("NotWorking")]
\r
2902 public override void MultiplyTransform() {
\r
2903 base.MultiplyTransform ();
\r
2907 [Category("NotWorking")]
\r
2908 public override void MultiplyTransformMatrixOrder1() {
\r
2909 base.MultiplyTransformMatrixOrder1 ();
\r
2913 [Category("NotWorking")]
\r
2914 public override void RotateTransformAngleMatrixOrder1() {
\r
2915 base.RotateTransformAngleMatrixOrder1 ();
\r
2919 [Category("NotWorking")]
\r
2920 public override void TranslateTransformAngleMatrixOrder() {
\r
2921 base.TranslateTransformAngleMatrixOrder ();
\r
2926 // public class GraphicsFixturePropPageUnit7 : GraphicsFixture {
\r
2927 // public override void SetUp() {
\r
2930 // t.Graphics.PageUnit = GraphicsUnit.World;
\r
2936 #region GraphicsFixturePropPixelOffsetMode
\r
2939 public class GraphicsFixturePropPixelOffsetMode : GraphicsFixture {
\r
2940 public override void SetUp() {
\r
2941 base.SetUp ("GraphicsFixturePropPixelOffsetMode");
\r
2942 t.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
\r
2944 st["TransformPointsPointF:2"] = TOLERANCE * 3.0f;
\r
2948 [Category("NotWorking")]
\r
2949 public override void DrawIconTest() {
\r
2950 base.DrawIconTest ();
\r
2954 [Category("NotWorking")]
\r
2955 public override void DrawIconUnstretchedTest() {
\r
2956 base.DrawIconUnstretchedTest ();
\r
2960 [Category("NotWorking")]
\r
2961 public override void DrawImageUnscaledTest() {
\r
2962 base.DrawImageUnscaledTest ();
\r
2966 [Category("NotWorking")]
\r
2967 public override void DrawStringFloatFormat() {
\r
2968 base.DrawStringFloatFormat ();
\r
2972 [Category("NotWorking")]
\r
2973 public override void MeasureCharacterRangesRegions() {
\r
2974 base.MeasureCharacterRangesRegions ();
\r
2978 [Category("NotWorking")]
\r
2979 public override void MeasureStringSizeFFormatInts() {
\r
2980 base.MeasureStringSizeFFormatInts ();
\r
2985 public class GraphicsFixturePropPixelOffsetMode1 : GraphicsFixture {
\r
2986 public override void SetUp() {
\r
2987 base.SetUp ("GraphicsFixturePropPixelOffsetMode1");
\r
2988 t.Graphics.PixelOffsetMode = PixelOffsetMode.HighSpeed;
\r
2992 [Category("NotWorking")]
\r
2993 public override void DrawIconTest() {
\r
2994 base.DrawIconTest ();
\r
2998 [Category("NotWorking")]
\r
2999 public override void DrawIconUnstretchedTest() {
\r
3000 base.DrawIconUnstretchedTest ();
\r
3004 [Category("NotWorking")]
\r
3005 public override void DrawImageUnscaledTest() {
\r
3006 base.DrawImageUnscaledTest ();
\r
3010 [Category("NotWorking")]
\r
3011 public override void DrawStringFloatFormat() {
\r
3012 base.DrawStringFloatFormat ();
\r
3016 [Category("NotWorking")]
\r
3017 public override void MeasureCharacterRangesRegions() {
\r
3018 base.MeasureCharacterRangesRegions ();
\r
3022 [Category("NotWorking")]
\r
3023 public override void MeasureStringSizeFFormatInts() {
\r
3024 base.MeasureStringSizeFFormatInts ();
\r
3029 public class GraphicsFixturePropPixelOffsetMode2 : GraphicsFixture {
\r
3030 public override void SetUp() {
\r
3031 base.SetUp ("GraphicsFixturePropPixelOffsetMode2");
\r
3032 t.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
\r
3034 st["TransformPointsPointF:2"] = TOLERANCE * 3.0f;
\r
3038 [Category("NotWorking")]
\r
3039 public override void DrawIconTest() {
\r
3040 base.DrawIconTest ();
\r
3044 [Category("NotWorking")]
\r
3045 public override void DrawIconUnstretchedTest() {
\r
3046 base.DrawIconUnstretchedTest ();
\r
3050 [Category("NotWorking")]
\r
3051 public override void DrawImageUnscaledTest() {
\r
3052 base.DrawImageUnscaledTest ();
\r
3056 [Category("NotWorking")]
\r
3057 public override void DrawStringFloatFormat() {
\r
3058 base.DrawStringFloatFormat ();
\r
3062 [Category("NotWorking")]
\r
3063 public override void MeasureCharacterRangesRegions() {
\r
3064 base.MeasureCharacterRangesRegions ();
\r
3068 [Category("NotWorking")]
\r
3069 public override void MeasureStringSizeFFormatInts() {
\r
3070 base.MeasureStringSizeFFormatInts ();
\r
3076 #region GraphicsFixturePropRenderingOrigin
\r
3079 [Category("NotWorking")]
\r
3080 public class GraphicsFixturePropRenderingOrigin : GraphicsFixture {
\r
3081 public override void SetUp() {
\r
3082 base.SetUp ("GraphicsFixturePropRenderingOrigin");
\r
3083 t.Graphics.RenderingOrigin = new Point(12, 23);
\r
3087 [Category("NotWorking")]
\r
3088 public override void BeginContainerTest() {
\r
3089 base.BeginContainerTest ();
\r
3093 [Category("NotWorking")]
\r
3094 public override void BeginContainerTest_2() {
\r
3095 base.BeginContainerTest_2 ();
\r
3099 [Category("NotWorking")]
\r
3100 public override void ClearTest() {
\r
3101 base.ClearTest ();
\r
3105 [Category("NotWorking")]
\r
3106 public override void DrawArcTest() {
\r
3107 base.DrawArcTest ();
\r
3111 [Category("NotWorking")]
\r
3112 public override void DrawBezierTest() {
\r
3113 base.DrawBezierTest ();
\r
3117 [Category("NotWorking")]
\r
3118 public override void DrawBeziersTest() {
\r
3119 base.DrawBeziersTest ();
\r
3123 [Category("NotWorking")]
\r
3124 public override void DrawClosedCurveTest() {
\r
3125 base.DrawClosedCurveTest ();
\r
3129 [Category("NotWorking")]
\r
3130 public override void DrawCurveTest() {
\r
3131 base.DrawCurveTest ();
\r
3135 [Category("NotWorking")]
\r
3136 public override void DrawCurveTestF() {
\r
3137 base.DrawCurveTestF ();
\r
3141 [Category("NotWorking")]
\r
3142 public override void DrawEllipseTest() {
\r
3143 base.DrawEllipseTest ();
\r
3147 [Category("NotWorking")]
\r
3148 public override void DrawEllipseTestF() {
\r
3149 base.DrawEllipseTestF ();
\r
3153 [Category("NotWorking")]
\r
3154 public override void DrawIconTest() {
\r
3155 base.DrawIconTest ();
\r
3159 [Category("NotWorking")]
\r
3160 public override void DrawIconUnstretchedTest() {
\r
3161 base.DrawIconUnstretchedTest ();
\r
3165 [Category("NotWorking")]
\r
3166 public override void DrawImageUnscaledTest() {
\r
3167 base.DrawImageUnscaledTest ();
\r
3171 [Category("NotWorking")]
\r
3172 public override void DrawLineTest() {
\r
3173 base.DrawLineTest ();
\r
3177 [Category("NotWorking")]
\r
3178 public override void DrawLineTestF() {
\r
3179 base.DrawLineTestF ();
\r
3183 [Category("NotWorking")]
\r
3184 public override void DrawLinesTest() {
\r
3185 base.DrawLinesTest ();
\r
3189 [Category("NotWorking")]
\r
3190 public override void DrawLinesTestF() {
\r
3191 base.DrawLinesTestF ();
\r
3195 [Category("NotWorking")]
\r
3196 public override void DrawPathTest() {
\r
3197 base.DrawPathTest ();
\r
3201 [Category("NotWorking")]
\r
3202 public override void DrawPieTestF() {
\r
3203 base.DrawPieTestF ();
\r
3207 [Category("NotWorking")]
\r
3208 public override void DrawPieTest() {
\r
3209 base.DrawPieTest ();
\r
3213 [Category("NotWorking")]
\r
3214 public override void DrawPolygonPoint() {
\r
3215 base.DrawPolygonPoint ();
\r
3219 [Category("NotWorking")]
\r
3220 public override void DrawPolygonPointF() {
\r
3221 base.DrawPolygonPointF ();
\r
3225 [Category("NotWorking")]
\r
3226 public override void DrawRectangleFloat() {
\r
3227 base.DrawRectangleFloat ();
\r
3231 [Category("NotWorking")]
\r
3232 public override void DrawRectanglesRectangleF() {
\r
3233 base.DrawRectanglesRectangleF ();
\r
3237 [Category("NotWorking")]
\r
3238 public override void DrawRectanglesRectangle() {
\r
3239 base.DrawRectanglesRectangle ();
\r
3243 [Category("NotWorking")]
\r
3244 public override void DrawStringFloatFormat() {
\r
3245 base.DrawStringFloatFormat ();
\r
3249 [Category("NotWorking")]
\r
3250 public override void EndContainerState() {
\r
3251 base.EndContainerState ();
\r
3255 [Category("NotWorking")]
\r
3256 public override void EnumerateMetafile() {
\r
3257 base.EnumerateMetafile ();
\r
3261 [Category("NotWorking")]
\r
3262 public override void ExcludeClipRegion() {
\r
3263 base.ExcludeClipRegion ();
\r
3267 [Category("NotWorking")]
\r
3268 public override void FillClosedCurvePointFillModeTension() {
\r
3269 base.FillClosedCurvePointFillModeTension ();
\r
3273 [Category("NotWorking")]
\r
3274 public override void FillClosedCurvePointFFillModeTension() {
\r
3275 base.FillClosedCurvePointFFillModeTension ();
\r
3279 [Category("NotWorking")]
\r
3280 public override void FillEllipse() {
\r
3281 base.FillEllipse ();
\r
3285 [Category("NotWorking")]
\r
3286 public override void FillEllipseFloat() {
\r
3287 base.FillEllipseFloat ();
\r
3291 [Category("NotWorking")]
\r
3292 public override void FillPathEllipse() {
\r
3293 base.FillPathEllipse ();
\r
3297 [Category("NotWorking")]
\r
3298 public override void FillPieFloat() {
\r
3299 base.FillPieFloat ();
\r
3303 [Category("NotWorking")]
\r
3304 public override void FillPolygonPointFillMode() {
\r
3305 base.FillPolygonPointFillMode ();
\r
3309 [Category("NotWorking")]
\r
3310 public override void FillPolygonPointFFillMode() {
\r
3311 base.FillPolygonPointFFillMode ();
\r
3315 [Category("NotWorking")]
\r
3316 public override void FillRectangle() {
\r
3317 base.FillRectangle ();
\r
3321 [Category("NotWorking")]
\r
3322 public override void FillRectangleFloat() {
\r
3323 base.FillRectangleFloat ();
\r
3327 [Category("NotWorking")]
\r
3328 public override void FillRectanglesRectangle() {
\r
3329 base.FillRectanglesRectangle ();
\r
3333 [Category("NotWorking")]
\r
3334 public override void FillRectanglesRectangleF() {
\r
3335 base.FillRectanglesRectangleF ();
\r
3339 [Category("NotWorking")]
\r
3340 public override void FillRegionRectangle() {
\r
3341 base.FillRegionRectangle ();
\r
3345 [Category("NotWorking")]
\r
3346 public override void FlushTest() {
\r
3347 base.FlushTest ();
\r
3351 [Category("NotWorking")]
\r
3352 public override void IsVisible4Float() {
\r
3353 base.IsVisible4Float ();
\r
3357 [Category("NotWorking")]
\r
3358 public override void MeasureCharacterRangesRegions() {
\r
3359 base.MeasureCharacterRangesRegions ();
\r
3363 [Category("NotWorking")]
\r
3364 public override void MeasureStringSizeFFormatInts() {
\r
3365 base.MeasureStringSizeFFormatInts ();
\r
3369 [Category("NotWorking")]
\r
3370 public override void MultiplyTransform() {
\r
3371 base.MultiplyTransform ();
\r
3375 [Category("NotWorking")]
\r
3376 public override void MultiplyTransformMatrixOrder() {
\r
3377 base.MultiplyTransformMatrixOrder ();
\r
3381 [Category("NotWorking")]
\r
3382 public override void MultiplyTransformMatrixOrder1() {
\r
3383 base.MultiplyTransformMatrixOrder1 ();
\r
3387 [Category("NotWorking")]
\r
3388 public override void ResetClipIntersectClipRectangleF() {
\r
3389 base.ResetClipIntersectClipRectangleF ();
\r
3393 [Category("NotWorking")]
\r
3394 public override void SaveRestoreTranslate() {
\r
3395 base.SaveRestoreTranslate ();
\r
3399 [Category("NotWorking")]
\r
3400 public override void RotateTransformAngleMatrixOrder() {
\r
3401 base.RotateTransformAngleMatrixOrder ();
\r
3405 [Category("NotWorking")]
\r
3406 public override void RotateTransformAngleMatrixOrder1() {
\r
3407 base.RotateTransformAngleMatrixOrder1 ();
\r
3411 [Category("NotWorking")]
\r
3412 public override void ScaleTransformFloatMatrixOrder() {
\r
3413 base.ScaleTransformFloatMatrixOrder ();
\r
3417 [Category("NotWorking")]
\r
3418 public override void ScaleTransformFloatMatrixOrder1() {
\r
3419 base.ScaleTransformFloatMatrixOrder1 ();
\r
3423 [Category("NotWorking")]
\r
3424 public override void SetClipRegionCombine() {
\r
3425 base.SetClipRegionCombine ();
\r
3429 [Category("NotWorking")]
\r
3430 public override void TransformPointsPointF() {
\r
3431 base.TransformPointsPointF ();
\r
3435 [Category("NotWorking")]
\r
3436 public override void TranslateClipFloat() {
\r
3437 base.TranslateClipFloat ();
\r
3441 [Category("NotWorking")]
\r
3442 public override void TranslateTransformAngleMatrixOrder() {
\r
3443 base.TranslateTransformAngleMatrixOrder ();
\r
3447 [Category("NotWorking")]
\r
3448 public override void TranslateTransformAngleMatrixOrder1() {
\r
3449 base.TranslateTransformAngleMatrixOrder1 ();
\r
3453 [Category("NotWorking")]
\r
3454 public override void TransfromPageScaleUnits() {
\r
3455 base.TransfromPageScaleUnits ();
\r
3459 [Category("NotWorking")]
\r
3460 public override void TransfromPageScaleUnits_2() {
\r
3461 base.TransfromPageScaleUnits_2 ();
\r
3465 [Category("NotWorking")]
\r
3466 public override void TransfromPageScaleUnits_3() {
\r
3467 base.TransfromPageScaleUnits_3 ();
\r
3474 /// TBD: add more variants
\r
3476 #region GraphicsFixturePropSmoothingMode
\r
3479 public class GraphicsFixturePropSmoothingMode : GraphicsFixture {
\r
3480 public override void SetUp() {
\r
3481 base.SetUp ("GraphicsFixturePropSmoothingMode");
\r
3482 t.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
\r
3484 st["DrawArcTest:4"] = TOLERANCE * 3.0f;
\r
3485 st["DrawLineTest:2"] = TOLERANCE * 3.0f;
\r
3486 st["DrawLineTest:4"] = TOLERANCE * 3.0f; // difference in line width even in horizontal lines
\r
3487 st["DrawLineTestF:2"] = TOLERANCE * 3.0f;
\r
3488 st["DrawLineTestF:4"] = TOLERANCE * 3.0f;
\r
3489 st["DrawPieTest:2"] = TOLERANCE * 1.5f;
\r
3490 st["DrawPieTestF:2"] = TOLERANCE * 1.5f;
\r
3491 st["DrawPieTest:4"] = TOLERANCE * 1.5f;
\r
3492 st["DrawPieTestF:4"] = TOLERANCE * 1.5f;
\r
3493 st["DrawRectangleFloat:2"] = TOLERANCE * 3.0f; // big difference in line width
\r
3494 st["DrawRectangleFloat:4"] = TOLERANCE * 3.0f; // big difference in line width
\r
3495 st["DrawRectangleFloat:6"] = TOLERANCE * 3.0f;
\r
3496 st["DrawRectanglesRectangle:2"] = TOLERANCE * 3.0f;
\r
3497 st["DrawRectanglesRectangleF:2"] = TOLERANCE * 3.0f;
\r
3501 [Category("NotWorking")]
\r
3502 public override void DrawIconTest() {
\r
3503 base.DrawIconTest ();
\r
3507 [Category("NotWorking")]
\r
3508 public override void DrawIconUnstretchedTest() {
\r
3509 base.DrawIconUnstretchedTest ();
\r
3513 [Category("NotWorking")]
\r
3514 public override void DrawImageUnscaledTest() {
\r
3515 base.DrawImageUnscaledTest ();
\r
3519 [Category("NotWorking")]
\r
3520 public override void DrawStringFloatFormat() {
\r
3521 base.DrawStringFloatFormat ();
\r
3525 [Category("NotWorking")]
\r
3526 public override void MeasureCharacterRangesRegions() {
\r
3527 base.MeasureCharacterRangesRegions ();
\r
3531 [Category("NotWorking")]
\r
3532 public override void MeasureStringSizeFFormatInts() {
\r
3533 base.MeasureStringSizeFFormatInts ();
\r
3538 public class GraphicsFixturePropSmoothingMode1 : GraphicsFixture {
\r
3539 public override void SetUp() {
\r
3540 base.SetUp ("GraphicsFixturePropSmoothingMode1");
\r
3541 t.Graphics.SmoothingMode = SmoothingMode.HighSpeed;
\r
3545 [Category("NotWorking")]
\r
3546 public override void DrawIconTest() {
\r
3547 base.DrawIconTest ();
\r
3551 [Category("NotWorking")]
\r
3552 public override void DrawIconUnstretchedTest() {
\r
3553 base.DrawIconUnstretchedTest ();
\r
3557 [Category("NotWorking")]
\r
3558 public override void DrawImageUnscaledTest() {
\r
3559 base.DrawImageUnscaledTest ();
\r
3563 [Category("NotWorking")]
\r
3564 public override void DrawStringFloatFormat() {
\r
3565 base.DrawStringFloatFormat ();
\r
3569 [Category("NotWorking")]
\r
3570 public override void MeasureCharacterRangesRegions() {
\r
3571 base.MeasureCharacterRangesRegions ();
\r
3575 [Category("NotWorking")]
\r
3576 public override void MeasureStringSizeFFormatInts() {
\r
3577 base.MeasureStringSizeFFormatInts ();
\r
3583 #region GraphicsFixturePropTextContrast
\r
3586 public class GraphicsFixturePropTextContrast : GraphicsFixture {
\r
3587 public override void SetUp() {
\r
3588 base.SetUp ("GraphicsFixturePropTextContrast");
\r
3589 t.Graphics.TextContrast = 9;
\r
3593 [Category("NotWorking")]
\r
3594 public override void DrawIconTest() {
\r
3595 base.DrawIconTest ();
\r
3599 [Category("NotWorking")]
\r
3600 public override void DrawIconUnstretchedTest() {
\r
3601 base.DrawIconUnstretchedTest ();
\r
3605 [Category("NotWorking")]
\r
3606 public override void DrawImageUnscaledTest() {
\r
3607 base.DrawImageUnscaledTest ();
\r
3611 [Category("NotWorking")]
\r
3612 public override void DrawStringFloatFormat() {
\r
3613 base.DrawStringFloatFormat ();
\r
3617 [Category("NotWorking")]
\r
3618 public override void MeasureCharacterRangesRegions() {
\r
3619 base.MeasureCharacterRangesRegions ();
\r
3623 [Category("NotWorking")]
\r
3624 public override void MeasureStringSizeFFormatInts() {
\r
3625 base.MeasureStringSizeFFormatInts ();
\r
3631 #region GraphicsFixtureGraphicsState
\r
3634 public class GraphicsFixtureGraphicsState {
\r
3635 protected DrawingTest t;
\r
3636 protected int TOLERANCE = 3; //in %;
\r
3639 public virtual void SetUp() {
\r
3640 t = DrawingTest.Create(512, 512, "GraphicsFixtureGraphicsState");
\r
3644 public void TearDown ()
\r
3651 public void BeginEndContainer() {
\r
3652 t.Graphics.FillRectangle( Brushes.Blue, 0, 0, 100, 100 );
\r
3654 GraphicsContainer c1 = t.Graphics.BeginContainer(
\r
3655 new Rectangle(100, 100, 100, 100),
\r
3656 new Rectangle(0, 0, 100, 100),
\r
3657 GraphicsUnit.Pixel);
\r
3659 t.Graphics.FillRectangle( Brushes.Green, 0, 0, 100, 100 );
\r
3661 GraphicsContainer c2 = t.Graphics.BeginContainer(
\r
3662 new Rectangle(100, 100, 100, 100),
\r
3663 new Rectangle(0, 0, 100, 100),
\r
3664 GraphicsUnit.Pixel);
\r
3666 t.Graphics.FillRectangle( Brushes.Red, 0, 0, 100, 100 );
\r
3668 GraphicsState s1 = t.Graphics.Save();
\r
3669 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
3671 t.Graphics.PageScale = 0.7f;
\r
3672 t.Graphics.FillRectangle( Brushes.SeaGreen, 0, 0, 100, 100 );
\r
3674 t.Graphics.EndContainer(c2);
\r
3675 t.Graphics.PageScale = 0.7f;
\r
3676 t.Graphics.FillRectangle( Brushes.SeaGreen, 0, 0, 100, 100 );
\r
3678 t.Graphics.EndContainer(c1);
\r
3679 t.Graphics.PageScale = 0.7f;
\r
3680 t.Graphics.FillRectangle( Brushes.SeaGreen, 0, 0, 100, 100 );
\r
3683 Assert.That(t.PDCompare(), Is.True);
\r
3687 public void SaveRestoreGraphicsProps() {
\r
3688 t.Graphics.CompositingQuality = CompositingQuality.GammaCorrected;
\r
3689 t.Graphics.CompositingMode = CompositingMode.SourceCopy;
\r
3690 t.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
\r
3691 t.Graphics.PageScale = 7;
\r
3692 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
3693 t.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
\r
3694 t.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
\r
3695 t.Graphics.Transform = new Matrix(1, 2, 3, 4, 5, 6);
\r
3696 t.Graphics.TextContrast = 10;
\r
3697 t.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
\r
3699 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
3701 Assert.That (CompositingQuality.Default, Is.EqualTo (t.Graphics.CompositingQuality));
\r
3702 Assert.That (CompositingMode.SourceOver, Is.EqualTo (t.Graphics.CompositingMode));
\r
3703 Assert.That (InterpolationMode.Bilinear, Is.EqualTo (t.Graphics.InterpolationMode));
\r
3704 Assert.That (1.0F, Is.EqualTo (t.Graphics.PageScale));
\r
3705 Assert.That (GraphicsUnit.Display, Is.EqualTo (t.Graphics.PageUnit));
\r
3706 Assert.That (PixelOffsetMode.Default, Is.EqualTo (t.Graphics.PixelOffsetMode));
\r
3707 Assert.That (SmoothingMode.None, Is.EqualTo (t.Graphics.SmoothingMode));
\r
3708 Assert.That (true, Is.EqualTo (t.Graphics.Transform.IsIdentity));
\r
3709 Assert.That (4.0f, Is.EqualTo (t.Graphics.TextContrast));
\r
3710 Assert.That (TextRenderingHint.SystemDefault, Is.EqualTo (t.Graphics.TextRenderingHint));
\r
3712 t.Graphics.EndContainer(c1);
\r
3715 public void SaveRestoreGraphicsProps_2() {
\r
3716 GraphicsState s = t.Graphics.Save();
\r
3718 t.Graphics.CompositingQuality = CompositingQuality.GammaCorrected;
\r
3719 t.Graphics.CompositingMode = CompositingMode.SourceCopy;
\r
3720 t.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
\r
3721 t.Graphics.PageScale = 7;
\r
3722 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
3723 t.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
\r
3724 t.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
\r
3725 t.Graphics.Transform = new Matrix(1, 2, 3, 4, 5, 6);
\r
3726 t.Graphics.TextContrast = 10;
\r
3727 t.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
\r
3729 t.Graphics.Restore(s);
\r
3731 Assert.That (CompositingQuality.Default, Is.EqualTo (t.Graphics.CompositingQuality));
\r
3732 Assert.That (CompositingMode.SourceOver, Is.EqualTo (t.Graphics.CompositingMode));
\r
3733 Assert.That (InterpolationMode.Bilinear, Is.EqualTo (t.Graphics.InterpolationMode));
\r
3734 Assert.That (1.0F, Is.EqualTo (t.Graphics.PageScale));
\r
3735 Assert.That (GraphicsUnit.Display, Is.EqualTo (t.Graphics.PageUnit));
\r
3736 Assert.That (PixelOffsetMode.Default, Is.EqualTo (t.Graphics.PixelOffsetMode));
\r
3737 Assert.That (SmoothingMode.None, Is.EqualTo (t.Graphics.SmoothingMode));
\r
3738 Assert.That (true, Is.EqualTo (t.Graphics.Transform.IsIdentity));
\r
3739 Assert.That (4.0f, Is.EqualTo (t.Graphics.TextContrast));
\r
3740 Assert.That (TextRenderingHint.SystemDefault, Is.EqualTo (t.Graphics.TextRenderingHint));
\r
3744 public void SaveRestoreGraphicsProps_3() {
\r
3745 t.Graphics.PageScale = 2;
\r
3746 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
3748 t.Graphics.PageScale = 3;
\r
3749 GraphicsContainer c2 = t.Graphics.BeginContainer();
\r
3751 t.Graphics.PageScale = 4;
\r
3752 GraphicsContainer c3 = t.Graphics.BeginContainer();
\r
3754 t.Graphics.EndContainer(c2);
\r
3755 Assert.That (3, Is.EqualTo (t.Graphics.PageScale));
\r
3757 t.Graphics.PageScale = 5;
\r
3758 GraphicsState c5 = t.Graphics.Save();
\r
3760 t.Graphics.EndContainer(c3);
\r
3761 Assert.That (5, Is.EqualTo (t.Graphics.PageScale));
\r
3763 t.Graphics.Restore(c5);
\r
3764 Assert.That (5, Is.EqualTo (t.Graphics.PageScale));
\r
3766 t.Graphics.EndContainer(c1);
\r
3767 Assert.That (2, Is.EqualTo (t.Graphics.PageScale));
\r
3770 public void SaveRestoreGraphicsProps_4() {
\r
3771 t.Graphics.PageScale = 2;
\r
3772 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
3774 t.Graphics.PageScale = 3;
\r
3775 GraphicsState c2 = t.Graphics.Save();
\r
3777 t.Graphics.EndContainer(c1);
\r
3778 Assert.That (2, Is.EqualTo (t.Graphics.PageScale));
\r
3780 t.Graphics.Restore(c2);
\r
3781 Assert.That (2, Is.EqualTo (t.Graphics.PageScale));
\r
3786 #region GraphicsFixturePropTextRenderingHint
\r
3789 public class GraphicsFixturePropTextRenderingHint : GraphicsFixture {
\r
3790 public override void SetUp() {
\r
3791 base.SetUp ("GraphicsFixturePropTextRenderingHint");
\r
3792 t.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
\r
3796 [Category("NotWorking")]
\r
3797 public override void DrawIconTest() {
\r
3798 base.DrawIconTest ();
\r
3802 [Category("NotWorking")]
\r
3803 public override void DrawIconUnstretchedTest() {
\r
3804 base.DrawIconUnstretchedTest ();
\r
3808 [Category("NotWorking")]
\r
3809 public override void DrawImageUnscaledTest() {
\r
3810 base.DrawImageUnscaledTest ();
\r
3814 [Category("NotWorking")]
\r
3815 public override void DrawStringFloatFormat() {
\r
3816 base.DrawStringFloatFormat ();
\r
3820 [Category("NotWorking")]
\r
3821 public override void MeasureCharacterRangesRegions() {
\r
3822 base.MeasureCharacterRangesRegions ();
\r
3826 [Category("NotWorking")]
\r
3827 public override void MeasureStringSizeFFormatInts() {
\r
3828 base.MeasureStringSizeFFormatInts ();
\r
3833 public class GraphicsFixturePropTextRenderingHint1 : GraphicsFixture {
\r
3834 public override void SetUp() {
\r
3835 base.SetUp ("GraphicsFixturePropTextRenderingHint1");
\r
3836 t.Graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
\r
3840 [Category("NotWorking")]
\r
3841 public override void DrawIconTest() {
\r
3842 base.DrawIconTest ();
\r
3846 [Category("NotWorking")]
\r
3847 public override void DrawIconUnstretchedTest() {
\r
3848 base.DrawIconUnstretchedTest ();
\r
3852 [Category("NotWorking")]
\r
3853 public override void DrawImageUnscaledTest() {
\r
3854 base.DrawImageUnscaledTest ();
\r
3858 [Category("NotWorking")]
\r
3859 public override void DrawStringFloatFormat() {
\r
3860 base.DrawStringFloatFormat ();
\r
3864 [Category("NotWorking")]
\r
3865 public override void MeasureCharacterRangesRegions() {
\r
3866 base.MeasureCharacterRangesRegions ();
\r
3870 [Category("NotWorking")]
\r
3871 public override void MeasureStringSizeFFormatInts() {
\r
3872 base.MeasureStringSizeFFormatInts ();
\r
3877 public class GraphicsFixturePropTextRenderingHint2 : GraphicsFixture {
\r
3878 public override void SetUp() {
\r
3879 base.SetUp ("GraphicsFixturePropTextRenderingHint2");
\r
3880 t.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
\r
3884 [Category("NotWorking")]
\r
3885 public override void DrawIconTest() {
\r
3886 base.DrawIconTest ();
\r
3890 [Category("NotWorking")]
\r
3891 public override void DrawIconUnstretchedTest() {
\r
3892 base.DrawIconUnstretchedTest ();
\r
3896 [Category("NotWorking")]
\r
3897 public override void DrawImageUnscaledTest() {
\r
3898 base.DrawImageUnscaledTest ();
\r
3902 [Category("NotWorking")]
\r
3903 public override void DrawStringFloatFormat() {
\r
3904 base.DrawStringFloatFormat ();
\r
3908 [Category("NotWorking")]
\r
3909 public override void MeasureCharacterRangesRegions() {
\r
3910 base.MeasureCharacterRangesRegions ();
\r
3914 [Category("NotWorking")]
\r
3915 public override void MeasureStringSizeFFormatInts() {
\r
3916 base.MeasureStringSizeFFormatInts ();
\r
3921 public class GraphicsFixturePropTextRenderingHint3 : GraphicsFixture {
\r
3922 public override void SetUp() {
\r
3923 base.SetUp ("GraphicsFixturePropTextRenderingHint3");
\r
3924 t.Graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
\r
3928 [Category("NotWorking")]
\r
3929 public override void DrawIconTest() {
\r
3930 base.DrawIconTest ();
\r
3934 [Category("NotWorking")]
\r
3935 public override void DrawIconUnstretchedTest() {
\r
3936 base.DrawIconUnstretchedTest ();
\r
3940 [Category("NotWorking")]
\r
3941 public override void DrawImageUnscaledTest() {
\r
3942 base.DrawImageUnscaledTest ();
\r
3946 [Category("NotWorking")]
\r
3947 public override void DrawStringFloatFormat() {
\r
3948 base.DrawStringFloatFormat ();
\r
3952 [Category("NotWorking")]
\r
3953 public override void MeasureCharacterRangesRegions() {
\r
3954 base.MeasureCharacterRangesRegions ();
\r
3958 [Category("NotWorking")]
\r
3959 public override void MeasureStringSizeFFormatInts() {
\r
3960 base.MeasureStringSizeFFormatInts ();
\r
3965 public class GraphicsFixturePropTextRenderingHint4 : GraphicsFixture {
\r
3966 public override void SetUp() {
\r
3967 base.SetUp ("GraphicsFixturePropTextRenderingHint4");
\r
3968 t.Graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
\r
3972 [Category("NotWorking")]
\r
3973 public override void DrawIconTest() {
\r
3974 base.DrawIconTest ();
\r
3978 [Category("NotWorking")]
\r
3979 public override void DrawIconUnstretchedTest() {
\r
3980 base.DrawIconUnstretchedTest ();
\r
3984 [Category("NotWorking")]
\r
3985 public override void DrawImageUnscaledTest() {
\r
3986 base.DrawImageUnscaledTest ();
\r
3990 [Category("NotWorking")]
\r
3991 public override void DrawStringFloatFormat() {
\r
3992 base.DrawStringFloatFormat ();
\r
3996 [Category("NotWorking")]
\r
3997 public override void MeasureCharacterRangesRegions() {
\r
3998 base.MeasureCharacterRangesRegions ();
\r
4002 [Category("NotWorking")]
\r
4003 public override void MeasureStringSizeFFormatInts() {
\r
4004 base.MeasureStringSizeFFormatInts ();
\r
4009 public class GraphicsFixturePropTextRenderingHint5 : GraphicsFixture {
\r
4010 public override void SetUp() {
\r
4011 base.SetUp ("GraphicsFixturePropTextRenderingHint5");
\r
4012 t.Graphics.TextRenderingHint = TextRenderingHint.SystemDefault;
\r
4016 [Category("NotWorking")]
\r
4017 public override void DrawIconTest() {
\r
4018 base.DrawIconTest ();
\r
4022 [Category("NotWorking")]
\r
4023 public override void DrawIconUnstretchedTest() {
\r
4024 base.DrawIconUnstretchedTest ();
\r
4028 [Category("NotWorking")]
\r
4029 public override void DrawImageUnscaledTest() {
\r
4030 base.DrawImageUnscaledTest ();
\r
4034 [Category("NotWorking")]
\r
4035 public override void DrawStringFloatFormat() {
\r
4036 base.DrawStringFloatFormat ();
\r
4040 [Category("NotWorking")]
\r
4041 public override void MeasureCharacterRangesRegions() {
\r
4042 base.MeasureCharacterRangesRegions ();
\r
4046 [Category("NotWorking")]
\r
4047 public override void MeasureStringSizeFFormatInts() {
\r
4048 base.MeasureStringSizeFFormatInts ();
\r
4054 #region GraphicsFixturePropTransform
\r
4057 public class GraphicsFixturePropTransform : GraphicsFixture {
\r
4058 public override void SetUp() {
\r
4059 base.SetUp ("GraphicsFixturePropTransform");
\r
4060 t.Graphics.Transform = new Matrix(0, 1, 2, 0, 0, 0);
\r
4062 st["DrawArcTest:2"] = TOLERANCE * 11.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4063 st["DrawArcTest:4"] = TOLERANCE * 12.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4064 st["DrawArcTest:6"] = TOLERANCE * 12.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4065 st["DrawArcTest:8"] = TOLERANCE * 10.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4066 st["DrawClosedCurveTest:4"] = TOLERANCE * 2.0f;
\r
4067 st["RotateTransformAngleMatrixOrder:2"] = TOLERANCE * 1.5f;
\r
4068 st["TransformPointsPointF:2"] = TOLERANCE * 3.5f;
\r
4072 [Category("NotWorking")]
\r
4073 public override void DrawIconTest() {
\r
4074 base.DrawIconTest ();
\r
4078 [Category("NotWorking")]
\r
4079 public override void DrawIconUnstretchedTest() {
\r
4080 base.DrawIconUnstretchedTest ();
\r
4084 [Category("NotWorking")]
\r
4085 public override void DrawImageUnscaledTest() {
\r
4086 base.DrawImageUnscaledTest ();
\r
4090 [Category("NotWorking")]
\r
4091 public override void DrawStringFloatFormat() {
\r
4092 base.DrawStringFloatFormat ();
\r
4096 [Category("NotWorking")]
\r
4097 public override void MeasureCharacterRangesRegions() {
\r
4098 base.MeasureCharacterRangesRegions ();
\r
4102 [Category("NotWorking")]
\r
4103 public override void MeasureStringSizeFFormatInts() {
\r
4104 base.MeasureStringSizeFFormatInts ();
\r