| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823 |
- using System;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using NUnit.Framework;
- using DrawingTestHelper;
- namespace Test.Sys.Drawing
- {
- /// <summary>
- /// Summary description for Pen.
- /// </summary>
- [TestFixture]
- public class PenFixture {
- //TODO: Brush, CompoundArray, CustomEndCap, CustomStartCap,
- //StartCap, EndCap, PenType, Transform
- DrawingTest t;
- Pen p;
- protected int TOLERANCE = 3;
- [SetUp]
- public void SetUp () {
- t = DrawingTest.Create (256, 256);
- p = new Pen (Color.Blue);
- p.Width = 10;
- DrawingTest.ShowForms = false;
- }
- [TearDown]
- public void TearDown ()
- {
- if (t != null)
- t.Dispose ();
- }
- #region InitAlignment
- [Test]
- public void InitAlignment () {
- Pen p = new Pen (Color.Blue);
- Assert.AreEqual (PenAlignment.Center, p.Alignment);
- }
- #endregion
-
- #region PenWidth
- [Test]
- public void PenWidth_1()
- {
- Assert.AreEqual(10, p.Width);
- t.Graphics.DrawLine (p, 20, 200, 200, 20);
- t.Show();
- Assert.IsTrue (t.Compare (TOLERANCE * 1.5f)); //FIXME: Pen width in GH is not the same as in .NET
- }
- [Test]
- public void PenWidth_2()
- {
- p.Width = 25;
- t.Graphics.DrawLine (p, 20, 200, 200, 20);
- t.Show();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void PenWidth_3 ()
- {
- t.Graphics.DrawLine (p, 10, 100, 200, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region DashStyle Tests
- [Test]
- public void DashStyleTest_1 ()
- {
- Assert.AreEqual (DashStyle.Solid, p.DashStyle);
- p.Width = 14;
- t.Graphics.DrawLine (p, 20, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void DashStyleTest_2 () {
- p.DashStyle = DashStyle.Dash;
- p.Width = 14;
- t.Graphics.DrawLine (p, 20, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void DashStyleTest_3 () {
- p.DashStyle = DashStyle.DashDot;
- p.Width = 14;
- t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);
- t.Graphics.DrawLine (p, 20, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void DashStyleTest_4 () {
- p.DashStyle = DashStyle.DashDotDot;
- p.Width = 14;
- t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);
- t.Graphics.DrawLine (p, 20, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void DashStyleTest_5 () {
- p.DashStyle = DashStyle.Dot;
- p.Width = 14;
- t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);
- t.Graphics.DrawLine (p, 20, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void DashStyleTest_6 () {
- p.DashStyle = DashStyle.Custom;
- p.Width = 14;
- t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);
- t.Graphics.DrawLine (p, 20, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region DashCustomStyle
- //The following tests DashOffset and DashPattern
- [Test]
- [Category ("NotWorking")]
- public void DashCustomStyle_1 () {
- p.DashStyle = DashStyle.Custom;
- p.Width = 10;
- Assert.AreEqual (new float [] {1F}, p.DashPattern);
- Assert.AreEqual (0F, p.DashOffset);
- }
- [Test]
- public void DashCustomStyle_2 () {
- p.DashPattern = new float [] {2, 3, 1.15F, 0.05F};
- t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);
- t.Graphics.DrawLine (p, 20, 100, 200, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void DashCustomStyle_3 () {
- p.DashOffset = 10F;
- t.Graphics.DrawLine (p, 20, 100, 200, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void DashCustomStyle_4 () {
- p.DashPattern = new float [] {2, 3, 1.15F, 0.05F, 1.74321F};
- p.DashOffset = 10.2F;
- t.Graphics.DrawLine (p, 20, 100, 200, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void DashCustomStyle_5 () {
- p.DashPattern = new float [] {2, 3, 1.15F, 0.05F, 1.74321F};
- p.DashOffset = 10.2F;
- t.Graphics.DrawLine (p, 20, 100, 200, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region DashCapTest
- [Test]
- public void DashCapTest_Flat () {
- p.Width = 15;
- Assert.AreEqual (DashCap.Flat, p.DashCap);
- p.DashStyle = DashStyle.DashDot;
- t.Graphics.DrawLine (p, 10, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void DashCapTest_Round () {
- p.Width = 15;
- p.DashStyle = DashStyle.DashDot;
- p.DashCap = DashCap.Round;
- t.Graphics.DrawLine (p, 10, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void DashCapTest_Triangle () {
- p.Width = 15;
- p.DashStyle = DashStyle.DashDot;
- p.DashCap = DashCap.Triangle;
- t.Graphics.DrawLine (p, 10, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region LineJoin Round
- [Test]
- public void LineJoinTest_Round_1 () {
- Point [] points = new Point [] {
- new Point(100, 210), new Point (120, 50),
- new Point (140, 210)};
- p.Width = 25;
- p.LineJoin = LineJoin.Round;
- t.Graphics.DrawPolygon (p, points);
- t.Graphics.DrawPolygon (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void LineJoinTest_Round_2 () {
- Point [] points = new Point [] {
- new Point(50, 210), new Point (120, 50),
- new Point (190, 210)};
- p.Width = 25;
- p.LineJoin = LineJoin.Round;
- t.Graphics.DrawPolygon (p, points);
- t.Graphics.DrawPolygon (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region LineJoin Miter
- [Test]
- public void LineJoinTest_Miter_1 () {
- p.LineJoin = LineJoin.Miter;
- Point [] points = new Point [] {
- new Point(100, 217), new Point (130, 100),
- new Point (160, 217)};
- p.Width = 25;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void LineJoinTest_Miter_2 () {
- p.LineJoin = LineJoin.Miter;
- Point [] points = new Point [] {
- new Point(120, 237), new Point (130, 100),
- new Point (140, 237)};
- p.Width = 10;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void LineJoinTest_Miter_3 () {
- p.LineJoin = LineJoin.Miter;
- Point [] points = new Point [] {
- new Point(50, 217), new Point (100, 100),
- new Point (150, 217)};
- p.Width = 25;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region LineJoin MiterClipped
- [Test]
- public void LineJoinTest_MiterClipped_1 () {
- p.LineJoin = LineJoin.MiterClipped;
- Point [] points = new Point [] {
- new Point(100, 217), new Point (130, 100),
- new Point (160, 217)};
- p.Width = 25;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void LineJoinTest_MiterClipped_2 () {
- p.LineJoin = LineJoin.MiterClipped;
- Point [] points = new Point [] {
- new Point(120, 217), new Point (130, 80),
- new Point (140, 217)};
- p.Width = 25;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void LineJoinTest_MiterClipped_3 () {
- p.LineJoin = LineJoin.MiterClipped;
- Point [] points = new Point [] {
- new Point(50, 217), new Point (100, 100),
- new Point (150, 217)};
- p.Width = 25;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region "LineJoin Bevel"
- [Test]
- public void LineJoinTest_Bevel_1 () {
- p.LineJoin = LineJoin.Bevel;
- Point [] points = new Point [] {
- new Point(90, 217), new Point (115, 55),
- new Point (140, 217)};
- p.Width = 25;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void LineJoinTest_Bevel_2 () {
- p.LineJoin = LineJoin.Bevel;
- Point [] points = new Point [] {
- new Point(110, 217), new Point (120, 75),
- new Point (130, 217)};
- p.Width = 25;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void LineJoinTest_Bevel_3 () {
- p.LineJoin = LineJoin.Bevel;
- Point [] points = new Point [] {
- new Point(50, 217), new Point (100, 100),
- new Point (150, 217)};
- p.Width = 25;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void LineJoinTest_Bevel_4 () {
- p.LineJoin = LineJoin.Bevel;
- Point [] points = new Point [] {
- new Point(143, 210), new Point (170, 100),
- new Point (180, 20)};
- p.Width = 25;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void LineJoinTest_Bevel_5 () {
- p.LineJoin = LineJoin.Bevel;
- Point [] points = new Point [] {
- new Point(50, 100), new Point (150, 100),
- new Point (150, 20), new Point (200, 20)};
- p.Width = 25;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region PenAlignment
- [Test]
- public void PenAlignmentTest_1 () {
- Assert.AreEqual (PenAlignment.Center, p.Alignment);
- Point [] points = new Point [] {
- new Point (30, 30), new Point (100, 100), new Point (170, 30),
- new Point (170, 200), new Point (30, 200)};
- GraphicsPath path = new GraphicsPath ();
- path.AddPolygon (points);
- p.Width = 25;
- t.Graphics.DrawPath (p, path);
- t.Graphics.DrawPath (Pens.White, path);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void PenAlignmentTest_2 () {
- Point [] points = new Point [] {
- new Point (30, 30), new Point (100, 100), new Point (170, 30),
- new Point (170, 200), new Point (30, 200)};
- GraphicsPath path = new GraphicsPath ();
- path.AddPolygon (points);
- p.Width = 25;
- p.Alignment = PenAlignment.Left;
- t.Graphics.DrawPath (p, path);
- t.Graphics.DrawPath (Pens.White, path);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void PenAlignmentTest_3 () {
- Point [] points = new Point [] {
- new Point (30, 30), new Point (100, 100), new Point (170, 30),
- new Point (170, 200), new Point (30, 200)};
- GraphicsPath path = new GraphicsPath ();
- path.AddPolygon (points);
- p.Width = 25;
- p.Alignment = PenAlignment.Inset;
- t.Graphics.DrawPath (p, path);
- t.Graphics.DrawPath (Pens.White, path);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void PenAlignmentTest_4 () {
- Point [] points = new Point [] {
- new Point (30, 30), new Point (100, 100), new Point (170, 30),
- new Point (170, 200), new Point (30, 200)};
- GraphicsPath path = new GraphicsPath ();
- path.AddPolygon (points);
- p.Width = 25;
- p.Alignment = PenAlignment.Outset;
- t.Graphics.DrawPath (p, path);
- t.Graphics.DrawPath (Pens.White, path);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void PenAlignmentTest_5 () {
- Point [] points = new Point [] {
- new Point (30, 30), new Point (100, 100), new Point (170, 30),
- new Point (170, 200), new Point (30, 200)};
- GraphicsPath path = new GraphicsPath ();
- path.AddPolygon (points);
- p.Width = 25;
- p.Alignment = PenAlignment.Right;
- t.Graphics.DrawPath (p, path);
- t.Graphics.DrawPath (Pens.White, path);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
-
- #region Color test
- [Test]
- public void ColorTest_1 () {
- Assert.AreEqual (Color.Blue, p.Color);
- p.Width = 25;
- t.Graphics.DrawLine (p, 10, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void ColorTest_2 () {
- p.Color = Color.Red;
- p.Width = 25;
- t.Graphics.DrawLine (p, 10, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void ColorTest_3 () {
- p.Color = Color.BurlyWood;
- p.Width = 25;
- t.Graphics.DrawLine (p, 10, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void ColorTest_4 () {
- p.Color = Color.FromArgb (100, 120, 255);
- p.Width = 25;
- t.Graphics.DrawLine (p, 10, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void ColorTest_5 () {
- p.Color = Color.FromArgb (128, Color.White);
- p.Width = 25;
- t.Graphics.DrawLine (p, 10, 100, 230, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region MiterLimit
- [Test]
- public void MitterLimit_1 () {
- p.LineJoin = LineJoin.MiterClipped;
- Point [] points = new Point [] {new Point (0,30), new Point (180, 30),
- new Point (0, 90)};
- p.Width = 25;
- Assert.AreEqual (10F, p.MiterLimit);
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void MitterLimit_2 () {
- p.MiterLimit=1F;
- p.LineJoin = LineJoin.MiterClipped;
- Point [] points = new Point [] {new Point (0,30), new Point (180, 30),
- new Point (0, 120)};
- p.Width = 25;
- t.Graphics.DrawLines (p, points);
- t.Graphics.DrawLines (Pens.White, points);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region TRansform
- [Test]
- public void Transform () {
- p.ScaleTransform (0.5F, 2);
- t.Graphics.DrawArc (p, 70, 70, 100, 100, 0, 360);
- t.Graphics.DrawArc (Pens.White, 70, 70, 100, 100, 0, 360);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
-
- #region Line StartCap
- [Test]
- public void StartCap_Flat() {
- Assert.AreEqual(LineCap.Flat, p.StartCap);
- p.StartCap = LineCap.Flat;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void StartCap_Round() {
- p.StartCap = LineCap.Round;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void StartCap_Square() {
- p.StartCap = LineCap.Square;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void StartCap_AnchorMask() {
- p.StartCap = LineCap.AnchorMask;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void StartCap_ArrowAnchor() {
- p.StartCap = LineCap.ArrowAnchor;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void StartCap_DiamondAnchor() {
- p.StartCap = LineCap.DiamondAnchor;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void StartCap_NoAnchor() {
- p.StartCap = LineCap.NoAnchor;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void StartCap_RoundAnchor() {
- p.StartCap = LineCap.RoundAnchor;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void StartCap_SquareAnchor() {
- p.StartCap = LineCap.SquareAnchor;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void StartCap_Triangle() {
- p.StartCap = LineCap.Triangle;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void StartCap_Custom() {
- p.StartCap = LineCap.Custom;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region Line EndCap
- [Test]
- public void EndCap_Flat()
- {
- Assert.AreEqual(LineCap.Flat, p.EndCap);
- p.EndCap = LineCap.Flat;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void EndCap_Round()
- {
- p.EndCap = LineCap.Round;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void EndCap_Square() {
- p.EndCap = LineCap.Square;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void EndCap_AnchorMask() {
- p.EndCap = LineCap.AnchorMask;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void EndCap_ArrowAnchor() {
- p.EndCap = LineCap.ArrowAnchor;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void EndCap_DiamondAnchor() {
- p.EndCap = LineCap.DiamondAnchor;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void EndCap_NoAnchor() {
- p.EndCap = LineCap.NoAnchor;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void EndCap_RoundAnchor() {
- p.EndCap = LineCap.RoundAnchor;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void EndCap_SquareAnchor() {
- p.EndCap = LineCap.SquareAnchor;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void EndCap_Triangle() {
- p.EndCap = LineCap.Triangle;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- [Category ("NotWorking")]
- public void EndCap_Custom() {
- p.EndCap = LineCap.Custom;
- p.Width = 25;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- #region Basic LineCaps StartEnd
- [Test]
- public void StartEndCapBasic_Flat() {
- Assert.AreEqual(LineCap.Flat, p.StartCap);
- p.Width = 21;
- p.EndCap = LineCap.Flat;
- p.StartCap = LineCap.Flat;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void StartEndCapBasic_Round() {
- p.Width = 21;
- p.EndCap = LineCap.Round;
- p.StartCap = LineCap.Round;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void StartEndCapBasic_Square() {
- p.Width = 21;
- p.EndCap = LineCap.Square;
- p.StartCap = LineCap.Square;
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void SetLineCap_Flat() {
- Assert.AreEqual(LineCap.Flat, p.StartCap);
- p.Width = 21;
- p.SetLineCap(LineCap.Flat, LineCap.Flat, DashCap.Flat);
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void SetLineCap_Round() {
- p.Width = 21;
- p.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- [Test]
- public void SetLineCap_Square() {
- p.Width = 21;
- p.SetLineCap(LineCap.Square, LineCap.Square, DashCap.Flat);
- t.Graphics.DrawLine (p, 50, 100, 150, 100);
- t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
- t.Show ();
- Assert.IsTrue (t.Compare (TOLERANCE));
- }
- #endregion
- }
- }
|