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
442 [Category("NotWorking")] // defect 6145
\r
444 public void DrawImageWithResolution() {
\r
445 t.Graphics.DrawImage(bmp2, 0, 0);
\r
447 Assert.That(t.Compare(), Is.True);
\r
450 public void DrawImageInContainer1() {
\r
451 t.Graphics.BeginContainer(new Rectangle(10, 10, 50, 50), new Rectangle(70, 70, 100, 100), GraphicsUnit.Pixel);
\r
452 t.Graphics.DrawImage(bmp, 0, 0);
\r
454 Assert.That(t.Compare(), Is.True);
\r
458 [Category ("NotWorking")] // defect 6145
\r
460 public void DrawImageInContainer2() {
\r
461 t.Graphics.BeginContainer(new Rectangle(10, 10, 50, 50), new Rectangle(70, 70, 100, 100), GraphicsUnit.Pixel);
\r
462 t.Graphics.DrawImage(bmp2, 0, 0);
\r
464 Assert.That(t.Compare(), Is.True);
\r
467 public void DrawImageInContainer3() {
\r
468 t.Graphics.BeginContainer(new Rectangle(10, 10, 50, 50), new Rectangle(70, 70, 100, 100), GraphicsUnit.Pixel);
\r
469 t.Graphics.SetClip( new Rectangle(0, 0, 15, 15) );
\r
470 t.Graphics.ScaleTransform(0.5f, 0.5f);
\r
471 t.Graphics.DrawImage(bmp2, 0, 0);
\r
473 Assert.That(t.Compare(), Is.True);
\r
476 public void DrawImageInContainer4() {
\r
477 Point [] p = new Point[]{
\r
478 new Point(100, 100),
\r
479 new Point(200, 100),
\r
483 t.Graphics.SetClip( new Rectangle(70, 70, 70, 70) );
\r
484 GraphicsContainer c = t.Graphics.BeginContainer( new Rectangle(20, 20, 10, 10), new Rectangle(77, 77, 7, 7), GraphicsUnit.Pixel);
\r
485 t.Graphics.DrawImage(bmp2, p, new Rectangle(100, 100, 100, 100), GraphicsUnit.Pixel);
\r
486 t.Graphics.EndContainer( c );
\r
488 Assert.That(t.Compare(), Is.True);
\r
493 #region GraphicsFixtureFillModes
\r
495 public class GraphicsFixtureFillModes {
\r
496 protected DrawingTest t;
\r
497 protected int TOLERANCE = 3; //in %;
\r
500 public virtual void SetUp() {
\r
501 SetUp("GraphicsFixtureFillModes");
\r
503 public virtual void SetUp(string ownerClass) {
\r
504 t = DrawingTest.Create(512, 512, ownerClass);
\r
507 public void TearDown() {
\r
513 public void FillModeAlternate() {
\r
514 GraphicsPath p = new GraphicsPath();
\r
515 Assert.That (FillMode.Alternate, Is.EqualTo (p.FillMode));
\r
518 public void FillModeAlternate_1() {
\r
519 Point [] p = new Point[] {
\r
520 new Point(50, 100),
\r
522 new Point(90, 100),
\r
523 new Point(140, 10),
\r
524 new Point(150, 100),
\r
525 new Point(170, 10),
\r
529 GraphicsPath path = new GraphicsPath();
\r
530 path.AddLines( p );
\r
531 path.FillMode = FillMode.Alternate;
\r
532 t.Graphics.FillPath( Brushes.Blue, path );
\r
534 Assert.That(t.PDCompare(), Is.True);
\r
537 public void FillModeAlternate_2() {
\r
539 Rectangle r1 = new Rectangle(100, 100, 100, 100);
\r
540 Rectangle r2 = new Rectangle(125, 125, 50, 50);
\r
541 GraphicsPath path = new GraphicsPath();
\r
542 path.AddRectangle( r1 );
\r
543 path.AddRectangle( r2 );
\r
544 path.FillMode = FillMode.Alternate;
\r
545 t.Graphics.FillPath( Brushes.Blue, path );
\r
547 Assert.That(t.PDCompare(), Is.True);
\r
550 public void FillModeAlternate_3() {
\r
551 Point [] p = new Point[] {
\r
552 new Point(50, 100),
\r
553 new Point(150, 50),
\r
554 new Point(250, 100),
\r
556 new Point(250, 50),
\r
560 GraphicsPath path = new GraphicsPath();
\r
561 path.AddLines( p );
\r
562 path.FillMode = FillMode.Alternate;
\r
563 t.Graphics.FillPath( Brushes.Blue, path );
\r
565 Assert.That(t.PDCompare(), Is.True);
\r
568 public void FillModeWinding_1() {
\r
569 Point [] p = new Point[] {
\r
570 new Point(50, 100),
\r
572 new Point(90, 100),
\r
573 new Point(140, 10),
\r
574 new Point(150, 100),
\r
575 new Point(170, 10),
\r
579 GraphicsPath path = new GraphicsPath();
\r
580 path.AddLines( p );
\r
581 path.FillMode = FillMode.Winding;
\r
582 t.Graphics.FillPath( Brushes.Blue, path );
\r
584 Assert.That(t.PDCompare(), Is.True);
\r
587 public void FillModeWinding_2() {
\r
589 Rectangle r1 = new Rectangle(100, 100, 100, 100);
\r
590 Rectangle r2 = new Rectangle(125, 125, 50, 50);
\r
591 GraphicsPath path = new GraphicsPath();
\r
592 path.AddRectangle( r1 );
\r
593 path.AddRectangle( r2 );
\r
594 path.FillMode = FillMode.Winding;
\r
595 t.Graphics.FillPath( Brushes.Blue, path );
\r
597 Assert.That(t.PDCompare(), Is.True);
\r
600 public void FillModeWinding_3() {
\r
601 Point [] p = new Point[] {
\r
602 new Point(50, 100),
\r
603 new Point(150, 50),
\r
604 new Point(250, 100),
\r
606 new Point(250, 50),
\r
610 GraphicsPath path = new GraphicsPath();
\r
611 path.AddLines( p );
\r
612 path.FillMode = FillMode.Winding;
\r
613 t.Graphics.FillPath( Brushes.Blue, path );
\r
615 Assert.That(t.PDCompare(), Is.True);
\r
622 #region GraphicsFixture
\r
624 /// Summary description for Graphics.
\r
627 public class GraphicsFixture {
\r
628 protected DrawingTest t;
\r
629 protected int TOLERANCE = 3; //in %;
\r
630 protected Hashtable st = new Hashtable();
\r
633 public virtual void SetUp() {
\r
634 SetUp("GraphicsFixture");
\r
636 public virtual void SetUp(string ownerClass) {
\r
637 t = DrawingTest.Create(512, 512, ownerClass);
\r
639 // hashtable of differents tolerance values for specified tests. (for fft comparer)
\r
640 st["DrawArcTest:6"] = TOLERANCE * 2.5f;
\r
641 st["DrawCurveTestF:4"] = TOLERANCE * 2f;
\r
642 st["DrawPolygonPoint:2"] = TOLERANCE * 2f;
\r
643 st["DrawPolygonPointF:2"] = TOLERANCE * 2f;
\r
644 st["DrawStringFloatFormat:2"] = TOLERANCE * 2f; // in .net the font is shmoothed
\r
645 st["DrawStringFloatFormat:4"] = TOLERANCE * 2.5f; // in .net the font is shmoothed
\r
646 st["DrawStringFloatFormat:6"] = TOLERANCE * 2.5f; // in .net the font is shmoothed
\r
647 st["RotateTransformAngleMatrixOrder1:2"] = TOLERANCE * 2f; // Line width problem
\r
648 st["ScaleTransformFloatMatrixOrder:2"] = TOLERANCE * 2f; // Line width problem
\r
649 st["TranslateTransformAngleMatrixOrder:2"] = TOLERANCE * 2f; // Line width problem
\r
650 t.SpecialTolerance = st;
\r
654 public void TearDown ()
\r
661 public virtual void BeginContainerTest() {
\r
662 // Define transformation for container.
\r
663 RectangleF srcRect = new RectangleF(0.0F, 0.0F, 200.0F, 200.0F);
\r
664 RectangleF destRect = new RectangleF(100.0F, 100.0F, 150.0F, 150.0F);
\r
665 // Begin graphics container.
\r
666 GraphicsContainer containerState = t.Graphics.BeginContainer(
\r
668 GraphicsUnit.Pixel);
\r
669 // Fill red rectangle in container.
\r
670 t.Graphics.FillRectangle(new SolidBrush(Color.Red), 0.0F, 0.0F, 200.0F, 200.0F);
\r
672 // End graphics container.
\r
673 t.Graphics.EndContainer(containerState);
\r
674 // Fill untransformed rectangle with green.
\r
675 t.Graphics.FillRectangle(new SolidBrush(Color.Green), 0.0F, 0.0F, 200.0F, 200.0F);
\r
677 Assert.That(t.PDCompare(), Is.True);
\r
681 public void MeasureString () {
\r
682 Bitmap bmp = new Bitmap (400, 300, PixelFormat.Format32bppArgb);
\r
683 Graphics graphics = Graphics.FromImage (bmp);
\r
684 graphics.PageUnit = GraphicsUnit.Point;
\r
686 string drawString = "Sample Text in points";
\r
687 Font drawFont = new Font ("Arial Black", 70, FontStyle.Regular);
\r
688 SolidBrush drawBrush = new SolidBrush (Color.Blue);
\r
690 float netWidth1 = 836.1719f;
\r
691 float netWidth2 = 1114.896f;
\r
692 float netHeight1 = 98.71094f;
\r
693 float netHeight2 = 131.6146f;
\r
695 SizeF size = graphics.MeasureString (drawString, drawFont, new PointF (0, 0), StringFormat.GenericTypographic);
\r
697 Assert.That (Math.Abs (size.Width - netWidth1) / netWidth1 < 0.01, Is.True);
\r
698 Assert.That (Math.Abs (size.Height - netHeight1) / netHeight1 < 0.01, Is.True);
\r
700 graphics.PageUnit = GraphicsUnit.Pixel;
\r
701 size = graphics.MeasureString (drawString, drawFont, new PointF (0, 0), StringFormat.GenericTypographic);
\r
703 Assert.That (Math.Abs (size.Width - netWidth2) / netWidth2 < 0.01, Is.True);
\r
704 Assert.That (Math.Abs (size.Height - netHeight2) / netHeight2 < 0.01, Is.True);
\r
708 public virtual void BeginContainerTest_2() {
\r
709 t.Graphics.DrawRectangle( Pens.Black, new Rectangle(70, 70, 50, 100) );
\r
710 t.Graphics.DrawRectangle( Pens.Black, new Rectangle(50, 100, 150, 50) );
\r
711 t.Graphics.DrawRectangle( Pens.Black, new Rectangle(80, 120, 10, 10) );
\r
713 t.Graphics.SetClip( new Rectangle(70, 70, 50, 100) );
\r
714 t.Graphics.Clear( Color.Blue );
\r
716 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
717 t.Graphics.SetClip( new Rectangle(50, 100, 150, 50) );
\r
718 t.Graphics.Clear( Color.Green );
\r
720 GraphicsContainer c2 = t.Graphics.BeginContainer();
\r
721 t.Graphics.SetClip( new Rectangle(80, 120, 10, 10) );
\r
722 t.Graphics.Clear( Color.Red );
\r
724 t.Graphics.EndContainer( c2 );
\r
725 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(100, 120, 10, 10) );
\r
726 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(150, 120, 10, 10) );
\r
728 t.Graphics.EndContainer( c1 );
\r
729 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(100, 80, 10, 10) );
\r
730 t.Graphics.FillRectangle( Brushes.Yellow, new Rectangle(150, 80, 10, 10) );
\r
733 Assert.That(t.PDCompare(), Is.True);
\r
736 public virtual void ClearTest() {
\r
737 // Clear screen with teal background.
\r
739 Assert.That(t.PDCompare(), Is.True);
\r
740 t.Graphics.Clear(Color.Teal);
\r
742 Assert.That(t.PDCompare(), Is.True);
\r
746 public virtual void DrawArcTest() {
\r
748 Pen blackPen= new Pen(Color.Black, 1);
\r
749 // Create coordinates of rectangle to bound ellipse.
\r
752 float width = 400.0F;
\r
753 float height = 100.0F;
\r
754 // Create start and sweep angles on ellipse.
\r
755 float startAngle = 370.0F;
\r
756 float sweepAngle = 70.0F;
\r
757 // Draw arc to screen.
\r
758 t.Graphics.DrawArc(blackPen, (int)x, (int)y, (int)width, (int)height, (int)startAngle, (int)sweepAngle);
\r
760 Assert.That(t.PDCompare(), Is.True);
\r
762 startAngle = 10.0F;
\r
763 sweepAngle = 120.0F;
\r
764 t.Graphics.DrawArc(blackPen, new Rectangle((int)x, (int)y, (int)width, (int)height), startAngle, sweepAngle);
\r
766 Assert.That(t.PDCompare(), Is.True);
\r
768 startAngle = 10.0F;
\r
769 sweepAngle = 190.0F;
\r
770 t.Graphics.DrawArc(blackPen, x, y, width, height, startAngle, sweepAngle);
\r
772 Assert.That(t.PDCompare(), Is.True);
\r
774 startAngle = 10.0F;
\r
775 sweepAngle = 300.0F;
\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 = -179.9F;
\r
781 sweepAngle = -359.9F;
\r
782 t.Graphics.DrawArc(blackPen, new RectangleF(x, y, width, height), startAngle, sweepAngle);
\r
784 Assert.That(t.PDCompare(), Is.True);
\r
786 startAngle = -10.0F;
\r
787 sweepAngle = -300.0F;
\r
788 t.Graphics.DrawArc(blackPen, new RectangleF(x, y, width, height), startAngle, sweepAngle);
\r
790 Assert.That(t.PDCompare(), Is.True);
\r
794 public virtual void DrawBezierTest() {
\r
796 Pen blackPen = new Pen(Color.Black, 3);
\r
797 // Create coordinates of points for curve.
\r
798 float startX = 100.0F;
\r
799 float startY = 100.0F;
\r
800 float controlX1 = 200.0F;
\r
801 float controlY1 = 10.0F;
\r
802 float controlX2 = 350.0F;
\r
803 float controlY2 = 50.0F;
\r
804 float endX = 500.0F;
\r
805 float endY = 100.0F;
\r
806 // Draw arc to screen.
\r
807 t.Graphics.DrawBezier(blackPen, startX, startY,
\r
808 controlX1, controlY1,
\r
809 controlX2, controlY2,
\r
812 Assert.That(t.PDCompare(), Is.True);
\r
814 t.Graphics.DrawBezier(blackPen, new PointF( startX, startY),
\r
815 new PointF(controlX1, controlY1),
\r
816 new PointF(controlX2, controlY2),
\r
817 new PointF(endX, endY));
\r
819 Assert.That(t.PDCompare(), Is.True);
\r
821 t.Graphics.DrawBezier(blackPen, new Point((int)startX, (int)startY),
\r
822 new Point((int)controlX1, (int)controlY1),
\r
823 new Point((int)controlX2, (int)controlY2),
\r
824 new Point((int)endX, (int)endY));
\r
826 Assert.That(t.PDCompare(), Is.True);
\r
830 public virtual void DrawBeziersTest() {
\r
832 Pen blackPen = new Pen(Color.Black, 3);
\r
833 // Create points for curve.
\r
834 Point start = new Point(100, 100);
\r
835 Point control1 = new Point(200, 10);
\r
836 Point control2 = new Point(350, 50);
\r
837 Point end1 = new Point(500, 100);
\r
838 Point control3 = new Point(600, 150);
\r
839 Point control4 = new Point(650, 250);
\r
840 Point end2 = new Point(500, 300);
\r
841 Point[] bezierPoints = {
\r
842 start, control1, control2, end1,
\r
843 control3, control4, end2
\r
845 // Draw arc to screen.
\r
846 t.Graphics.DrawBeziers(blackPen, bezierPoints);
\r
848 Assert.That(t.PDCompare(), Is.True);
\r
851 PointF startF = new PointF(100.0F, 100.0F);
\r
852 PointF control1F = new PointF(200.0F, 10.0F);
\r
853 PointF control2F = new PointF(350.0F, 50.0F);
\r
854 PointF end1F = new PointF(500.0F, 100.0F);
\r
855 PointF control3F = new PointF(600.0F, 150.0F);
\r
856 PointF control4F = new PointF(650.0F, 250.0F);
\r
857 PointF end2F = new PointF(500.0F, 300.0F);
\r
858 PointF[] bezierPointsF = {
\r
859 startF, control1F, control2F, end1F,
\r
860 control3F, control4F, end2F
\r
862 // Draw arc to screen.
\r
863 t.Graphics.DrawBeziers(blackPen, bezierPointsF);
\r
865 Assert.That(t.PDCompare(), Is.True);
\r
869 public virtual void DrawClosedCurveTest() {
\r
871 Pen redPen = new Pen(Color.Red, 3);
\r
872 Pen greenPen = new Pen(Color.Green, 3);
\r
873 // Create points that define curve.
\r
874 PointF point1 = new PointF( 50.0F, 50.0F);
\r
875 PointF point2 = new PointF(100.0F, 25.0F);
\r
876 PointF point3 = new PointF(200.0F, 5.0F);
\r
877 PointF point4 = new PointF(250.0F, 50.0F);
\r
878 PointF point5 = new PointF(300.0F, 100.0F);
\r
879 PointF point6 = new PointF(350.0F, 200.0F);
\r
880 PointF point7 = new PointF(250.0F, 250.0F);
\r
881 PointF[] curvePoints = {
\r
890 // Draw lines between original points to screen.
\r
891 t.Graphics.DrawLines(redPen, curvePoints);
\r
892 // Create tension and fill mode.
\r
893 float tension = 0.7F;
\r
894 FillMode aFillMode = FillMode.Alternate;
\r
895 // Draw closed curve to screen.
\r
896 t.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);
\r
898 Assert.That(t.PDCompare(), Is.True);
\r
901 aFillMode = FillMode.Winding;
\r
902 // Draw closed curve to screen.
\r
903 t.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);
\r
905 Assert.That(t.PDCompare(), Is.True);
\r
909 public virtual void DrawCurveTest() {
\r
911 Pen redPen = new Pen(Color.Red, 3);
\r
912 Pen greenPen = new Pen(Color.Green, 3);
\r
913 // Create points that define curve.
\r
914 Point point1 = new Point( 50, 50);
\r
915 Point point2 = new Point(100, 25);
\r
916 Point point3 = new Point(200, 5);
\r
917 Point point4 = new Point(250, 50);
\r
918 Point point5 = new Point(300, 100);
\r
919 Point point6 = new Point(350, 200);
\r
920 Point point7 = new Point(250, 250);
\r
921 Point[] curvePoints = {
\r
930 // Draw lines between original points to screen.
\r
931 t.Graphics.DrawLines(redPen, curvePoints);
\r
932 // Create offset, number of segments, and tension.
\r
934 int numSegments = 4;
\r
935 float tension = 0.7F;
\r
936 // Draw curve to screen.
\r
937 t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);
\r
939 Assert.That(t.PDCompare(), Is.True);
\r
942 t.Graphics.DrawCurve(greenPen, curvePoints, tension);
\r
944 Assert.That(t.PDCompare(), Is.True);
\r
947 t.Graphics.DrawCurve(greenPen, curvePoints);
\r
949 Assert.That(t.PDCompare(), Is.True);
\r
953 public virtual void DrawCurveTestF() {
\r
955 Pen redPen = new Pen(Color.Red, 3);
\r
956 Pen greenPen = new Pen(Color.Green, 3);
\r
957 // Create points that define curve.
\r
958 PointF point1 = new PointF( 50.0F, 50.0F);
\r
959 PointF point2 = new PointF(100.0F, 25.0F);
\r
960 PointF point3 = new PointF(200.0F, 5.0F);
\r
961 PointF point4 = new PointF(250.0F, 50.0F);
\r
962 PointF point5 = new PointF(300.0F, 100.0F);
\r
963 PointF point6 = new PointF(350.0F, 200.0F);
\r
964 PointF point7 = new PointF(250.0F, 250.0F);
\r
965 PointF[] curvePoints = {
\r
974 // Draw lines between original points to screen.
\r
975 t.Graphics.DrawLines(redPen, curvePoints);
\r
976 // Create offset, number of segments, and tension.
\r
978 int numSegments = 4;
\r
979 float tension = 0.7F;
\r
980 // Draw curve to screen.
\r
981 t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);
\r
983 Assert.That(t.PDCompare(), Is.True);
\r
986 t.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments);
\r
988 Assert.That(t.PDCompare(), Is.True);
\r
991 t.Graphics.DrawCurve(greenPen, curvePoints, tension);
\r
993 Assert.That(t.PDCompare(), Is.True);
\r
996 t.Graphics.DrawCurve(greenPen, curvePoints);
\r
998 Assert.That(t.PDCompare(), Is.True);
\r
1002 public virtual void DrawEllipseTest() {
\r
1004 Pen blackPen = new Pen(Color.Black, 3);
\r
1005 // Create location and size of ellipse.
\r
1010 // Draw ellipse to screen.
\r
1011 t.Graphics.DrawEllipse(blackPen, x, y, width, height);
\r
1013 Assert.That(t.PDCompare(), Is.True);
\r
1016 t.Graphics.DrawEllipse(blackPen, new Rectangle(x, y, width, height));
\r
1018 Assert.That(t.PDCompare(), Is.True);
\r
1022 public virtual void DrawEllipseTestF() {
\r
1024 Pen blackPen = new Pen(Color.Black, 3);
\r
1025 // Create location and size of ellipse.
\r
1028 float width = 200.0F;
\r
1029 float height = 100.0F;
\r
1030 // Draw ellipse to screen.
\r
1031 t.Graphics.DrawEllipse(blackPen, x, y, width, height);
\r
1033 Assert.That(t.PDCompare(), Is.True);
\r
1036 t.Graphics.DrawEllipse(blackPen, new RectangleF(x, y, width, height));
\r
1038 Assert.That(t.PDCompare(), Is.True);
\r
1041 static string getInFile (string file) {
\r
1044 sRslt = Path.GetFullPath (file);
\r
1046 if (! File.Exists (file))
\r
1047 sRslt = Path.Combine (
\r
1048 Path.Combine ("..", ".."),
\r
1055 [Category("NotWorking")]
\r
1056 public virtual void DrawIconTest() {
\r
1058 Icon newIcon = new Icon(getInFile ("SampIcon.ico"));
\r
1059 // Create coordinates for upper-left corner of icon.
\r
1062 // Draw icon to screen.
\r
1063 t.Graphics.DrawIcon(newIcon, x, y);
\r
1065 Assert.That(t.PDCompare(), Is.True);
\r
1067 t.Graphics.DrawIcon(newIcon, new Rectangle(200, 300, 125, 345));
\r
1069 Assert.That(t.PDCompare(), Is.True);
\r
1073 [Category("NotWorking")]
\r
1074 public virtual void DrawIconUnstretchedTest() {
\r
1076 Icon newIcon = new Icon(getInFile ("SampIcon.ico"));
\r
1077 // Create rectangle for icon.
\r
1078 Rectangle rect = new Rectangle( 100, 100, 200, 200);
\r
1079 // Draw icon to screen.
\r
1080 t.Graphics.DrawIconUnstretched(newIcon, rect);
\r
1082 Assert.That(t.PDCompare(), Is.True);
\r
1084 #if INTPTR_SUPPORTED
\r
1085 // Define DrawImageAbort callback method.
\r
1086 private bool DrawImageCallback(IntPtr callBackData) {
\r
1087 // Test for call that passes callBackData parameter.
\r
1088 if(callBackData==IntPtr.Zero) {
\r
1089 // If no callBackData passed, abort DrawImage method.
\r
1093 // If callBackData passed, continue DrawImage method.
\r
1098 [Test] //TBD: add more overrides
\r
1099 public void DrawImageTest() {
\r
1100 // Create callback method.
\r
1101 Graphics.DrawImageAbort imageCallback
\r
1102 = new Graphics.DrawImageAbort(DrawImageCallback);
\r
1103 IntPtr imageCallbackData = new IntPtr(1);
\r
1105 Image newImage = Image.FromFile("SampIcon.ico");
\r
1106 // Create rectangle for displaying original image.
\r
1107 Rectangle destRect1 = new Rectangle( 100, 25, 450, 150);
\r
1108 // Create coordinates of rectangle for source image.
\r
1111 float width = 150.0F;
\r
1112 float height = 150.0F;
\r
1113 GraphicsUnit units = GraphicsUnit.Pixel;
\r
1114 // Draw original image to screen.
\r
1115 t.Graphics.DrawImage(newImage, destRect1, x, y, width, height, units);
\r
1117 // Create rectangle for adjusted image.
\r
1118 Rectangle destRect2 = new Rectangle(100, 175, 450, 150);
\r
1119 // Create image attributes and set large gamma.
\r
1120 ImageAttributes imageAttr = new ImageAttributes();
\r
1121 imageAttr.SetGamma(4.0F);
\r
1122 // Draw adjusted image to screen.
\r
1124 t.Graphics.DrawImage(
\r
1132 imageCallbackData);
\r
1138 [Category("NotWorking")]
\r
1139 public virtual void DrawImageUnscaledTest() {
\r
1141 Image newImage = Bitmap.FromFile(getInFile ("bitmap_gh.png"));
\r
1142 // Create coordinates for upper-left corner of image.
\r
1145 // Draw image to screen.
\r
1146 t.Graphics.DrawImageUnscaled(newImage, x, y, 100, 125);
\r
1148 Assert.That(t.PDCompare(), Is.True);
\r
1151 t.Graphics.DrawImageUnscaled(newImage, new Rectangle(x, y, 34, 235));
\r
1153 Assert.That(t.PDCompare(), Is.True);
\r
1156 t.Graphics.DrawImageUnscaled(newImage, x, y);
\r
1158 Assert.That(t.PDCompare(), Is.True);
\r
1161 t.Graphics.DrawImageUnscaled(newImage, new Point(x, y));
\r
1163 Assert.That(t.PDCompare(), Is.True);
\r
1167 public virtual void DrawLineTest() {
\r
1169 Pen blackPen = new Pen(Color.Black, 3);
\r
1170 // Create coordinates of points that define line.
\r
1175 // Draw line to screen.
\r
1176 t.Graphics.DrawLine(blackPen, x1, y1, x2, y2);
\r
1178 Assert.That(t.PDCompare(), Is.True);
\r
1181 t.Graphics.DrawLine(blackPen, new Point( x1, y1), new Point( x2, y2));
\r
1183 Assert.That(t.PDCompare(), Is.True);
\r
1187 public virtual void DrawLineTestF() {
\r
1189 Pen blackPen = new Pen(Color.Black, 3);
\r
1190 // Create coordinates of points that define line.
\r
1191 float x1 = 100.0F;
\r
1192 float y1 = 100.0F;
\r
1193 float x2 = 500.0F;
\r
1194 float y2 = 100.0F;
\r
1195 // Draw line to screen.
\r
1196 t.Graphics.DrawLine(blackPen, x1, y1, x2, y2);
\r
1198 Assert.That(t.PDCompare(), Is.True);
\r
1201 t.Graphics.DrawLine(blackPen, new PointF( x1, y1), new PointF( x2, y2));
\r
1203 Assert.That(t.PDCompare(), Is.True);
\r
1207 public virtual void DrawLinesTest() {
\r
1209 Pen pen = new Pen(Color.Black, 3);
\r
1210 // Create array of points that define lines to draw.
\r
1211 Point[] points = {
\r
1212 new Point( 10, 10),
\r
1213 new Point( 10, 100),
\r
1214 new Point(200, 50),
\r
1215 new Point(250, 300)
\r
1217 //Draw lines to screen.
\r
1218 t.Graphics.DrawLines(pen, points);
\r
1220 Assert.That(t.PDCompare(), Is.True);
\r
1224 public virtual void DrawLinesTestF() {
\r
1226 Pen pen = new Pen(Color.Black, 3);
\r
1227 // Create array of points that define lines to draw.
\r
1228 PointF[] points = {
\r
1229 new PointF( 10.0F, 10.0F),
\r
1230 new PointF( 10.0F, 100.0F),
\r
1231 new PointF(200.0F, 50.0F),
\r
1232 new PointF(250.0F, 300.0F)
\r
1234 //Draw lines to screen.
\r
1235 t.Graphics.DrawLines(pen, points);
\r
1237 Assert.That(t.PDCompare(), Is.True);
\r
1241 public virtual void DrawPathTest() {
\r
1242 // Create graphics path object and add ellipse.
\r
1243 GraphicsPath graphPath = new GraphicsPath();
\r
1244 graphPath.AddEllipse(0, 0, 200, 100);
\r
1246 Pen blackPen = new Pen(Color.Black, 3);
\r
1247 // Draw graphics path to screen.
\r
1248 t.Graphics.DrawPath(blackPen, graphPath);
\r
1250 Assert.That(t.PDCompare(), Is.True);
\r
1254 public virtual void DrawPieTestF() {
\r
1256 Pen blackPen = new Pen(Color.Black, 3);
\r
1257 // Create location and size of ellipse.
\r
1260 float width = 200.0F;
\r
1261 float height = 100.0F;
\r
1262 // Create start and sweep angles.
\r
1263 float startAngle = 0.0F;
\r
1264 float sweepAngle = 45.0F;
\r
1265 // Draw pie to screen.
\r
1266 t.Graphics.DrawPie(blackPen, x, y, width, height, startAngle, sweepAngle);
\r
1268 Assert.That(t.PDCompare(), Is.True);
\r
1271 t.Graphics.DrawPie(blackPen, new RectangleF( x, y, width, height), startAngle, sweepAngle);
\r
1273 Assert.That(t.PDCompare(), Is.True);
\r
1277 public virtual void DrawPieTest() {
\r
1279 Pen blackPen = new Pen(Color.Black, 3);
\r
1280 // Create location and size of ellipse.
\r
1285 // Create start and sweep angles.
\r
1286 int startAngle = 0;
\r
1287 int sweepAngle = 45;
\r
1288 // Draw pie to screen.
\r
1289 t.Graphics.DrawPie(blackPen, x, y, width, height, startAngle, sweepAngle);
\r
1291 Assert.That(t.PDCompare(), Is.True);
\r
1294 t.Graphics.DrawPie(blackPen, new Rectangle( x, y, width, height), startAngle, sweepAngle);
\r
1296 Assert.That(t.PDCompare(), Is.True);
\r
1300 public virtual void DrawPolygonPoint() {
\r
1302 Pen blackPen = new Pen(Color.Black, 3);
\r
1303 // Create points that define polygon.
\r
1304 Point point1 = new Point( 50, 50);
\r
1305 Point point2 = new Point(100, 25);
\r
1306 Point point3 = new Point(200, 5);
\r
1307 Point point4 = new Point(250, 50);
\r
1308 Point point5 = new Point(300, 100);
\r
1309 Point point6 = new Point(350, 200);
\r
1310 Point point7 = new Point(250, 250);
\r
1311 Point[] curvePoints = {
\r
1320 // Draw polygon to screen.
\r
1321 t.Graphics.DrawPolygon(blackPen, curvePoints);
\r
1323 Assert.That(t.PDCompare()); // .NET's lines of polygon is more wi, Is.Truede
\r
1327 public virtual void DrawPolygonPointF() {
\r
1329 Pen blackPen = new Pen(Color.Black, 3);
\r
1330 // Create points that define polygon.
\r
1331 PointF point1 = new PointF( 50, 50);
\r
1332 PointF point2 = new PointF(100, 25);
\r
1333 PointF point3 = new PointF(200, 5);
\r
1334 PointF point4 = new PointF(250, 50);
\r
1335 PointF point5 = new PointF(300, 100);
\r
1336 PointF point6 = new PointF(350, 200);
\r
1337 PointF point7 = new PointF(250, 250);
\r
1338 PointF[] curvePoints = {
\r
1347 // Draw polygon to screen.
\r
1348 t.Graphics.DrawPolygon(blackPen, curvePoints);
\r
1350 Assert.That(t.PDCompare(), Is.True);
\r
1354 public virtual void DrawRectangleFloat() {
\r
1356 Pen blackPen = new Pen(Color.Black, 3);
\r
1357 // Create location and size of rectangle.
\r
1360 float width = 200.0F;
\r
1361 float height = 200.0F;
\r
1362 // Draw rectangle to screen.
\r
1363 t.Graphics.DrawRectangle(blackPen, x, y, width, height);
\r
1365 Assert.That(t.PDCompare(), Is.True);
\r
1368 t.Graphics.DrawRectangle(blackPen, (int)x, (int)y, (int)width, (int)height);
\r
1370 Assert.That(t.PDCompare(), Is.True);
\r
1373 t.Graphics.DrawRectangle(blackPen, new Rectangle( (int)x, (int)y, (int)width, (int)height));
\r
1375 Assert.That(t.PDCompare(), Is.True);
\r
1379 public virtual void DrawRectanglesRectangleF() {
\r
1381 Pen blackPen = new Pen(Color.Black, 3);
\r
1382 // Create array of rectangles.
\r
1383 RectangleF[] rects = {
\r
1384 new RectangleF( 20.0F, 20.0F, 100.0F, 200.0F),
\r
1385 new RectangleF(100.0F, 200.0F, 250.0F, 50.0F),
\r
1386 new RectangleF(300.0F, 20.0F, 50.0F, 100.0F)
\r
1388 // Draw rectangles to screen.
\r
1389 t.Graphics.DrawRectangles(blackPen, rects);
\r
1391 Assert.That(t.PDCompare(), Is.True);
\r
1395 public virtual void DrawRectanglesRectangle() {
\r
1397 Pen blackPen = new Pen(Color.Black, 3);
\r
1398 // Create array of rectangles.
\r
1399 Rectangle[] rects = {
\r
1400 new Rectangle( 20, 20, 100, 200),
\r
1401 new Rectangle(100, 200, 250, 50),
\r
1402 new Rectangle(300, 20, 50, 100)
\r
1404 // Draw rectangles to screen.
\r
1405 t.Graphics.DrawRectangles(blackPen, rects);
\r
1407 Assert.That(t.PDCompare(), Is.True);
\r
1410 [Test] //TBD: add more combinations
\r
1411 [Category("NotWorking")]
\r
1412 public virtual void DrawStringFloatFormat() {
\r
1413 // Create string to draw.
\r
1414 String drawString = "Sample Text";
\r
1415 // Create font and brush.
\r
1416 Font drawFont = new Font("Arial", 34, FontStyle.Italic);
\r
1417 SolidBrush drawBrush = new SolidBrush(Color.Black);
\r
1418 // Create point for upper-left corner of drawing.
\r
1421 // Set format of string.
\r
1422 StringFormat drawFormat = new StringFormat();
\r
1423 drawFormat.FormatFlags = StringFormatFlags.DirectionVertical;
\r
1424 // Draw string to screen.
\r
1425 t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
\r
1427 Assert.That(t.PDCompare()); // in .net the font is shmooth, Is.Trueed
\r
1430 drawFormat.FormatFlags = StringFormatFlags.NoClip;
\r
1431 // Draw string to screen.
\r
1432 t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
\r
1434 Assert.That(t.PDCompare(), Is.True);
\r
1437 drawFormat.FormatFlags = StringFormatFlags.FitBlackBox;
\r
1438 // Draw string to screen.
\r
1439 t.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
\r
1441 Assert.That(t.PDCompare(), Is.True);
\r
1445 public virtual void EndContainerState() {
\r
1446 // Begin graphics container.
\r
1447 GraphicsContainer containerState = t.Graphics.BeginContainer();
\r
1448 // Translate world transformation.
\r
1449 t.Graphics.TranslateTransform(100.0F, 100.0F);
\r
1450 // Fill translated rectangle in container with red.
\r
1451 t.Graphics.FillRectangle(new SolidBrush(Color.Red), 0, 0, 200, 200);
\r
1453 // End graphics container.
\r
1454 t.Graphics.EndContainer(containerState);
\r
1455 // Fill untransformed rectangle with green.
\r
1456 t.Graphics.FillRectangle(new SolidBrush(Color.Green), 0, 0, 200, 200);
\r
1458 Assert.That(t.PDCompare(), Is.True);
\r
1462 public virtual void EnumerateMetafile() {
\r
1466 public virtual void ExcludeClipRegion() {
\r
1467 // Create rectangle for exclusion.
\r
1468 Rectangle excludeRect = new Rectangle(100, 100, 200, 200);
\r
1469 // Set clipping region to exclude rectangle.
\r
1470 t.Graphics.ExcludeClip(excludeRect);
\r
1471 // Fill large rectangle to show clipping region.
\r
1472 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 300, 300);
\r
1474 Assert.That(t.PDCompare(), Is.True);
\r
1478 public virtual void FillClosedCurvePointFillModeTension() {
\r
1479 // Create solid brush.
\r
1480 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1481 // Create array of points for curve.
\r
1482 Point point1 = new Point(100, 100);
\r
1483 Point point2 = new Point(200, 50);
\r
1484 Point point3 = new Point(250, 200);
\r
1485 Point point4 = new Point( 50, 150);
\r
1486 Point[] points = {point1, point2, point3, point4};
\r
1488 FillMode newFillMode = FillMode.Winding;
\r
1490 float tension = 0.68F;
\r
1491 // Fill curve on screen.
\r
1492 t.Graphics.FillClosedCurve(redBrush, points);
\r
1494 Assert.That(t.PDCompare(), Is.True);
\r
1497 t.Graphics.FillClosedCurve(redBrush, points, newFillMode);
\r
1499 Assert.That(t.PDCompare(), Is.True);
\r
1502 newFillMode = FillMode.Alternate;
\r
1503 t.Graphics.FillClosedCurve(redBrush, points, newFillMode, tension);
\r
1505 Assert.That(t.PDCompare(), Is.True);
\r
1509 public virtual void FillClosedCurvePointFFillModeTension() {
\r
1510 // Create solid brush.
\r
1511 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1512 // Create array of points for curve.
\r
1513 PointF point1 = new PointF(100.0F, 100.0F);
\r
1514 PointF point2 = new PointF(200.0F, 50.0F);
\r
1515 PointF point3 = new PointF(250.0F, 200.0F);
\r
1516 PointF point4 = new PointF( 50.0F, 150.0F);
\r
1517 PointF[] points = {point1, point2, point3, point4};
\r
1519 FillMode newFillMode = FillMode.Winding;
\r
1521 float tension = 0.68F;
\r
1522 // Fill curve on screen.
\r
1523 t.Graphics.FillClosedCurve(redBrush, points);
\r
1525 Assert.That(t.PDCompare(), Is.True);
\r
1528 t.Graphics.FillClosedCurve(redBrush, points, newFillMode);
\r
1530 Assert.That(t.PDCompare(), Is.True);
\r
1533 newFillMode = FillMode.Alternate;
\r
1534 t.Graphics.FillClosedCurve(redBrush, points, newFillMode, tension);
\r
1536 Assert.That(t.PDCompare(), Is.True);
\r
1540 public virtual void FillEllipse() {
\r
1541 // Create solid brush.
\r
1542 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1543 // Create location and size of ellipse.
\r
1548 // Fill ellipse on screen.
\r
1549 t.Graphics.FillEllipse(redBrush, x, y, width, height);
\r
1551 Assert.That(t.PDCompare(), Is.True);
\r
1554 t.Graphics.FillEllipse(redBrush, new Rectangle( x, y, width, height));
\r
1556 Assert.That(t.PDCompare(), Is.True);
\r
1560 public virtual void FillEllipseFloat() {
\r
1561 // Create solid brush.
\r
1562 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1563 // Create location and size of ellipse.
\r
1566 float width = 200.0F;
\r
1567 float height = 100.0F;
\r
1568 // Fill ellipse on screen.
\r
1569 t.Graphics.FillEllipse(redBrush, x, y, width, height);
\r
1571 Assert.That(t.PDCompare(), Is.True);
\r
1574 t.Graphics.FillEllipse(redBrush, new RectangleF( x, y, width, height));
\r
1576 Assert.That(t.PDCompare(), Is.True);
\r
1580 public virtual void FillPathEllipse() {
\r
1581 // Create solid brush.
\r
1582 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1583 // Create graphics path object and add ellipse.
\r
1584 GraphicsPath graphPath = new GraphicsPath();
\r
1585 graphPath.AddEllipse(0, 0, 200, 100);
\r
1586 // Fill graphics path to screen.
\r
1587 t.Graphics.FillPath(redBrush, graphPath);
\r
1589 Assert.That(t.PDCompare(), Is.True);
\r
1593 public virtual void FillPieFloat() {
\r
1594 // Create solid brush.
\r
1595 SolidBrush redBrush = new SolidBrush(Color.Red);
\r
1596 // Create location and size of ellipse.
\r
1601 // Create start and sweep angles.
\r
1602 float startAngle = 0.0F;
\r
1603 float sweepAngle = 45.0F;
\r
1604 // Fill pie to screen.
\r
1605 t.Graphics.FillPie(redBrush, new Rectangle(x, y, width, height), startAngle, sweepAngle);
\r
1607 Assert.That(t.PDCompare(), Is.True);
\r
1610 t.Graphics.FillPie(redBrush, x, y, width, height, (int)startAngle, (int)sweepAngle);
\r
1612 Assert.That(t.PDCompare(), Is.True);
\r
1615 t.Graphics.FillPie(redBrush, (float)x, (float)y, (float)width, (float)height, startAngle, sweepAngle);
\r
1617 Assert.That(t.PDCompare(), Is.True);
\r
1621 public virtual void FillPolygonPointFillMode() {
\r
1622 // Create solid brush.
\r
1623 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1624 // Create points that define polygon.
\r
1625 Point point1 = new Point( 50, 50);
\r
1626 Point point2 = new Point(100, 25);
\r
1627 Point point3 = new Point(200, 5);
\r
1628 Point point4 = new Point(250, 50);
\r
1629 Point point5 = new Point(300, 100);
\r
1630 Point point6 = new Point(350, 200);
\r
1631 Point point7 = new Point(250, 250);
\r
1632 Point[] curvePoints = {
\r
1642 // Fill polygon to screen.
\r
1643 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Winding);
\r
1645 Assert.That(t.PDCompare(), Is.True);
\r
1648 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Alternate);
\r
1650 Assert.That(t.PDCompare(), Is.True);
\r
1653 t.Graphics.FillPolygon(blueBrush, curvePoints);
\r
1655 Assert.That(t.PDCompare(), Is.True);
\r
1659 public virtual void FillPolygonPointFFillMode() {
\r
1660 // Create solid brush.
\r
1661 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1662 // Create points that define polygon.
\r
1663 PointF point1 = new PointF( 50.0F, 50.0F);
\r
1664 PointF point2 = new PointF(100.0F, 25.0F);
\r
1665 PointF point3 = new PointF(200.0F, 5.0F);
\r
1666 PointF point4 = new PointF(250.0F, 50.0F);
\r
1667 PointF point5 = new PointF(300.0F, 100.0F);
\r
1668 PointF point6 = new PointF(350.0F, 200.0F);
\r
1669 PointF point7 = new PointF(250.0F, 250.0F);
\r
1670 PointF[] curvePoints = {
\r
1680 // Fill polygon to screen.
\r
1681 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Winding);
\r
1683 Assert.That(t.PDCompare(), Is.True);
\r
1686 t.Graphics.FillPolygon(blueBrush, curvePoints, FillMode.Alternate);
\r
1688 Assert.That(t.PDCompare(), Is.True);
\r
1691 t.Graphics.FillPolygon(blueBrush, curvePoints);
\r
1693 Assert.That(t.PDCompare(), Is.True);
\r
1697 public virtual void FillRectangle() {
\r
1698 // Create solid brush.
\r
1699 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1700 // Create location and size of rectangle.
\r
1705 // Fill rectangle to screen.
\r
1706 t.Graphics.FillRectangle(blueBrush, x, y, width, height);
\r
1708 Assert.That(t.PDCompare(), Is.True);
\r
1711 t.Graphics.FillRectangle(blueBrush, new Rectangle( x, y, width, height));
\r
1713 Assert.That(t.PDCompare(), Is.True);
\r
1717 public virtual void FillRectangleFloat() {
\r
1718 // Create solid brush.
\r
1719 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1720 // Create location and size of rectangle.
\r
1723 float width = 300.0F;
\r
1724 float height = 200.0F;
\r
1725 // Fill rectangle to screen.
\r
1726 t.Graphics.FillRectangle(blueBrush, x, y, width, height);
\r
1728 Assert.That(t.PDCompare(), Is.True);
\r
1731 t.Graphics.FillRectangle(blueBrush, new RectangleF( x, y, width, height));
\r
1733 Assert.That(t.PDCompare(), Is.True);
\r
1737 public virtual void FillRectanglesRectangle() {
\r
1738 // Create solid brush.
\r
1739 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1740 // Create array of rectangles.
\r
1741 Rectangle[] rects = {
\r
1742 new Rectangle( 0, 0, 100, 200),
\r
1743 new Rectangle(100, 200, 250, 50),
\r
1744 new Rectangle(300, 0, 50, 100)
\r
1746 // Fill rectangles to screen.
\r
1747 t.Graphics.FillRectangles(blueBrush, rects);
\r
1749 Assert.That(t.PDCompare(), Is.True);
\r
1753 public virtual void FillRectanglesRectangleF() {
\r
1754 // Create solid brush.
\r
1755 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1756 // Create array of rectangles.
\r
1757 RectangleF[] rects = {
\r
1758 new RectangleF( 0.0F, 0.0F, 100.0F, 200.0F),
\r
1759 new RectangleF(100.0F, 200.0F, 250.0F, 50.0F),
\r
1760 new RectangleF(300.0F, 0.0F, 50.0F, 100.0F)
\r
1762 // Fill rectangles to screen.
\r
1763 t.Graphics.FillRectangles(blueBrush, rects);
\r
1765 Assert.That(t.PDCompare(), Is.True);
\r
1769 public virtual void FillRegionRectangle() {
\r
1770 // Create solid brush.
\r
1771 SolidBrush blueBrush = new SolidBrush(Color.Blue);
\r
1772 // Create rectangle for region.
\r
1773 Rectangle fillRect = new Rectangle(100, 150, 200, 250);
\r
1774 // Create region for fill.
\r
1775 Region fillRegion = new Region(fillRect);
\r
1776 // Fill region to screen.
\r
1777 t.Graphics.FillRegion(blueBrush, fillRegion);
\r
1779 Assert.That(t.PDCompare(), Is.True);
\r
1783 public virtual void FlushTest() {
\r
1784 t.Graphics.Flush();
\r
1785 t.Graphics.Flush(FlushIntention.Flush);
\r
1789 public virtual void IntersectClipRegion() {
\r
1790 // Set clipping region.
\r
1791 Rectangle clipRect = new Rectangle(0, 0, 200, 300);
\r
1792 Region clipRegion = new Region(clipRect);
\r
1793 t.Graphics.SetClip(clipRegion, CombineMode.Replace);
\r
1794 // Update clipping region to intersection of
\r
1795 // existing region with specified rectangle.
\r
1796 Rectangle intersectRect = new Rectangle(100, 100, 200, 300);
\r
1797 Region intersectRegion = new Region(intersectRect);
\r
1798 t.Graphics.IntersectClip(intersectRegion);
\r
1799 // Fill rectangle to demonstrate effective clipping region.
\r
1800 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 600);
\r
1802 // Reset clipping region to infinite.
\r
1803 t.Graphics.ResetClip();
\r
1804 // Draw clipRect and intersectRect to screen.
\r
1805 t.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
\r
1807 t.Graphics.DrawRectangle(new Pen(Color.Red), intersectRect);
\r
1809 Assert.That(t.PDCompare(), Is.True);
\r
1813 public virtual void IsVisible4Float() {
\r
1814 // Set clip region.
\r
1815 Region clipRegion = new Region(new Rectangle(50, 50, 100, 100));
\r
1816 t.Graphics.SetClip(clipRegion, CombineMode.Replace);
\r
1817 // Set up coordinates of rectangles.
\r
1818 float x1 = 100.0F;
\r
1819 float y1 = 100.0F;
\r
1820 float width1 = 20.0F;
\r
1821 float height1 = 20.0F;
\r
1822 float x2 = 200.0F;
\r
1823 float y2 = 200.0F;
\r
1824 float width2 = 20.0F;
\r
1825 float height2 = 20.0F;
\r
1826 // If rectangle is visible, fill it.
\r
1827 if (t.Graphics.IsVisible(x1, y1, width1, height1)) {
\r
1828 t.Graphics.FillRectangle(new SolidBrush(Color.Red), x1, y1, width1, height1);
\r
1831 if (t.Graphics.IsVisible(x2, y2, width2, height2)) {
\r
1832 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), x2, y2, width2, height2);
\r
1836 Assert.That(t.PDCompare(), Is.True);
\r
1840 [Category("NotWorking")]
\r
1841 public virtual void MeasureCharacterRangesRegions() {
\r
1843 string measureString = "First and Second ranges";
\r
1844 Font stringFont = new Font("Times New Roman", 16.0F);
\r
1845 // Set character ranges to "First" and "Second".
\r
1846 CharacterRange[] characterRanges = {
\r
1847 new CharacterRange(0, 5),
\r
1848 new CharacterRange(10, 6)
\r
1850 // Create rectangle for layout.
\r
1853 float width = 35.0F;
\r
1854 float height = 200.0F;
\r
1855 RectangleF layoutRect = new RectangleF(x, y, width, height);
\r
1856 // Set string format.
\r
1857 StringFormat stringFormat = new StringFormat();
\r
1858 stringFormat.FormatFlags = StringFormatFlags.DirectionVertical;
\r
1859 stringFormat.SetMeasurableCharacterRanges(characterRanges);
\r
1860 // Draw string to screen.
\r
1861 t.Graphics.DrawString(
\r
1867 // Measure two ranges in string.
\r
1868 Region[] stringRegions = new Region[2];
\r
1869 stringRegions = t.Graphics.MeasureCharacterRanges(
\r
1874 // Draw rectangle for first measured range.
\r
1875 RectangleF measureRect1 = stringRegions[0].GetBounds(t.Graphics);
\r
1876 t.Graphics.DrawRectangle(
\r
1877 new Pen(Color.Red, 1),
\r
1878 Rectangle.Round(measureRect1));
\r
1880 // Draw rectangle for second measured range.
\r
1881 RectangleF measureRect2 = stringRegions[1].GetBounds(t.Graphics);
\r
1882 t.Graphics.DrawRectangle(
\r
1883 new Pen(Color.Blue, 1),
\r
1884 Rectangle.Round(measureRect2));
\r
1886 Assert.That(t.PDCompare(), Is.True);
\r
1889 [Test] //TBD: add more overloads
\r
1890 [Category("NotWorking")]
\r
1891 public virtual void MeasureStringSizeFFormatInts() {
\r
1893 string measureString = "Measure String";
\r
1894 Font stringFont = new Font("Arial", 16);
\r
1895 // Set maximum layout size.
\r
1896 SizeF layoutSize = new SizeF(100.0F, 200.0F);
\r
1897 // Set string format.
\r
1898 StringFormat newStringFormat = new StringFormat();
\r
1899 newStringFormat.FormatFlags = StringFormatFlags.DirectionVertical;
\r
1900 // Measure string.
\r
1901 int charactersFitted;
\r
1903 SizeF stringSize = new SizeF();
\r
1904 stringSize = t.Graphics.MeasureString(
\r
1909 out charactersFitted,
\r
1911 // Draw rectangle representing size of string.
\r
1912 t.Graphics.DrawRectangle(
\r
1913 new Pen(Color.Red, 1),
\r
1914 0.0F, 0.0F, stringSize.Width, stringSize.Height);
\r
1916 // Draw string to screen.
\r
1917 t.Graphics.DrawString(
\r
1924 // Draw output parameters to screen.
\r
1925 string outString = "chars " + charactersFitted + ", lines " + linesFilled;
\r
1926 t.Graphics.DrawString(
\r
1930 new PointF(100, 0));
\r
1932 Assert.That(t.PDCompare(), Is.True);
\r
1936 public virtual void MultiplyTransform() {
\r
1937 // Create transform matrix.
\r
1938 Matrix transformMatrix = new Matrix();
\r
1939 // Translate matrix, prepending translation vector.
\r
1940 transformMatrix.Translate(200.0F, 100.0F);
\r
1941 // Rotate transformation matrix of graphics object,
\r
1942 // prepending rotation matrix.
\r
1943 t.Graphics.RotateTransform(30.0F);
\r
1944 // Multiply (append to) transformation matrix of
\r
1945 // graphics object to translate graphics transformation.
\r
1946 t.Graphics.MultiplyTransform(transformMatrix);
\r
1947 // Draw rotated, translated ellipse.
\r
1948 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
\r
1950 Assert.That(t.PDCompare(), Is.True);
\r
1954 public virtual void MultiplyTransformMatrixOrder() {
\r
1955 // Create transform matrix.
\r
1956 Matrix transformMatrix = new Matrix();
\r
1957 // Translate matrix, prepending translation vector.
\r
1958 transformMatrix.Translate(200.0F, 100.0F);
\r
1959 // Rotate transformation matrix of graphics object,
\r
1960 // prepending rotation matrix.
\r
1961 t.Graphics.RotateTransform(30.0F);
\r
1962 // Multiply (append to) transformation matrix of
\r
1963 // graphics object to translate graphics transformation.
\r
1964 t.Graphics.MultiplyTransform(transformMatrix, MatrixOrder.Append);
\r
1965 // Draw rotated, translated ellipse.
\r
1966 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
\r
1968 Assert.That(t.PDCompare(), Is.True);
\r
1972 public virtual void MultiplyTransformMatrixOrder1() {
\r
1973 // Create transform matrix.
\r
1974 Matrix transformMatrix = new Matrix();
\r
1975 // Translate matrix, prepending translation vector.
\r
1976 transformMatrix.Translate(200.0F, 100.0F);
\r
1977 // Rotate transformation matrix of graphics object,
\r
1978 // prepending rotation matrix.
\r
1979 t.Graphics.RotateTransform(30.0F);
\r
1980 // Multiply (append to) transformation matrix of
\r
1981 // graphics object to translate graphics transformation.
\r
1982 t.Graphics.MultiplyTransform(transformMatrix, MatrixOrder.Prepend);
\r
1983 // Draw rotated, translated ellipse.
\r
1984 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
\r
1986 Assert.That(t.PDCompare(), Is.True);
\r
1990 public virtual void ResetClipIntersectClipRectangleF() {
\r
1991 // Set clipping region.
\r
1992 Rectangle clipRect = new Rectangle(0, 0, 200, 200);
\r
1993 t.Graphics.SetClip(clipRect);
\r
1994 // Update clipping region to intersection of existing region with new rectangle.
\r
1995 RectangleF intersectRectF = new RectangleF(100.0F, 100.0F, 200.0F, 200.0F);
\r
1996 t.Graphics.IntersectClip(intersectRectF);
\r
1997 // Fill rectangle to demonstrate effective clipping region.
\r
1998 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 500);
\r
1999 // Reset clipping region to infinite.
\r
2000 t.Graphics.ResetClip();
\r
2001 // Draw clipRect and intersectRect to screen.
\r
2002 t.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
\r
2003 t.Graphics.DrawRectangle(new Pen(Color.Red), Rectangle.Round(intersectRectF));
\r
2005 Assert.That(t.PDCompare(), Is.True);
\r
2009 public virtual void SaveRestoreTranslate() {
\r
2010 // Translate transformation matrix.
\r
2011 t.Graphics.TranslateTransform(100, 0);
\r
2012 // Save translated graphics state.
\r
2013 GraphicsState transState = t.Graphics.Save();
\r
2014 // Reset transformation matrix to identity and fill rectangle.
\r
2015 t.Graphics.ResetTransform();
\r
2016 t.Graphics.FillRectangle(new SolidBrush(Color.Red), 0, 0, 100, 100);
\r
2018 // Restore graphics state to translated state and fill second rectangle.
\r
2019 t.Graphics.Restore(transState);
\r
2020 t.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 100, 100);
\r
2022 Assert.That(t.PDCompare(), Is.True);
\r
2026 public virtual void RotateTransformAngleMatrixOrder() {
\r
2027 // Set world transform of graphics object to translate.
\r
2028 t.Graphics.TranslateTransform(100.0F, 0.0F);
\r
2029 // Then to rotate, appending rotation matrix.
\r
2030 t.Graphics.RotateTransform(30.0F, MatrixOrder.Append);
\r
2031 // Draw translated, rotated ellipse to screen.
\r
2032 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2034 Assert.That(t.PDCompare(), Is.True);
\r
2038 public virtual void RotateTransformAngleMatrixOrder1() {
\r
2039 // Set world transform of graphics object to translate.
\r
2040 t.Graphics.TranslateTransform(100.0F, 0.0F);
\r
2041 // Then to rotate, appending rotation matrix.
\r
2042 t.Graphics.RotateTransform(30.0F, MatrixOrder.Prepend);
\r
2043 // Draw translated, rotated ellipse to screen.
\r
2044 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2046 Assert.That(t.PDCompare()); // Line width probl, Is.Trueem
\r
2050 public virtual void ScaleTransformFloatMatrixOrder() {
\r
2051 // Set world transform of graphics object to rotate.
\r
2052 t.Graphics.RotateTransform(30.0F);
\r
2053 // Then to scale, appending to world transform.
\r
2054 t.Graphics.ScaleTransform(3.0F, 1.0F, MatrixOrder.Append);
\r
2055 // Draw rotated, scaled rectangle to screen.
\r
2056 t.Graphics.DrawRectangle(new Pen(Color.Blue, 3), 50, 0, 100, 40);
\r
2058 Assert.That(t.PDCompare()); // Line width probl, Is.Trueem
\r
2062 public virtual void ScaleTransformFloatMatrixOrder1() {
\r
2063 // Set world transform of graphics object to rotate.
\r
2064 t.Graphics.RotateTransform(30.0F);
\r
2065 // Then to scale, appending to world transform.
\r
2066 t.Graphics.ScaleTransform(3.0F, 1.0F, MatrixOrder.Prepend);
\r
2067 // Draw rotated, scaled rectangle to screen.
\r
2068 t.Graphics.DrawRectangle(new Pen(Color.Blue, 3), 50, 0, 100, 40);
\r
2070 Assert.That(t.PDCompare(), Is.True);
\r
2073 [Test] //TBD: add more combination
\r
2074 public virtual void SetClipRegionCombine() {
\r
2075 // Create region for clipping.
\r
2076 Region clipRegion = new Region(new Rectangle(0, 0, 200, 100));
\r
2077 // Set clipping region of graphics to region.
\r
2078 t.Graphics.SetClip(clipRegion, CombineMode.Replace);
\r
2079 // Fill rectangle to demonstrate clip region.
\r
2080 t.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
\r
2082 Assert.That(t.PDCompare(), Is.True);
\r
2086 public virtual void TransformPointsPointF() {
\r
2087 // Create array of two points.
\r
2088 PointF[] points = {new PointF(0.0F, 0.0F),
\r
2089 new PointF(100.0F, 50.0F)};
\r
2090 // Draw line connecting two untransformed points.
\r
2091 t.Graphics.DrawLine(new Pen(Color.Blue, 3),
\r
2094 // Set world transformation of Graphics object to translate.
\r
2095 t.Graphics.TranslateTransform(40.0F, 30.0F);
\r
2096 // Transform points in array from world to page coordinates.
\r
2097 t.Graphics.TransformPoints(CoordinateSpace.Page,
\r
2098 CoordinateSpace.World,
\r
2100 // Reset world transformation.
\r
2101 t.Graphics.ResetTransform();
\r
2102 // Draw line that connects transformed points.
\r
2103 t.Graphics.DrawLine(new Pen(Color.Red, 3),
\r
2107 Assert.That(t.PDCompare(), Is.True);
\r
2111 public virtual void TranslateClipFloat() {
\r
2112 // Create rectangle for clipping region.
\r
2113 RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);
\r
2114 // Set clipping region of graphics to rectangle.
\r
2115 t.Graphics.SetClip(clipRect);
\r
2116 // Translate clipping region.
\r
2119 t.Graphics.TranslateClip(dx, dy);
\r
2120 // Fill rectangle to demonstrate translated clip region.
\r
2121 t.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
\r
2123 Assert.That(t.PDCompare(), Is.True);
\r
2127 public virtual void TranslateTransformAngleMatrixOrder() {
\r
2128 // Set world transform of graphics object to rotate.
\r
2129 t.Graphics.RotateTransform(30.0F);
\r
2130 // Then to translate, appending to world transform.
\r
2131 t.Graphics.TranslateTransform(100.0F, 0.0F, MatrixOrder.Append);
\r
2132 // Draw rotated, translated ellipse to screen.
\r
2133 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2135 Assert.That(t.PDCompare()); // Line width probl, Is.Trueem
\r
2139 public virtual void TranslateTransformAngleMatrixOrder1() {
\r
2140 // Set world transform of graphics object to rotate.
\r
2141 t.Graphics.RotateTransform(30.0F);
\r
2142 // Then to translate, appending to world transform.
\r
2143 t.Graphics.TranslateTransform(100.0F, 0.0F, MatrixOrder.Prepend);
\r
2144 // Draw rotated, translated ellipse to screen.
\r
2145 t.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
\r
2147 Assert.That(t.PDCompare(), Is.True);
\r
2151 public virtual void TransfromPageScaleUnits() {
\r
2152 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2153 t.Graphics.PageScale = 1.0F;
\r
2154 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2156 t.Graphics.PageUnit = GraphicsUnit.Document;
\r
2157 t.Graphics.PageScale = 10.0F;
\r
2158 t.Graphics.DrawLine(Pens.Blue, 10, 70, 70, 10);
\r
2160 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
2161 t.Graphics.PageScale = 0.055F;
\r
2162 t.Graphics.DrawLine(Pens.Green, 10, 70, 70, 10);
\r
2164 Matrix mx=new Matrix(0.5f,0,0,0.5f,0,0);
\r
2165 t.Graphics.Transform = mx;
\r
2167 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
2168 t.Graphics.DrawLine(Pens.Black, 10, 70, 70, 10);
\r
2170 t.Graphics.PageUnit = GraphicsUnit.Point;
\r
2171 t.Graphics.PageScale = 2.7F;
\r
2172 t.Graphics.DrawLine(Pens.Yellow, 10, 70, 70, 10);
\r
2175 Assert.That(t.PDCompare(), Is.True);
\r
2179 public virtual void TransfromPageScaleUnits_2() {
\r
2180 t.Graphics.RotateTransform(45);
\r
2181 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2182 t.Graphics.PageScale = 1.0F;
\r
2183 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2185 t.Graphics.TranslateTransform(100, 0);
\r
2186 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2187 t.Graphics.PageScale = 2.0F;
\r
2188 t.Graphics.DrawLine(Pens.Blue, 10, 70, 70, 10);
\r
2190 t.Graphics.ResetTransform();
\r
2191 t.Graphics.DrawLine(Pens.Green, 10, 70, 70, 10);
\r
2194 Assert.That(t.PDCompare(), Is.True);
\r
2197 public virtual void TransfromPageScaleUnits_3() {
\r
2198 t.Graphics.TranslateTransform(20, 20);
\r
2199 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2200 t.Graphics.PageScale = 1.0F;
\r
2201 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2203 t.Graphics.TranslateTransform(10, 10);
\r
2204 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2205 t.Graphics.PageScale = 1.0F;
\r
2206 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2208 t.Graphics.RotateTransform(15);
\r
2210 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2211 t.Graphics.PageScale = 0.5F;
\r
2212 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2214 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2215 t.Graphics.PageScale = 0.5F;
\r
2216 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2218 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2219 t.Graphics.TranslateTransform(0, 0);
\r
2220 t.Graphics.PageScale = 1.5F;
\r
2221 t.Graphics.DrawLine(Pens.Red, 10, 70, 70, 10);
\r
2224 Assert.That(t.PDCompare(), Is.True);
\r
2231 #region GraphicsFixturePropClip
\r
2234 public class GraphicsFixturePropClip : GraphicsFixture {
\r
2235 public override void SetUp() {
\r
2236 base.SetUp ("GraphicsFixturePropClip");
\r
2237 t.Graphics.Clip = new Region(new Rectangle(10, 10, 100, 100));
\r
2239 st["DrawArcTest:6"] = TOLERANCE * 5.0f;
\r
2240 st["DrawArcTest:8"] = TOLERANCE * 3.7f;
\r
2241 st["DrawLinesTest:2"] = TOLERANCE * 3.0f;
\r
2242 st["DrawLinesTestF:2"] = TOLERANCE * 3.0f;
\r
2243 st["DrawPieTestF:2"] = TOLERANCE * 2.0f;
\r
2244 st["DrawPieTestF:4"] = TOLERANCE * 2.0f;
\r
2245 st["DrawPieTest:2"] = TOLERANCE * 2.0f;
\r
2246 st["DrawPieTest:4"] = TOLERANCE * 2.0f;
\r
2247 st["FillClosedCurvePointFillModeTension:2"] = TOLERANCE * 1.5f;
\r
2248 st["FillClosedCurvePointFFillModeTension:2"] = TOLERANCE * 1.5f;
\r
2249 st["FillClosedCurvePointFillModeTension:4"] = TOLERANCE * 1.5f;
\r
2250 st["FillClosedCurvePointFFillModeTension:4"] = TOLERANCE * 1.5f;
\r
2251 st["FillClosedCurvePointFillModeTension:5"] = TOLERANCE * 1.5f;
\r
2252 st["FillClosedCurvePointFFillModeTension:6"] = TOLERANCE * 1.5f;
\r
2253 st["ScaleTransformFloatMatrixOrder1:2"] = TOLERANCE * 3.5f;
\r
2257 [Category("NotWorking")]
\r
2258 public override void DrawIconTest() {
\r
2259 base.DrawIconTest ();
\r
2263 [Category("NotWorking")]
\r
2264 public override void DrawIconUnstretchedTest() {
\r
2265 base.DrawIconUnstretchedTest ();
\r
2269 public override void DrawImageUnscaledTest() {
\r
2270 base.DrawImageUnscaledTest ();
\r
2274 public override void DrawStringFloatFormat() {
\r
2275 base.DrawStringFloatFormat ();
\r
2279 [Category("NotWorking")]
\r
2280 public override void MeasureCharacterRangesRegions() {
\r
2281 base.MeasureCharacterRangesRegions ();
\r
2285 [Category("NotWorking")]
\r
2286 public override void MeasureStringSizeFFormatInts() {
\r
2287 base.MeasureStringSizeFFormatInts ();
\r
2293 #region GraphicsFixturePropCompositingMode
\r
2296 public class GraphicsFixturePropCompositingMode1 : GraphicsFixture {
\r
2297 public override void SetUp() {
\r
2298 base.SetUp ("GraphicsFixturePropCompositingMode1");
\r
2299 t.Graphics.CompositingMode = CompositingMode.SourceCopy;
\r
2303 [Category("NotWorking")]
\r
2304 public override void DrawIconTest() {
\r
2305 base.DrawIconTest ();
\r
2309 [Category("NotWorking")]
\r
2310 public override void DrawIconUnstretchedTest() {
\r
2311 base.DrawIconUnstretchedTest ();
\r
2315 [Category("NotWorking")]
\r
2316 public override void DrawImageUnscaledTest() {
\r
2317 base.DrawImageUnscaledTest ();
\r
2321 [Category("NotWorking")]
\r
2322 public override void DrawStringFloatFormat() {
\r
2323 base.DrawStringFloatFormat ();
\r
2327 [Category("NotWorking")]
\r
2328 public override void MeasureCharacterRangesRegions() {
\r
2329 base.MeasureCharacterRangesRegions ();
\r
2333 [Category("NotWorking")]
\r
2334 public override void MeasureStringSizeFFormatInts() {
\r
2335 base.MeasureStringSizeFFormatInts ();
\r
2340 public class GraphicsFixturePropCompositingMode2 : GraphicsFixture {
\r
2341 public override void SetUp() {
\r
2342 base.SetUp ("GraphicsFixturePropCompositingMode2");
\r
2343 t.Graphics.CompositingMode = CompositingMode.SourceOver;
\r
2347 [Category("NotWorking")]
\r
2348 public override void DrawIconTest() {
\r
2349 base.DrawIconTest ();
\r
2353 [Category("NotWorking")]
\r
2354 public override void DrawIconUnstretchedTest() {
\r
2355 base.DrawIconUnstretchedTest ();
\r
2359 [Category("NotWorking")]
\r
2360 public override void DrawImageUnscaledTest() {
\r
2361 base.DrawImageUnscaledTest ();
\r
2365 [Category("NotWorking")]
\r
2366 public override void DrawStringFloatFormat() {
\r
2367 base.DrawStringFloatFormat ();
\r
2371 [Category("NotWorking")]
\r
2372 public override void MeasureCharacterRangesRegions() {
\r
2373 base.MeasureCharacterRangesRegions ();
\r
2377 [Category("NotWorking")]
\r
2378 public override void MeasureStringSizeFFormatInts() {
\r
2379 base.MeasureStringSizeFFormatInts ();
\r
2385 #region GraphicsFixturePropInterpolationMode
\r
2388 public class GraphicsFixturePropInterpolationMode1 : GraphicsFixture {
\r
2389 public override void SetUp() {
\r
2390 base.SetUp ("GraphicsFixturePropInterpolationMode1");
\r
2391 t.Graphics.InterpolationMode = InterpolationMode.Bilinear;
\r
2395 [Category("NotWorking")]
\r
2396 public override void DrawIconTest() {
\r
2397 base.DrawIconTest ();
\r
2401 [Category("NotWorking")]
\r
2402 public override void DrawIconUnstretchedTest() {
\r
2403 base.DrawIconUnstretchedTest ();
\r
2407 [Category("NotWorking")]
\r
2408 public override void DrawImageUnscaledTest() {
\r
2409 base.DrawImageUnscaledTest ();
\r
2413 [Category("NotWorking")]
\r
2414 public override void DrawStringFloatFormat() {
\r
2415 base.DrawStringFloatFormat ();
\r
2419 [Category("NotWorking")]
\r
2420 public override void MeasureCharacterRangesRegions() {
\r
2421 base.MeasureCharacterRangesRegions ();
\r
2425 [Category("NotWorking")]
\r
2426 public override void MeasureStringSizeFFormatInts() {
\r
2427 base.MeasureStringSizeFFormatInts ();
\r
2432 public class GraphicsFixturePropInterpolationMode2 : GraphicsFixture {
\r
2433 public override void SetUp() {
\r
2434 base.SetUp ("GraphicsFixturePropInterpolationMode2");
\r
2435 t.Graphics.InterpolationMode = InterpolationMode.Bicubic;
\r
2439 [Category("NotWorking")]
\r
2440 public override void DrawIconTest() {
\r
2441 base.DrawIconTest ();
\r
2445 [Category("NotWorking")]
\r
2446 public override void DrawIconUnstretchedTest() {
\r
2447 base.DrawIconUnstretchedTest ();
\r
2451 [Category("NotWorking")]
\r
2452 public override void DrawImageUnscaledTest() {
\r
2453 base.DrawImageUnscaledTest ();
\r
2457 [Category("NotWorking")]
\r
2458 public override void DrawStringFloatFormat() {
\r
2459 base.DrawStringFloatFormat ();
\r
2463 [Category("NotWorking")]
\r
2464 public override void MeasureCharacterRangesRegions() {
\r
2465 base.MeasureCharacterRangesRegions ();
\r
2469 [Category("NotWorking")]
\r
2470 public override void MeasureStringSizeFFormatInts() {
\r
2471 base.MeasureStringSizeFFormatInts ();
\r
2477 #region GraphicsFixturePropPageScale
\r
2480 public class GraphicsFixturePropPageScale : GraphicsFixture {
\r
2481 public override void SetUp() {
\r
2482 base.SetUp ("GraphicsFixturePropPageScale");
\r
2484 t.Graphics.PageScale = 4.34f;
\r
2485 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2487 st["IntersectClipRegion:4"] = TOLERANCE * 1.5f;
\r
2488 st["ResetClipIntersectClipRectangleF:2"] = TOLERANCE * 1.5f;
\r
2492 [Category("NotWorking")]
\r
2493 public override void DrawIconTest() {
\r
2494 base.DrawIconTest ();
\r
2498 [Category("NotWorking")]
\r
2499 public override void DrawIconUnstretchedTest() {
\r
2500 base.DrawIconUnstretchedTest ();
\r
2504 [Category("NotWorking")]
\r
2505 public override void DrawImageUnscaledTest() {
\r
2506 base.DrawImageUnscaledTest ();
\r
2510 public override void DrawStringFloatFormat() {
\r
2511 base.DrawStringFloatFormat ();
\r
2515 [Category("NotWorking")]
\r
2516 public override void MeasureCharacterRangesRegions() {
\r
2517 base.MeasureCharacterRangesRegions ();
\r
2521 [Category("NotWorking")]
\r
2522 public override void MeasureStringSizeFFormatInts() {
\r
2523 base.MeasureStringSizeFFormatInts ();
\r
2529 #region GraphicsFixturePropPageUnit
\r
2532 public class GraphicsFixturePropPageUnit1 : GraphicsFixture {
\r
2533 public override void SetUp() {
\r
2534 base.SetUp ("GraphicsFixturePropPageUnit1");
\r
2535 t.Graphics.PageUnit = GraphicsUnit.Display;
\r
2539 [Category("NotWorking")]
\r
2540 public override void DrawIconTest() {
\r
2541 base.DrawIconTest ();
\r
2545 [Category("NotWorking")]
\r
2546 public override void DrawIconUnstretchedTest() {
\r
2547 base.DrawIconUnstretchedTest ();
\r
2551 [Category("NotWorking")]
\r
2552 public override void DrawImageUnscaledTest() {
\r
2553 base.DrawImageUnscaledTest ();
\r
2557 [Category("NotWorking")]
\r
2558 public override void DrawStringFloatFormat() {
\r
2559 base.DrawStringFloatFormat ();
\r
2563 [Category("NotWorking")]
\r
2564 public override void MeasureCharacterRangesRegions() {
\r
2565 base.MeasureCharacterRangesRegions ();
\r
2569 [Category("NotWorking")]
\r
2570 public override void MeasureStringSizeFFormatInts() {
\r
2571 base.MeasureStringSizeFFormatInts ();
\r
2576 public class GraphicsFixturePropPageUnit2 : GraphicsFixture {
\r
2577 public override void SetUp() {
\r
2578 base.SetUp ("GraphicsFixturePropPageUnit2");
\r
2579 t.Graphics.PageUnit = GraphicsUnit.Document;
\r
2581 // FIXME: scaling down loss some pixels.
\r
2582 st["DrawBezierTest:2"] = TOLERANCE * 2.5f;
\r
2583 st["DrawBezierTest:4"] = TOLERANCE * 2.5f;
\r
2584 st["DrawBezierTest:6"] = TOLERANCE * 2.5f;
\r
2585 st["DrawBeziersTest:2"] = TOLERANCE * 2.0f;
\r
2586 st["DrawBeziersTest:4"] = TOLERANCE * 2.0f;
\r
2587 st["DrawClosedCurveTest:2"] = TOLERANCE * 3.0f;
\r
2588 st["DrawClosedCurveTest:4"] = TOLERANCE * 3.7f;
\r
2589 st["DrawCurveTest:2"] = TOLERANCE * 2.5f;
\r
2590 st["DrawCurveTest:4"] = TOLERANCE * 2.0f;
\r
2591 st["DrawCurveTest:6"] = TOLERANCE * 4.0f;
\r
2592 st["DrawCurveTestF:2"] = TOLERANCE * 2.5f;
\r
2593 st["DrawCurveTestF:4"] = TOLERANCE * 6.0f;
\r
2594 st["DrawCurveTestF:6"] = TOLERANCE * 6.0f;
\r
2595 st["DrawCurveTestF:8"] = TOLERANCE * 6.0f;
\r
2596 st["DrawEllipseTest:2"] = TOLERANCE * 2.0f;
\r
2597 st["DrawEllipseTest:4"] = TOLERANCE * 2.0f;
\r
2598 st["DrawEllipseTestF:2"] = TOLERANCE * 2.0f;
\r
2599 st["DrawEllipseTestF:4"] = TOLERANCE * 2.0f;
\r
2600 st["DrawLinesTest:2"] = TOLERANCE * 2.0f;
\r
2601 st["DrawLinesTestF:2"] = TOLERANCE * 2.0f;
\r
2602 st["DrawPathTest:2"] = TOLERANCE * 2.0f;
\r
2603 st["DrawPolygonPoint:2"] = TOLERANCE * 7.0f;
\r
2604 st["DrawPolygonPointF:2"] = TOLERANCE * 7.0f;
\r
2605 st["FillPieFloat:2"] = TOLERANCE * 1.5f;
\r
2606 st["FillPieFloat:4"] = TOLERANCE * 1.5f;
\r
2607 st["FillPieFloat:6"] = TOLERANCE * 1.5f;
\r
2608 st["IntersectClipRegion:4"] = TOLERANCE * 3.0f;
\r
2609 st["MultiplyTransform:2"] = TOLERANCE * 2.5f;
\r
2610 st["MultiplyTransformMatrixOrder1:2"] = TOLERANCE * 2.5f;
\r
2611 st["TranslateTransformAngleMatrixOrder1:2"] = TOLERANCE * 4.0f;
\r
2612 st["ScaleTransformFloatMatrixOrder:2"] = TOLERANCE * 4.0f;
\r
2613 st["ScaleTransformFloatMatrixOrder1:2"] = TOLERANCE * 5.5f;
\r
2614 st["RotateTransformAngleMatrixOrder:2"] = TOLERANCE * 3.5f;
\r
2618 [Category("NotWorking")]
\r
2619 public override void BeginContainerTest() {
\r
2620 base.BeginContainerTest ();
\r
2624 [Category("NotWorking")]
\r
2625 public override void DrawIconTest() {
\r
2626 base.DrawIconTest ();
\r
2630 [Category("NotWorking")]
\r
2631 public override void DrawIconUnstretchedTest() {
\r
2632 base.DrawIconUnstretchedTest ();
\r
2636 [Category("NotWorking")]
\r
2637 public override void DrawImageUnscaledTest() {
\r
2638 base.DrawImageUnscaledTest ();
\r
2642 [Category("NotWorking")]
\r
2643 public override void DrawStringFloatFormat() {
\r
2644 base.DrawStringFloatFormat ();
\r
2648 [Category("NotWorking")]
\r
2649 public override void EndContainerState() {
\r
2650 base.EndContainerState ();
\r
2654 [Category("NotWorking")]
\r
2655 public override void MeasureCharacterRangesRegions() {
\r
2656 base.MeasureCharacterRangesRegions ();
\r
2660 [Category("NotWorking")]
\r
2661 public override void MeasureStringSizeFFormatInts() {
\r
2662 base.MeasureStringSizeFFormatInts ();
\r
2667 public class GraphicsFixturePropPageUnit3 : GraphicsFixture {
\r
2668 public override void SetUp() {
\r
2669 base.SetUp ("GraphicsFixturePropPageUnit3");
\r
2670 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
2674 [Category("NotWorking")]
\r
2675 public override void DrawIconTest() {
\r
2676 base.DrawIconTest ();
\r
2680 [Category("NotWorking")]
\r
2681 public override void DrawIconUnstretchedTest() {
\r
2682 base.DrawIconUnstretchedTest ();
\r
2686 public override void DrawImageUnscaledTest() {
\r
2687 base.DrawImageUnscaledTest ();
\r
2691 public override void DrawStringFloatFormat() {
\r
2692 base.DrawStringFloatFormat ();
\r
2696 [Category("NotWorking")]
\r
2697 public override void IsVisible4Float() {
\r
2698 base.IsVisible4Float ();
\r
2702 public override void MeasureCharacterRangesRegions() {
\r
2703 base.MeasureCharacterRangesRegions ();
\r
2707 [Category("NotWorking")]
\r
2708 public override void MeasureStringSizeFFormatInts() {
\r
2709 base.MeasureStringSizeFFormatInts ();
\r
2714 public class GraphicsFixturePropPageUnit4 : GraphicsFixture {
\r
2715 public override void SetUp() {
\r
2716 base.SetUp ("GraphicsFixturePropPageUnit4");
\r
2717 t.Graphics.PageUnit = GraphicsUnit.Millimeter;
\r
2719 st["DrawArcTest:8"] = TOLERANCE * 1.5f;
\r
2720 st["DrawRectangleFloat:2"] = TOLERANCE * 1.5f; // line width problem
\r
2721 st["DrawRectangleFloat:4"] = TOLERANCE * 1.5f;
\r
2722 st["DrawRectangleFloat:6"] = TOLERANCE * 1.5f;
\r
2723 st["DrawRectanglesRectangle:2"] = TOLERANCE * 1.5f;
\r
2724 st["DrawRectanglesRectangleF:2"] = TOLERANCE * 1.5f;
\r
2728 [Category("NotWorking")]
\r
2729 public override void DrawClosedCurveTest() {
\r
2730 base.DrawClosedCurveTest ();
\r
2734 [Category("NotWorking")]
\r
2735 public override void DrawIconTest() {
\r
2736 base.DrawIconTest ();
\r
2740 [Category("NotWorking")]
\r
2741 public override void DrawIconUnstretchedTest() {
\r
2742 base.DrawIconUnstretchedTest ();
\r
2746 [Category("NotWorking")]
\r
2747 public override void DrawImageUnscaledTest() {
\r
2748 base.DrawImageUnscaledTest ();
\r
2752 public override void DrawStringFloatFormat() {
\r
2753 base.DrawStringFloatFormat ();
\r
2757 [Category("NotWorking")]
\r
2758 public override void MeasureCharacterRangesRegions() {
\r
2759 base.MeasureCharacterRangesRegions ();
\r
2763 [Category("NotWorking")]
\r
2764 public override void MeasureStringSizeFFormatInts() {
\r
2765 base.MeasureStringSizeFFormatInts ();
\r
2770 public class GraphicsFixturePropPageUnit5 : GraphicsFixture {
\r
2771 public override void SetUp() {
\r
2772 base.SetUp ("GraphicsFixturePropPageUnit5");
\r
2774 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
2778 [Category("NotWorking")]
\r
2779 public override void DrawIconTest() {
\r
2780 base.DrawIconTest ();
\r
2784 [Category("NotWorking")]
\r
2785 public override void DrawIconUnstretchedTest() {
\r
2786 base.DrawIconUnstretchedTest ();
\r
2790 [Category("NotWorking")]
\r
2791 public override void DrawImageUnscaledTest() {
\r
2792 base.DrawImageUnscaledTest ();
\r
2796 [Category("NotWorking")]
\r
2797 public override void DrawStringFloatFormat() {
\r
2798 base.DrawStringFloatFormat ();
\r
2802 [Category("NotWorking")]
\r
2803 public override void MeasureCharacterRangesRegions() {
\r
2804 base.MeasureCharacterRangesRegions ();
\r
2808 [Category("NotWorking")]
\r
2809 public override void MeasureStringSizeFFormatInts() {
\r
2810 base.MeasureStringSizeFFormatInts ();
\r
2815 public class GraphicsFixturePropPageUnit6 : GraphicsFixture {
\r
2816 public override void SetUp() {
\r
2817 base.SetUp ("GraphicsFixturePropPageUnit6");
\r
2818 t.Graphics.PageUnit = GraphicsUnit.Point;
\r
2820 st["DrawArcTest:2"] = TOLERANCE * 2.5f;
\r
2821 st["DrawArcTest:4"] = TOLERANCE * 8.0f; // big difference in width of line
\r
2822 st["DrawArcTest:6"] = TOLERANCE * 8.0f; // big difference in width of line
\r
2823 st["DrawArcTest:8"] = TOLERANCE * 6.0f; // big difference in width of line
\r
2824 st["IsVisible4Float:2"] = TOLERANCE * 1.5f;
\r
2825 st["TransformPointsPointF:2"] = TOLERANCE * 2.0f;
\r
2829 [Category("NotWorking")]
\r
2830 public override void DrawClosedCurveTest() {
\r
2831 base.DrawClosedCurveTest ();
\r
2835 [Category("NotWorking")]
\r
2836 public override void DrawCurveTest() {
\r
2837 base.DrawCurveTest ();
\r
2841 [Category("NotWorking")]
\r
2842 public override void DrawCurveTestF() {
\r
2843 base.DrawCurveTestF ();
\r
2847 [Category("NotWorking")]
\r
2848 public override void DrawEllipseTest() {
\r
2849 base.DrawEllipseTest ();
\r
2853 [Category("NotWorking")]
\r
2854 public override void DrawEllipseTestF() {
\r
2855 base.DrawEllipseTestF ();
\r
2859 [Category("NotWorking")]
\r
2860 public override void DrawIconTest() {
\r
2861 base.DrawIconTest ();
\r
2865 [Category("NotWorking")]
\r
2866 public override void DrawIconUnstretchedTest() {
\r
2867 base.DrawIconUnstretchedTest ();
\r
2871 [Category("NotWorking")]
\r
2872 public override void DrawImageUnscaledTest() {
\r
2873 base.DrawImageUnscaledTest ();
\r
2877 [Category("NotWorking")]
\r
2878 public override void DrawPathTest() {
\r
2879 base.DrawPathTest ();
\r
2883 [Category("NotWorking")]
\r
2884 public override void DrawStringFloatFormat() {
\r
2885 base.DrawStringFloatFormat ();
\r
2889 [Category("NotWorking")]
\r
2890 public override void EndContainerState() {
\r
2891 base.EndContainerState ();
\r
2895 [Category("NotWorking")]
\r
2896 public override void MeasureCharacterRangesRegions() {
\r
2897 base.MeasureCharacterRangesRegions ();
\r
2901 [Category("NotWorking")]
\r
2902 public override void MeasureStringSizeFFormatInts() {
\r
2903 base.MeasureStringSizeFFormatInts ();
\r
2907 [Category("NotWorking")]
\r
2908 public override void MultiplyTransform() {
\r
2909 base.MultiplyTransform ();
\r
2913 [Category("NotWorking")]
\r
2914 public override void MultiplyTransformMatrixOrder1() {
\r
2915 base.MultiplyTransformMatrixOrder1 ();
\r
2919 [Category("NotWorking")]
\r
2920 public override void RotateTransformAngleMatrixOrder1() {
\r
2921 base.RotateTransformAngleMatrixOrder1 ();
\r
2925 [Category("NotWorking")]
\r
2926 public override void TranslateTransformAngleMatrixOrder() {
\r
2927 base.TranslateTransformAngleMatrixOrder ();
\r
2932 // public class GraphicsFixturePropPageUnit7 : GraphicsFixture {
\r
2933 // public override void SetUp() {
\r
2936 // t.Graphics.PageUnit = GraphicsUnit.World;
\r
2942 #region GraphicsFixturePropPixelOffsetMode
\r
2945 public class GraphicsFixturePropPixelOffsetMode : GraphicsFixture {
\r
2946 public override void SetUp() {
\r
2947 base.SetUp ("GraphicsFixturePropPixelOffsetMode");
\r
2948 t.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
\r
2950 st["TransformPointsPointF:2"] = TOLERANCE * 3.0f;
\r
2954 [Category("NotWorking")]
\r
2955 public override void DrawIconTest() {
\r
2956 base.DrawIconTest ();
\r
2960 [Category("NotWorking")]
\r
2961 public override void DrawIconUnstretchedTest() {
\r
2962 base.DrawIconUnstretchedTest ();
\r
2966 [Category("NotWorking")]
\r
2967 public override void DrawImageUnscaledTest() {
\r
2968 base.DrawImageUnscaledTest ();
\r
2972 [Category("NotWorking")]
\r
2973 public override void DrawStringFloatFormat() {
\r
2974 base.DrawStringFloatFormat ();
\r
2978 [Category("NotWorking")]
\r
2979 public override void MeasureCharacterRangesRegions() {
\r
2980 base.MeasureCharacterRangesRegions ();
\r
2984 [Category("NotWorking")]
\r
2985 public override void MeasureStringSizeFFormatInts() {
\r
2986 base.MeasureStringSizeFFormatInts ();
\r
2991 public class GraphicsFixturePropPixelOffsetMode1 : GraphicsFixture {
\r
2992 public override void SetUp() {
\r
2993 base.SetUp ("GraphicsFixturePropPixelOffsetMode1");
\r
2994 t.Graphics.PixelOffsetMode = PixelOffsetMode.HighSpeed;
\r
2998 [Category("NotWorking")]
\r
2999 public override void DrawIconTest() {
\r
3000 base.DrawIconTest ();
\r
3004 [Category("NotWorking")]
\r
3005 public override void DrawIconUnstretchedTest() {
\r
3006 base.DrawIconUnstretchedTest ();
\r
3010 [Category("NotWorking")]
\r
3011 public override void DrawImageUnscaledTest() {
\r
3012 base.DrawImageUnscaledTest ();
\r
3016 [Category("NotWorking")]
\r
3017 public override void DrawStringFloatFormat() {
\r
3018 base.DrawStringFloatFormat ();
\r
3022 [Category("NotWorking")]
\r
3023 public override void MeasureCharacterRangesRegions() {
\r
3024 base.MeasureCharacterRangesRegions ();
\r
3028 [Category("NotWorking")]
\r
3029 public override void MeasureStringSizeFFormatInts() {
\r
3030 base.MeasureStringSizeFFormatInts ();
\r
3035 public class GraphicsFixturePropPixelOffsetMode2 : GraphicsFixture {
\r
3036 public override void SetUp() {
\r
3037 base.SetUp ("GraphicsFixturePropPixelOffsetMode2");
\r
3038 t.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
\r
3040 st["TransformPointsPointF:2"] = TOLERANCE * 3.0f;
\r
3044 [Category("NotWorking")]
\r
3045 public override void DrawIconTest() {
\r
3046 base.DrawIconTest ();
\r
3050 [Category("NotWorking")]
\r
3051 public override void DrawIconUnstretchedTest() {
\r
3052 base.DrawIconUnstretchedTest ();
\r
3056 [Category("NotWorking")]
\r
3057 public override void DrawImageUnscaledTest() {
\r
3058 base.DrawImageUnscaledTest ();
\r
3062 [Category("NotWorking")]
\r
3063 public override void DrawStringFloatFormat() {
\r
3064 base.DrawStringFloatFormat ();
\r
3068 [Category("NotWorking")]
\r
3069 public override void MeasureCharacterRangesRegions() {
\r
3070 base.MeasureCharacterRangesRegions ();
\r
3074 [Category("NotWorking")]
\r
3075 public override void MeasureStringSizeFFormatInts() {
\r
3076 base.MeasureStringSizeFFormatInts ();
\r
3082 #region GraphicsFixturePropRenderingOrigin
\r
3085 [Category("NotWorking")]
\r
3086 public class GraphicsFixturePropRenderingOrigin : GraphicsFixture {
\r
3087 public override void SetUp() {
\r
3088 base.SetUp ("GraphicsFixturePropRenderingOrigin");
\r
3089 t.Graphics.RenderingOrigin = new Point(12, 23);
\r
3093 [Category("NotWorking")]
\r
3094 public override void BeginContainerTest() {
\r
3095 base.BeginContainerTest ();
\r
3099 [Category("NotWorking")]
\r
3100 public override void BeginContainerTest_2() {
\r
3101 base.BeginContainerTest_2 ();
\r
3105 [Category("NotWorking")]
\r
3106 public override void ClearTest() {
\r
3107 base.ClearTest ();
\r
3111 [Category("NotWorking")]
\r
3112 public override void DrawArcTest() {
\r
3113 base.DrawArcTest ();
\r
3117 [Category("NotWorking")]
\r
3118 public override void DrawBezierTest() {
\r
3119 base.DrawBezierTest ();
\r
3123 [Category("NotWorking")]
\r
3124 public override void DrawBeziersTest() {
\r
3125 base.DrawBeziersTest ();
\r
3129 [Category("NotWorking")]
\r
3130 public override void DrawClosedCurveTest() {
\r
3131 base.DrawClosedCurveTest ();
\r
3135 [Category("NotWorking")]
\r
3136 public override void DrawCurveTest() {
\r
3137 base.DrawCurveTest ();
\r
3141 [Category("NotWorking")]
\r
3142 public override void DrawCurveTestF() {
\r
3143 base.DrawCurveTestF ();
\r
3147 [Category("NotWorking")]
\r
3148 public override void DrawEllipseTest() {
\r
3149 base.DrawEllipseTest ();
\r
3153 [Category("NotWorking")]
\r
3154 public override void DrawEllipseTestF() {
\r
3155 base.DrawEllipseTestF ();
\r
3159 [Category("NotWorking")]
\r
3160 public override void DrawIconTest() {
\r
3161 base.DrawIconTest ();
\r
3165 [Category("NotWorking")]
\r
3166 public override void DrawIconUnstretchedTest() {
\r
3167 base.DrawIconUnstretchedTest ();
\r
3171 [Category("NotWorking")]
\r
3172 public override void DrawImageUnscaledTest() {
\r
3173 base.DrawImageUnscaledTest ();
\r
3177 [Category("NotWorking")]
\r
3178 public override void DrawLineTest() {
\r
3179 base.DrawLineTest ();
\r
3183 [Category("NotWorking")]
\r
3184 public override void DrawLineTestF() {
\r
3185 base.DrawLineTestF ();
\r
3189 [Category("NotWorking")]
\r
3190 public override void DrawLinesTest() {
\r
3191 base.DrawLinesTest ();
\r
3195 [Category("NotWorking")]
\r
3196 public override void DrawLinesTestF() {
\r
3197 base.DrawLinesTestF ();
\r
3201 [Category("NotWorking")]
\r
3202 public override void DrawPathTest() {
\r
3203 base.DrawPathTest ();
\r
3207 [Category("NotWorking")]
\r
3208 public override void DrawPieTestF() {
\r
3209 base.DrawPieTestF ();
\r
3213 [Category("NotWorking")]
\r
3214 public override void DrawPieTest() {
\r
3215 base.DrawPieTest ();
\r
3219 [Category("NotWorking")]
\r
3220 public override void DrawPolygonPoint() {
\r
3221 base.DrawPolygonPoint ();
\r
3225 [Category("NotWorking")]
\r
3226 public override void DrawPolygonPointF() {
\r
3227 base.DrawPolygonPointF ();
\r
3231 [Category("NotWorking")]
\r
3232 public override void DrawRectangleFloat() {
\r
3233 base.DrawRectangleFloat ();
\r
3237 [Category("NotWorking")]
\r
3238 public override void DrawRectanglesRectangleF() {
\r
3239 base.DrawRectanglesRectangleF ();
\r
3243 [Category("NotWorking")]
\r
3244 public override void DrawRectanglesRectangle() {
\r
3245 base.DrawRectanglesRectangle ();
\r
3249 [Category("NotWorking")]
\r
3250 public override void DrawStringFloatFormat() {
\r
3251 base.DrawStringFloatFormat ();
\r
3255 [Category("NotWorking")]
\r
3256 public override void EndContainerState() {
\r
3257 base.EndContainerState ();
\r
3261 [Category("NotWorking")]
\r
3262 public override void EnumerateMetafile() {
\r
3263 base.EnumerateMetafile ();
\r
3267 [Category("NotWorking")]
\r
3268 public override void ExcludeClipRegion() {
\r
3269 base.ExcludeClipRegion ();
\r
3273 [Category("NotWorking")]
\r
3274 public override void FillClosedCurvePointFillModeTension() {
\r
3275 base.FillClosedCurvePointFillModeTension ();
\r
3279 [Category("NotWorking")]
\r
3280 public override void FillClosedCurvePointFFillModeTension() {
\r
3281 base.FillClosedCurvePointFFillModeTension ();
\r
3285 [Category("NotWorking")]
\r
3286 public override void FillEllipse() {
\r
3287 base.FillEllipse ();
\r
3291 [Category("NotWorking")]
\r
3292 public override void FillEllipseFloat() {
\r
3293 base.FillEllipseFloat ();
\r
3297 [Category("NotWorking")]
\r
3298 public override void FillPathEllipse() {
\r
3299 base.FillPathEllipse ();
\r
3303 [Category("NotWorking")]
\r
3304 public override void FillPieFloat() {
\r
3305 base.FillPieFloat ();
\r
3309 [Category("NotWorking")]
\r
3310 public override void FillPolygonPointFillMode() {
\r
3311 base.FillPolygonPointFillMode ();
\r
3315 [Category("NotWorking")]
\r
3316 public override void FillPolygonPointFFillMode() {
\r
3317 base.FillPolygonPointFFillMode ();
\r
3321 [Category("NotWorking")]
\r
3322 public override void FillRectangle() {
\r
3323 base.FillRectangle ();
\r
3327 [Category("NotWorking")]
\r
3328 public override void FillRectangleFloat() {
\r
3329 base.FillRectangleFloat ();
\r
3333 [Category("NotWorking")]
\r
3334 public override void FillRectanglesRectangle() {
\r
3335 base.FillRectanglesRectangle ();
\r
3339 [Category("NotWorking")]
\r
3340 public override void FillRectanglesRectangleF() {
\r
3341 base.FillRectanglesRectangleF ();
\r
3345 [Category("NotWorking")]
\r
3346 public override void FillRegionRectangle() {
\r
3347 base.FillRegionRectangle ();
\r
3351 [Category("NotWorking")]
\r
3352 public override void FlushTest() {
\r
3353 base.FlushTest ();
\r
3357 [Category("NotWorking")]
\r
3358 public override void IsVisible4Float() {
\r
3359 base.IsVisible4Float ();
\r
3363 [Category("NotWorking")]
\r
3364 public override void MeasureCharacterRangesRegions() {
\r
3365 base.MeasureCharacterRangesRegions ();
\r
3369 [Category("NotWorking")]
\r
3370 public override void MeasureStringSizeFFormatInts() {
\r
3371 base.MeasureStringSizeFFormatInts ();
\r
3375 [Category("NotWorking")]
\r
3376 public override void MultiplyTransform() {
\r
3377 base.MultiplyTransform ();
\r
3381 [Category("NotWorking")]
\r
3382 public override void MultiplyTransformMatrixOrder() {
\r
3383 base.MultiplyTransformMatrixOrder ();
\r
3387 [Category("NotWorking")]
\r
3388 public override void MultiplyTransformMatrixOrder1() {
\r
3389 base.MultiplyTransformMatrixOrder1 ();
\r
3393 [Category("NotWorking")]
\r
3394 public override void ResetClipIntersectClipRectangleF() {
\r
3395 base.ResetClipIntersectClipRectangleF ();
\r
3399 [Category("NotWorking")]
\r
3400 public override void SaveRestoreTranslate() {
\r
3401 base.SaveRestoreTranslate ();
\r
3405 [Category("NotWorking")]
\r
3406 public override void RotateTransformAngleMatrixOrder() {
\r
3407 base.RotateTransformAngleMatrixOrder ();
\r
3411 [Category("NotWorking")]
\r
3412 public override void RotateTransformAngleMatrixOrder1() {
\r
3413 base.RotateTransformAngleMatrixOrder1 ();
\r
3417 [Category("NotWorking")]
\r
3418 public override void ScaleTransformFloatMatrixOrder() {
\r
3419 base.ScaleTransformFloatMatrixOrder ();
\r
3423 [Category("NotWorking")]
\r
3424 public override void ScaleTransformFloatMatrixOrder1() {
\r
3425 base.ScaleTransformFloatMatrixOrder1 ();
\r
3429 [Category("NotWorking")]
\r
3430 public override void SetClipRegionCombine() {
\r
3431 base.SetClipRegionCombine ();
\r
3435 [Category("NotWorking")]
\r
3436 public override void TransformPointsPointF() {
\r
3437 base.TransformPointsPointF ();
\r
3441 [Category("NotWorking")]
\r
3442 public override void TranslateClipFloat() {
\r
3443 base.TranslateClipFloat ();
\r
3447 [Category("NotWorking")]
\r
3448 public override void TranslateTransformAngleMatrixOrder() {
\r
3449 base.TranslateTransformAngleMatrixOrder ();
\r
3453 [Category("NotWorking")]
\r
3454 public override void TranslateTransformAngleMatrixOrder1() {
\r
3455 base.TranslateTransformAngleMatrixOrder1 ();
\r
3459 [Category("NotWorking")]
\r
3460 public override void TransfromPageScaleUnits() {
\r
3461 base.TransfromPageScaleUnits ();
\r
3465 [Category("NotWorking")]
\r
3466 public override void TransfromPageScaleUnits_2() {
\r
3467 base.TransfromPageScaleUnits_2 ();
\r
3471 [Category("NotWorking")]
\r
3472 public override void TransfromPageScaleUnits_3() {
\r
3473 base.TransfromPageScaleUnits_3 ();
\r
3480 /// TBD: add more variants
\r
3482 #region GraphicsFixturePropSmoothingMode
\r
3485 public class GraphicsFixturePropSmoothingMode : GraphicsFixture {
\r
3486 public override void SetUp() {
\r
3487 base.SetUp ("GraphicsFixturePropSmoothingMode");
\r
3488 t.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
\r
3490 st["DrawArcTest:4"] = TOLERANCE * 3.0f;
\r
3491 st["DrawLineTest:2"] = TOLERANCE * 3.0f;
\r
3492 st["DrawLineTest:4"] = TOLERANCE * 3.0f; // difference in line width even in horizontal lines
\r
3493 st["DrawLineTestF:2"] = TOLERANCE * 3.0f;
\r
3494 st["DrawLineTestF:4"] = TOLERANCE * 3.0f;
\r
3495 st["DrawPieTest:2"] = TOLERANCE * 1.5f;
\r
3496 st["DrawPieTestF:2"] = TOLERANCE * 1.5f;
\r
3497 st["DrawPieTest:4"] = TOLERANCE * 1.5f;
\r
3498 st["DrawPieTestF:4"] = TOLERANCE * 1.5f;
\r
3499 st["DrawRectangleFloat:2"] = TOLERANCE * 3.0f; // big difference in line width
\r
3500 st["DrawRectangleFloat:4"] = TOLERANCE * 3.0f; // big difference in line width
\r
3501 st["DrawRectangleFloat:6"] = TOLERANCE * 3.0f;
\r
3502 st["DrawRectanglesRectangle:2"] = TOLERANCE * 3.0f;
\r
3503 st["DrawRectanglesRectangleF:2"] = TOLERANCE * 3.0f;
\r
3507 [Category("NotWorking")]
\r
3508 public override void DrawIconTest() {
\r
3509 base.DrawIconTest ();
\r
3513 [Category("NotWorking")]
\r
3514 public override void DrawIconUnstretchedTest() {
\r
3515 base.DrawIconUnstretchedTest ();
\r
3519 [Category("NotWorking")]
\r
3520 public override void DrawImageUnscaledTest() {
\r
3521 base.DrawImageUnscaledTest ();
\r
3525 [Category("NotWorking")]
\r
3526 public override void DrawStringFloatFormat() {
\r
3527 base.DrawStringFloatFormat ();
\r
3531 [Category("NotWorking")]
\r
3532 public override void MeasureCharacterRangesRegions() {
\r
3533 base.MeasureCharacterRangesRegions ();
\r
3537 [Category("NotWorking")]
\r
3538 public override void MeasureStringSizeFFormatInts() {
\r
3539 base.MeasureStringSizeFFormatInts ();
\r
3544 public class GraphicsFixturePropSmoothingMode1 : GraphicsFixture {
\r
3545 public override void SetUp() {
\r
3546 base.SetUp ("GraphicsFixturePropSmoothingMode1");
\r
3547 t.Graphics.SmoothingMode = SmoothingMode.HighSpeed;
\r
3551 [Category("NotWorking")]
\r
3552 public override void DrawIconTest() {
\r
3553 base.DrawIconTest ();
\r
3557 [Category("NotWorking")]
\r
3558 public override void DrawIconUnstretchedTest() {
\r
3559 base.DrawIconUnstretchedTest ();
\r
3563 [Category("NotWorking")]
\r
3564 public override void DrawImageUnscaledTest() {
\r
3565 base.DrawImageUnscaledTest ();
\r
3569 [Category("NotWorking")]
\r
3570 public override void DrawStringFloatFormat() {
\r
3571 base.DrawStringFloatFormat ();
\r
3575 [Category("NotWorking")]
\r
3576 public override void MeasureCharacterRangesRegions() {
\r
3577 base.MeasureCharacterRangesRegions ();
\r
3581 [Category("NotWorking")]
\r
3582 public override void MeasureStringSizeFFormatInts() {
\r
3583 base.MeasureStringSizeFFormatInts ();
\r
3589 #region GraphicsFixturePropTextContrast
\r
3592 public class GraphicsFixturePropTextContrast : GraphicsFixture {
\r
3593 public override void SetUp() {
\r
3594 base.SetUp ("GraphicsFixturePropTextContrast");
\r
3595 t.Graphics.TextContrast = 9;
\r
3599 [Category("NotWorking")]
\r
3600 public override void DrawIconTest() {
\r
3601 base.DrawIconTest ();
\r
3605 [Category("NotWorking")]
\r
3606 public override void DrawIconUnstretchedTest() {
\r
3607 base.DrawIconUnstretchedTest ();
\r
3611 [Category("NotWorking")]
\r
3612 public override void DrawImageUnscaledTest() {
\r
3613 base.DrawImageUnscaledTest ();
\r
3617 [Category("NotWorking")]
\r
3618 public override void DrawStringFloatFormat() {
\r
3619 base.DrawStringFloatFormat ();
\r
3623 [Category("NotWorking")]
\r
3624 public override void MeasureCharacterRangesRegions() {
\r
3625 base.MeasureCharacterRangesRegions ();
\r
3629 [Category("NotWorking")]
\r
3630 public override void MeasureStringSizeFFormatInts() {
\r
3631 base.MeasureStringSizeFFormatInts ();
\r
3637 #region GraphicsFixtureGraphicsState
\r
3640 public class GraphicsFixtureGraphicsState {
\r
3641 protected DrawingTest t;
\r
3642 protected int TOLERANCE = 3; //in %;
\r
3645 public virtual void SetUp() {
\r
3646 t = DrawingTest.Create(512, 512, "GraphicsFixtureGraphicsState");
\r
3650 public void TearDown ()
\r
3657 public void BeginEndContainer() {
\r
3658 t.Graphics.FillRectangle( Brushes.Blue, 0, 0, 100, 100 );
\r
3660 GraphicsContainer c1 = t.Graphics.BeginContainer(
\r
3661 new Rectangle(100, 100, 100, 100),
\r
3662 new Rectangle(0, 0, 100, 100),
\r
3663 GraphicsUnit.Pixel);
\r
3665 t.Graphics.FillRectangle( Brushes.Green, 0, 0, 100, 100 );
\r
3667 GraphicsContainer c2 = t.Graphics.BeginContainer(
\r
3668 new Rectangle(100, 100, 100, 100),
\r
3669 new Rectangle(0, 0, 100, 100),
\r
3670 GraphicsUnit.Pixel);
\r
3672 t.Graphics.FillRectangle( Brushes.Red, 0, 0, 100, 100 );
\r
3674 GraphicsState s1 = t.Graphics.Save();
\r
3675 t.Graphics.PageUnit = GraphicsUnit.Pixel;
\r
3677 t.Graphics.PageScale = 0.7f;
\r
3678 t.Graphics.FillRectangle( Brushes.SeaGreen, 0, 0, 100, 100 );
\r
3680 t.Graphics.EndContainer(c2);
\r
3681 t.Graphics.PageScale = 0.7f;
\r
3682 t.Graphics.FillRectangle( Brushes.SeaGreen, 0, 0, 100, 100 );
\r
3684 t.Graphics.EndContainer(c1);
\r
3685 t.Graphics.PageScale = 0.7f;
\r
3686 t.Graphics.FillRectangle( Brushes.SeaGreen, 0, 0, 100, 100 );
\r
3689 Assert.That(t.PDCompare(), Is.True);
\r
3693 public void SaveRestoreGraphicsProps() {
\r
3694 t.Graphics.CompositingQuality = CompositingQuality.GammaCorrected;
\r
3695 t.Graphics.CompositingMode = CompositingMode.SourceCopy;
\r
3696 t.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
\r
3697 t.Graphics.PageScale = 7;
\r
3698 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
3699 t.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
\r
3700 t.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
\r
3701 t.Graphics.Transform = new Matrix(1, 2, 3, 4, 5, 6);
\r
3702 t.Graphics.TextContrast = 10;
\r
3703 t.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
\r
3705 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
3707 Assert.That (CompositingQuality.Default, Is.EqualTo (t.Graphics.CompositingQuality));
\r
3708 Assert.That (CompositingMode.SourceOver, Is.EqualTo (t.Graphics.CompositingMode));
\r
3709 Assert.That (InterpolationMode.Bilinear, Is.EqualTo (t.Graphics.InterpolationMode));
\r
3710 Assert.That (1.0F, Is.EqualTo (t.Graphics.PageScale));
\r
3711 Assert.That (GraphicsUnit.Display, Is.EqualTo (t.Graphics.PageUnit));
\r
3712 Assert.That (PixelOffsetMode.Default, Is.EqualTo (t.Graphics.PixelOffsetMode));
\r
3713 Assert.That (SmoothingMode.None, Is.EqualTo (t.Graphics.SmoothingMode));
\r
3714 Assert.That (true, Is.EqualTo (t.Graphics.Transform.IsIdentity));
\r
3715 Assert.That (4.0f, Is.EqualTo (t.Graphics.TextContrast));
\r
3716 Assert.That (TextRenderingHint.SystemDefault, Is.EqualTo (t.Graphics.TextRenderingHint));
\r
3718 t.Graphics.EndContainer(c1);
\r
3721 public void SaveRestoreGraphicsProps_2() {
\r
3722 GraphicsState s = t.Graphics.Save();
\r
3724 t.Graphics.CompositingQuality = CompositingQuality.GammaCorrected;
\r
3725 t.Graphics.CompositingMode = CompositingMode.SourceCopy;
\r
3726 t.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
\r
3727 t.Graphics.PageScale = 7;
\r
3728 t.Graphics.PageUnit = GraphicsUnit.Inch;
\r
3729 t.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
\r
3730 t.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
\r
3731 t.Graphics.Transform = new Matrix(1, 2, 3, 4, 5, 6);
\r
3732 t.Graphics.TextContrast = 10;
\r
3733 t.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
\r
3735 t.Graphics.Restore(s);
\r
3737 Assert.That (CompositingQuality.Default, Is.EqualTo (t.Graphics.CompositingQuality));
\r
3738 Assert.That (CompositingMode.SourceOver, Is.EqualTo (t.Graphics.CompositingMode));
\r
3739 Assert.That (InterpolationMode.Bilinear, Is.EqualTo (t.Graphics.InterpolationMode));
\r
3740 Assert.That (1.0F, Is.EqualTo (t.Graphics.PageScale));
\r
3741 Assert.That (GraphicsUnit.Display, Is.EqualTo (t.Graphics.PageUnit));
\r
3742 Assert.That (PixelOffsetMode.Default, Is.EqualTo (t.Graphics.PixelOffsetMode));
\r
3743 Assert.That (SmoothingMode.None, Is.EqualTo (t.Graphics.SmoothingMode));
\r
3744 Assert.That (true, Is.EqualTo (t.Graphics.Transform.IsIdentity));
\r
3745 Assert.That (4.0f, Is.EqualTo (t.Graphics.TextContrast));
\r
3746 Assert.That (TextRenderingHint.SystemDefault, Is.EqualTo (t.Graphics.TextRenderingHint));
\r
3750 public void SaveRestoreGraphicsProps_3() {
\r
3751 t.Graphics.PageScale = 2;
\r
3752 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
3754 t.Graphics.PageScale = 3;
\r
3755 GraphicsContainer c2 = t.Graphics.BeginContainer();
\r
3757 t.Graphics.PageScale = 4;
\r
3758 GraphicsContainer c3 = t.Graphics.BeginContainer();
\r
3760 t.Graphics.EndContainer(c2);
\r
3761 Assert.That (3, Is.EqualTo (t.Graphics.PageScale));
\r
3763 t.Graphics.PageScale = 5;
\r
3764 GraphicsState c5 = t.Graphics.Save();
\r
3766 t.Graphics.EndContainer(c3);
\r
3767 Assert.That (5, Is.EqualTo (t.Graphics.PageScale));
\r
3769 t.Graphics.Restore(c5);
\r
3770 Assert.That (5, Is.EqualTo (t.Graphics.PageScale));
\r
3772 t.Graphics.EndContainer(c1);
\r
3773 Assert.That (2, Is.EqualTo (t.Graphics.PageScale));
\r
3776 public void SaveRestoreGraphicsProps_4() {
\r
3777 t.Graphics.PageScale = 2;
\r
3778 GraphicsContainer c1 = t.Graphics.BeginContainer();
\r
3780 t.Graphics.PageScale = 3;
\r
3781 GraphicsState c2 = t.Graphics.Save();
\r
3783 t.Graphics.EndContainer(c1);
\r
3784 Assert.That (2, Is.EqualTo (t.Graphics.PageScale));
\r
3786 t.Graphics.Restore(c2);
\r
3787 Assert.That (2, Is.EqualTo (t.Graphics.PageScale));
\r
3792 #region GraphicsFixturePropTextRenderingHint
\r
3795 public class GraphicsFixturePropTextRenderingHint : GraphicsFixture {
\r
3796 public override void SetUp() {
\r
3797 base.SetUp ("GraphicsFixturePropTextRenderingHint");
\r
3798 t.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
\r
3802 [Category("NotWorking")]
\r
3803 public override void DrawIconTest() {
\r
3804 base.DrawIconTest ();
\r
3808 [Category("NotWorking")]
\r
3809 public override void DrawIconUnstretchedTest() {
\r
3810 base.DrawIconUnstretchedTest ();
\r
3814 [Category("NotWorking")]
\r
3815 public override void DrawImageUnscaledTest() {
\r
3816 base.DrawImageUnscaledTest ();
\r
3820 [Category("NotWorking")]
\r
3821 public override void DrawStringFloatFormat() {
\r
3822 base.DrawStringFloatFormat ();
\r
3826 [Category("NotWorking")]
\r
3827 public override void MeasureCharacterRangesRegions() {
\r
3828 base.MeasureCharacterRangesRegions ();
\r
3832 [Category("NotWorking")]
\r
3833 public override void MeasureStringSizeFFormatInts() {
\r
3834 base.MeasureStringSizeFFormatInts ();
\r
3839 public class GraphicsFixturePropTextRenderingHint1 : GraphicsFixture {
\r
3840 public override void SetUp() {
\r
3841 base.SetUp ("GraphicsFixturePropTextRenderingHint1");
\r
3842 t.Graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
\r
3846 [Category("NotWorking")]
\r
3847 public override void DrawIconTest() {
\r
3848 base.DrawIconTest ();
\r
3852 [Category("NotWorking")]
\r
3853 public override void DrawIconUnstretchedTest() {
\r
3854 base.DrawIconUnstretchedTest ();
\r
3858 [Category("NotWorking")]
\r
3859 public override void DrawImageUnscaledTest() {
\r
3860 base.DrawImageUnscaledTest ();
\r
3864 [Category("NotWorking")]
\r
3865 public override void DrawStringFloatFormat() {
\r
3866 base.DrawStringFloatFormat ();
\r
3870 [Category("NotWorking")]
\r
3871 public override void MeasureCharacterRangesRegions() {
\r
3872 base.MeasureCharacterRangesRegions ();
\r
3876 [Category("NotWorking")]
\r
3877 public override void MeasureStringSizeFFormatInts() {
\r
3878 base.MeasureStringSizeFFormatInts ();
\r
3883 public class GraphicsFixturePropTextRenderingHint2 : GraphicsFixture {
\r
3884 public override void SetUp() {
\r
3885 base.SetUp ("GraphicsFixturePropTextRenderingHint2");
\r
3886 t.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
\r
3890 [Category("NotWorking")]
\r
3891 public override void DrawIconTest() {
\r
3892 base.DrawIconTest ();
\r
3896 [Category("NotWorking")]
\r
3897 public override void DrawIconUnstretchedTest() {
\r
3898 base.DrawIconUnstretchedTest ();
\r
3902 [Category("NotWorking")]
\r
3903 public override void DrawImageUnscaledTest() {
\r
3904 base.DrawImageUnscaledTest ();
\r
3908 [Category("NotWorking")]
\r
3909 public override void DrawStringFloatFormat() {
\r
3910 base.DrawStringFloatFormat ();
\r
3914 [Category("NotWorking")]
\r
3915 public override void MeasureCharacterRangesRegions() {
\r
3916 base.MeasureCharacterRangesRegions ();
\r
3920 [Category("NotWorking")]
\r
3921 public override void MeasureStringSizeFFormatInts() {
\r
3922 base.MeasureStringSizeFFormatInts ();
\r
3927 public class GraphicsFixturePropTextRenderingHint3 : GraphicsFixture {
\r
3928 public override void SetUp() {
\r
3929 base.SetUp ("GraphicsFixturePropTextRenderingHint3");
\r
3930 t.Graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
\r
3934 [Category("NotWorking")]
\r
3935 public override void DrawIconTest() {
\r
3936 base.DrawIconTest ();
\r
3940 [Category("NotWorking")]
\r
3941 public override void DrawIconUnstretchedTest() {
\r
3942 base.DrawIconUnstretchedTest ();
\r
3946 [Category("NotWorking")]
\r
3947 public override void DrawImageUnscaledTest() {
\r
3948 base.DrawImageUnscaledTest ();
\r
3952 [Category("NotWorking")]
\r
3953 public override void DrawStringFloatFormat() {
\r
3954 base.DrawStringFloatFormat ();
\r
3958 [Category("NotWorking")]
\r
3959 public override void MeasureCharacterRangesRegions() {
\r
3960 base.MeasureCharacterRangesRegions ();
\r
3964 [Category("NotWorking")]
\r
3965 public override void MeasureStringSizeFFormatInts() {
\r
3966 base.MeasureStringSizeFFormatInts ();
\r
3971 public class GraphicsFixturePropTextRenderingHint4 : GraphicsFixture {
\r
3972 public override void SetUp() {
\r
3973 base.SetUp ("GraphicsFixturePropTextRenderingHint4");
\r
3974 t.Graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
\r
3978 [Category("NotWorking")]
\r
3979 public override void DrawIconTest() {
\r
3980 base.DrawIconTest ();
\r
3984 [Category("NotWorking")]
\r
3985 public override void DrawIconUnstretchedTest() {
\r
3986 base.DrawIconUnstretchedTest ();
\r
3990 [Category("NotWorking")]
\r
3991 public override void DrawImageUnscaledTest() {
\r
3992 base.DrawImageUnscaledTest ();
\r
3996 [Category("NotWorking")]
\r
3997 public override void DrawStringFloatFormat() {
\r
3998 base.DrawStringFloatFormat ();
\r
4002 [Category("NotWorking")]
\r
4003 public override void MeasureCharacterRangesRegions() {
\r
4004 base.MeasureCharacterRangesRegions ();
\r
4008 [Category("NotWorking")]
\r
4009 public override void MeasureStringSizeFFormatInts() {
\r
4010 base.MeasureStringSizeFFormatInts ();
\r
4015 public class GraphicsFixturePropTextRenderingHint5 : GraphicsFixture {
\r
4016 public override void SetUp() {
\r
4017 base.SetUp ("GraphicsFixturePropTextRenderingHint5");
\r
4018 t.Graphics.TextRenderingHint = TextRenderingHint.SystemDefault;
\r
4022 [Category("NotWorking")]
\r
4023 public override void DrawIconTest() {
\r
4024 base.DrawIconTest ();
\r
4028 [Category("NotWorking")]
\r
4029 public override void DrawIconUnstretchedTest() {
\r
4030 base.DrawIconUnstretchedTest ();
\r
4034 [Category("NotWorking")]
\r
4035 public override void DrawImageUnscaledTest() {
\r
4036 base.DrawImageUnscaledTest ();
\r
4040 [Category("NotWorking")]
\r
4041 public override void DrawStringFloatFormat() {
\r
4042 base.DrawStringFloatFormat ();
\r
4046 [Category("NotWorking")]
\r
4047 public override void MeasureCharacterRangesRegions() {
\r
4048 base.MeasureCharacterRangesRegions ();
\r
4052 [Category("NotWorking")]
\r
4053 public override void MeasureStringSizeFFormatInts() {
\r
4054 base.MeasureStringSizeFFormatInts ();
\r
4060 #region GraphicsFixturePropTransform
\r
4063 public class GraphicsFixturePropTransform : GraphicsFixture {
\r
4064 public override void SetUp() {
\r
4065 base.SetUp ("GraphicsFixturePropTransform");
\r
4066 t.Graphics.Transform = new Matrix(0, 1, 2, 0, 0, 0);
\r
4068 st["DrawArcTest:2"] = TOLERANCE * 11.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4069 st["DrawArcTest:4"] = TOLERANCE * 12.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4070 st["DrawArcTest:6"] = TOLERANCE * 12.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4071 st["DrawArcTest:8"] = TOLERANCE * 10.0f; // FIXME: Transfrom is ok, but very big difference in width
\r
4072 st["DrawClosedCurveTest:4"] = TOLERANCE * 2.0f;
\r
4073 st["RotateTransformAngleMatrixOrder:2"] = TOLERANCE * 1.5f;
\r
4074 st["TransformPointsPointF:2"] = TOLERANCE * 3.5f;
\r
4078 [Category("NotWorking")]
\r
4079 public override void DrawIconTest() {
\r
4080 base.DrawIconTest ();
\r
4084 [Category("NotWorking")]
\r
4085 public override void DrawIconUnstretchedTest() {
\r
4086 base.DrawIconUnstretchedTest ();
\r
4090 [Category("NotWorking")]
\r
4091 public override void DrawImageUnscaledTest() {
\r
4092 base.DrawImageUnscaledTest ();
\r
4096 [Category("NotWorking")]
\r
4097 public override void DrawStringFloatFormat() {
\r
4098 base.DrawStringFloatFormat ();
\r
4102 [Category("NotWorking")]
\r
4103 public override void MeasureCharacterRangesRegions() {
\r
4104 base.MeasureCharacterRangesRegions ();
\r
4108 [Category("NotWorking")]
\r
4109 public override void MeasureStringSizeFFormatInts() {
\r
4110 base.MeasureStringSizeFFormatInts ();
\r