Pen.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. using System;
  2. using System.Drawing;
  3. using System.Drawing.Drawing2D;
  4. using NUnit.Framework;
  5. using DrawingTestHelper;
  6. namespace Test.Sys.Drawing
  7. {
  8. /// <summary>
  9. /// Summary description for Pen.
  10. /// </summary>
  11. [TestFixture]
  12. public class PenFixture {
  13. //TODO: Brush, CompoundArray, CustomEndCap, CustomStartCap,
  14. //StartCap, EndCap, PenType, Transform
  15. DrawingTest t;
  16. Pen p;
  17. protected int TOLERANCE = 3;
  18. [SetUp]
  19. public void SetUp () {
  20. t = DrawingTest.Create (256, 256);
  21. p = new Pen (Color.Blue);
  22. p.Width = 10;
  23. DrawingTest.ShowForms = false;
  24. }
  25. #region InitAlignment
  26. [Test]
  27. public void InitAlignment () {
  28. Pen p = new Pen (Color.Blue);
  29. Assert.AreEqual (PenAlignment.Center, p.Alignment);
  30. }
  31. #endregion
  32. #region PenWidth
  33. [Test]
  34. public void PenWidth_1()
  35. {
  36. Assert.AreEqual(10, p.Width);
  37. t.Graphics.DrawLine (p, 20, 200, 200, 20);
  38. t.Show();
  39. Assert.IsTrue (t.Compare (TOLERANCE * 1.5f)); //FIXME: Pen width in GH is not the same as in .NET
  40. }
  41. [Test]
  42. public void PenWidth_2()
  43. {
  44. p.Width = 25;
  45. t.Graphics.DrawLine (p, 20, 200, 200, 20);
  46. t.Show();
  47. Assert.IsTrue (t.Compare (TOLERANCE));
  48. }
  49. [Test]
  50. public void PenWidth_3 ()
  51. {
  52. t.Graphics.DrawLine (p, 10, 100, 200, 100);
  53. t.Show ();
  54. Assert.IsTrue (t.Compare (TOLERANCE));
  55. }
  56. #endregion
  57. #region DashStyle Tests
  58. [Test]
  59. public void DashStyleTest_1 ()
  60. {
  61. Assert.AreEqual (DashStyle.Solid, p.DashStyle);
  62. p.Width = 14;
  63. t.Graphics.DrawLine (p, 20, 100, 230, 100);
  64. t.Show ();
  65. Assert.IsTrue (t.Compare (TOLERANCE));
  66. }
  67. [Test]
  68. public void DashStyleTest_2 () {
  69. p.DashStyle = DashStyle.Dash;
  70. p.Width = 14;
  71. t.Graphics.DrawLine (p, 20, 100, 230, 100);
  72. t.Show ();
  73. Assert.IsTrue (t.Compare (TOLERANCE));
  74. }
  75. [Test]
  76. public void DashStyleTest_3 () {
  77. p.DashStyle = DashStyle.DashDot;
  78. p.Width = 14;
  79. t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);
  80. t.Graphics.DrawLine (p, 20, 100, 230, 100);
  81. t.Show ();
  82. Assert.IsTrue (t.Compare (TOLERANCE));
  83. }
  84. [Test]
  85. public void DashStyleTest_4 () {
  86. p.DashStyle = DashStyle.DashDotDot;
  87. p.Width = 14;
  88. t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);
  89. t.Graphics.DrawLine (p, 20, 100, 230, 100);
  90. t.Show ();
  91. Assert.IsTrue (t.Compare (TOLERANCE));
  92. }
  93. [Test]
  94. public void DashStyleTest_5 () {
  95. p.DashStyle = DashStyle.Dot;
  96. p.Width = 14;
  97. t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);
  98. t.Graphics.DrawLine (p, 20, 100, 230, 100);
  99. t.Show ();
  100. Assert.IsTrue (t.Compare (TOLERANCE));
  101. }
  102. [Test]
  103. public void DashStyleTest_6 () {
  104. p.DashStyle = DashStyle.Custom;
  105. p.Width = 14;
  106. t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);
  107. t.Graphics.DrawLine (p, 20, 100, 230, 100);
  108. t.Show ();
  109. Assert.IsTrue (t.Compare (TOLERANCE));
  110. }
  111. #endregion
  112. #region DashCustomStyle
  113. //The following tests DashOffset and DashPattern
  114. [Test]
  115. #if TARGET_JVM
  116. [Category ("NotWorking")] //FIXME: Bug in dashed line
  117. #endif
  118. public void DashCustomStyle_1 () {
  119. p.DashStyle = DashStyle.Custom;
  120. p.Width = 10;
  121. Assert.AreEqual (new float [] {1F}, p.DashPattern);
  122. Assert.AreEqual (0F, p.DashOffset);
  123. }
  124. [Test]
  125. public void DashCustomStyle_2 () {
  126. p.DashPattern = new float [] {2, 3, 1.15F, 0.05F};
  127. t.Graphics.FillRectangle (Brushes.Black, 0, 0, 256, 256);
  128. t.Graphics.DrawLine (p, 20, 100, 200, 100);
  129. t.Show ();
  130. Assert.IsTrue (t.Compare (TOLERANCE));
  131. }
  132. [Test]
  133. public void DashCustomStyle_3 () {
  134. p.DashOffset = 10F;
  135. t.Graphics.DrawLine (p, 20, 100, 200, 100);
  136. t.Show ();
  137. Assert.IsTrue (t.Compare (TOLERANCE));
  138. }
  139. [Test]
  140. #if TARGET_JVM
  141. [Category ("NotWorking")] //FIXME: Bug in dashed line
  142. #endif
  143. public void DashCustomStyle_4 () {
  144. p.DashPattern = new float [] {2, 3, 1.15F, 0.05F, 1.74321F};
  145. p.DashOffset = 10.2F;
  146. t.Graphics.DrawLine (p, 20, 100, 200, 100);
  147. t.Show ();
  148. Assert.IsTrue (t.Compare (TOLERANCE));
  149. }
  150. [Test]
  151. #if TARGET_JVM
  152. [Category ("NotWorking")] //FIXME: Bug in dashed line
  153. #endif
  154. public void DashCustomStyle_5 () {
  155. p.DashPattern = new float [] {2, 3, 1.15F, 0.05F, 1.74321F};
  156. p.DashOffset = 10.2F;
  157. t.Graphics.DrawLine (p, 20, 100, 200, 100);
  158. t.Show ();
  159. Assert.IsTrue (t.Compare (TOLERANCE));
  160. }
  161. #endregion
  162. #region DashCapTest
  163. [Test]
  164. #if TARGET_JVM
  165. [Category ("NotWorking")] //FIXME: Bug in dashed line
  166. #endif
  167. public void DashCapTest_Flat () {
  168. p.Width = 15;
  169. Assert.AreEqual (DashCap.Flat, p.DashCap);
  170. p.DashStyle = DashStyle.DashDot;
  171. t.Graphics.DrawLine (p, 10, 100, 230, 100);
  172. t.Show ();
  173. Assert.IsTrue (t.Compare (TOLERANCE));
  174. }
  175. [Test]
  176. #if TARGET_JVM
  177. [Category ("NotWorking")] //FIXME: Bug in dashed line
  178. #endif
  179. public void DashCapTest_Round () {
  180. p.Width = 15;
  181. p.DashStyle = DashStyle.DashDot;
  182. p.DashCap = DashCap.Round;
  183. t.Graphics.DrawLine (p, 10, 100, 230, 100);
  184. t.Show ();
  185. Assert.IsTrue (t.Compare (TOLERANCE));
  186. }
  187. [Test]
  188. #if TARGET_JVM
  189. [Category ("NotWorking")] // FIXME: DashCap.Triangle is not sopported by GH
  190. #endif
  191. public void DashCapTest_Triangle () {
  192. p.Width = 15;
  193. p.DashStyle = DashStyle.DashDot;
  194. p.DashCap = DashCap.Triangle;
  195. t.Graphics.DrawLine (p, 10, 100, 230, 100);
  196. t.Show ();
  197. Assert.IsTrue (t.Compare (TOLERANCE));
  198. }
  199. #endregion
  200. #region LineJoin Round
  201. [Test]
  202. public void LineJoinTest_Round_1 () {
  203. Point [] points = new Point [] {
  204. new Point(100, 210), new Point (120, 50),
  205. new Point (140, 210)};
  206. p.Width = 25;
  207. p.LineJoin = LineJoin.Round;
  208. t.Graphics.DrawPolygon (p, points);
  209. t.Graphics.DrawPolygon (Pens.White, points);
  210. t.Show ();
  211. Assert.IsTrue (t.Compare (TOLERANCE));
  212. }
  213. [Test]
  214. public void LineJoinTest_Round_2 () {
  215. Point [] points = new Point [] {
  216. new Point(50, 210), new Point (120, 50),
  217. new Point (190, 210)};
  218. p.Width = 25;
  219. p.LineJoin = LineJoin.Round;
  220. t.Graphics.DrawPolygon (p, points);
  221. t.Graphics.DrawPolygon (Pens.White, points);
  222. t.Show ();
  223. Assert.IsTrue (t.Compare (TOLERANCE));
  224. }
  225. #endregion
  226. #region LineJoin Miter
  227. [Test]
  228. #if TARGET_JVM
  229. [Category ("NotWorking")] // FIXME: Currently Only MiterClipper is sopported by GH
  230. #endif
  231. public void LineJoinTest_Miter_1 () {
  232. p.LineJoin = LineJoin.Miter;
  233. Point [] points = new Point [] {
  234. new Point(100, 217), new Point (130, 100),
  235. new Point (160, 217)};
  236. p.Width = 25;
  237. t.Graphics.DrawLines (p, points);
  238. t.Graphics.DrawLines (Pens.White, points);
  239. t.Show ();
  240. Assert.IsTrue (t.Compare (TOLERANCE));
  241. }
  242. [Test]
  243. #if TARGET_JVM
  244. [Category ("NotWorking")] // FIXME: Currently Only MiterClipper is sopported by GH
  245. #endif
  246. public void LineJoinTest_Miter_2 () {
  247. p.LineJoin = LineJoin.Miter;
  248. Point [] points = new Point [] {
  249. new Point(120, 237), new Point (130, 100),
  250. new Point (140, 237)};
  251. p.Width = 10;
  252. t.Graphics.DrawLines (p, points);
  253. t.Graphics.DrawLines (Pens.White, points);
  254. t.Show ();
  255. Assert.IsTrue (t.Compare (TOLERANCE));
  256. }
  257. [Test]
  258. #if TARGET_JVM
  259. [Category ("NotWorking")] // FIXME: Currently Only MiterClipper is sopported by GH
  260. #endif
  261. public void LineJoinTest_Miter_3 () {
  262. p.LineJoin = LineJoin.Miter;
  263. Point [] points = new Point [] {
  264. new Point(50, 217), new Point (100, 100),
  265. new Point (150, 217)};
  266. p.Width = 25;
  267. t.Graphics.DrawLines (p, points);
  268. t.Graphics.DrawLines (Pens.White, points);
  269. t.Show ();
  270. Assert.IsTrue (t.Compare (TOLERANCE));
  271. }
  272. #endregion
  273. #region LineJoin MiterClipped
  274. [Test]
  275. public void LineJoinTest_MiterClipped_1 () {
  276. p.LineJoin = LineJoin.MiterClipped;
  277. Point [] points = new Point [] {
  278. new Point(100, 217), new Point (130, 100),
  279. new Point (160, 217)};
  280. p.Width = 25;
  281. t.Graphics.DrawLines (p, points);
  282. t.Graphics.DrawLines (Pens.White, points);
  283. t.Show ();
  284. Assert.IsTrue (t.Compare (TOLERANCE));
  285. }
  286. [Test]
  287. public void LineJoinTest_MiterClipped_2 () {
  288. p.LineJoin = LineJoin.MiterClipped;
  289. Point [] points = new Point [] {
  290. new Point(120, 217), new Point (130, 80),
  291. new Point (140, 217)};
  292. p.Width = 25;
  293. t.Graphics.DrawLines (p, points);
  294. t.Graphics.DrawLines (Pens.White, points);
  295. t.Show ();
  296. Assert.IsTrue (t.Compare (TOLERANCE));
  297. }
  298. [Test]
  299. public void LineJoinTest_MiterClipped_3 () {
  300. p.LineJoin = LineJoin.MiterClipped;
  301. Point [] points = new Point [] {
  302. new Point(50, 217), new Point (100, 100),
  303. new Point (150, 217)};
  304. p.Width = 25;
  305. t.Graphics.DrawLines (p, points);
  306. t.Graphics.DrawLines (Pens.White, points);
  307. t.Show ();
  308. Assert.IsTrue (t.Compare (TOLERANCE));
  309. }
  310. #endregion
  311. #region "LineJoin Bevel"
  312. [Test]
  313. public void LineJoinTest_Bevel_1 () {
  314. p.LineJoin = LineJoin.Bevel;
  315. Point [] points = new Point [] {
  316. new Point(90, 217), new Point (115, 55),
  317. new Point (140, 217)};
  318. p.Width = 25;
  319. t.Graphics.DrawLines (p, points);
  320. t.Graphics.DrawLines (Pens.White, points);
  321. t.Show ();
  322. Assert.IsTrue (t.Compare (TOLERANCE));
  323. }
  324. [Test]
  325. public void LineJoinTest_Bevel_2 () {
  326. p.LineJoin = LineJoin.Bevel;
  327. Point [] points = new Point [] {
  328. new Point(110, 217), new Point (120, 75),
  329. new Point (130, 217)};
  330. p.Width = 25;
  331. t.Graphics.DrawLines (p, points);
  332. t.Graphics.DrawLines (Pens.White, points);
  333. t.Show ();
  334. Assert.IsTrue (t.Compare (TOLERANCE));
  335. }
  336. [Test]
  337. public void LineJoinTest_Bevel_3 () {
  338. p.LineJoin = LineJoin.Bevel;
  339. Point [] points = new Point [] {
  340. new Point(50, 217), new Point (100, 100),
  341. new Point (150, 217)};
  342. p.Width = 25;
  343. t.Graphics.DrawLines (p, points);
  344. t.Graphics.DrawLines (Pens.White, points);
  345. t.Show ();
  346. Assert.IsTrue (t.Compare (TOLERANCE));
  347. }
  348. [Test]
  349. public void LineJoinTest_Bevel_4 () {
  350. p.LineJoin = LineJoin.Bevel;
  351. Point [] points = new Point [] {
  352. new Point(143, 210), new Point (170, 100),
  353. new Point (180, 20)};
  354. p.Width = 25;
  355. t.Graphics.DrawLines (p, points);
  356. t.Graphics.DrawLines (Pens.White, points);
  357. t.Show ();
  358. Assert.IsTrue (t.Compare (TOLERANCE));
  359. }
  360. [Test]
  361. public void LineJoinTest_Bevel_5 () {
  362. p.LineJoin = LineJoin.Bevel;
  363. Point [] points = new Point [] {
  364. new Point(50, 100), new Point (150, 100),
  365. new Point (150, 20), new Point (200, 20)};
  366. p.Width = 25;
  367. t.Graphics.DrawLines (p, points);
  368. t.Graphics.DrawLines (Pens.White, points);
  369. t.Show ();
  370. Assert.IsTrue (t.Compare (TOLERANCE));
  371. }
  372. #endregion
  373. #region PenAlignment
  374. [Test]
  375. public void PenAlignmentTest_1 () {
  376. Assert.AreEqual (PenAlignment.Center, p.Alignment);
  377. Point [] points = new Point [] {
  378. new Point (30, 30), new Point (100, 100), new Point (170, 30),
  379. new Point (170, 200), new Point (30, 200)};
  380. GraphicsPath path = new GraphicsPath ();
  381. path.AddPolygon (points);
  382. p.Width = 25;
  383. t.Graphics.DrawPath (p, path);
  384. t.Graphics.DrawPath (Pens.White, path);
  385. t.Show ();
  386. Assert.IsTrue (t.Compare (TOLERANCE));
  387. }
  388. [Test]
  389. public void PenAlignmentTest_2 () {
  390. Point [] points = new Point [] {
  391. new Point (30, 30), new Point (100, 100), new Point (170, 30),
  392. new Point (170, 200), new Point (30, 200)};
  393. GraphicsPath path = new GraphicsPath ();
  394. path.AddPolygon (points);
  395. p.Width = 25;
  396. p.Alignment = PenAlignment.Left;
  397. t.Graphics.DrawPath (p, path);
  398. t.Graphics.DrawPath (Pens.White, path);
  399. t.Show ();
  400. Assert.IsTrue (t.Compare (TOLERANCE));
  401. }
  402. [Test]
  403. #if TARGET_JVM
  404. [Category ("NotWorking")] //FIXME: Bug in pen aligment
  405. #endif
  406. public void PenAlignmentTest_3 () {
  407. Point [] points = new Point [] {
  408. new Point (30, 30), new Point (100, 100), new Point (170, 30),
  409. new Point (170, 200), new Point (30, 200)};
  410. GraphicsPath path = new GraphicsPath ();
  411. path.AddPolygon (points);
  412. p.Width = 25;
  413. p.Alignment = PenAlignment.Inset;
  414. t.Graphics.DrawPath (p, path);
  415. t.Graphics.DrawPath (Pens.White, path);
  416. t.Show ();
  417. Assert.IsTrue (t.Compare (TOLERANCE));
  418. }
  419. [Test]
  420. public void PenAlignmentTest_4 () {
  421. Point [] points = new Point [] {
  422. new Point (30, 30), new Point (100, 100), new Point (170, 30),
  423. new Point (170, 200), new Point (30, 200)};
  424. GraphicsPath path = new GraphicsPath ();
  425. path.AddPolygon (points);
  426. p.Width = 25;
  427. p.Alignment = PenAlignment.Outset;
  428. t.Graphics.DrawPath (p, path);
  429. t.Graphics.DrawPath (Pens.White, path);
  430. t.Show ();
  431. Assert.IsTrue (t.Compare (TOLERANCE));
  432. }
  433. [Test]
  434. public void PenAlignmentTest_5 () {
  435. Point [] points = new Point [] {
  436. new Point (30, 30), new Point (100, 100), new Point (170, 30),
  437. new Point (170, 200), new Point (30, 200)};
  438. GraphicsPath path = new GraphicsPath ();
  439. path.AddPolygon (points);
  440. p.Width = 25;
  441. p.Alignment = PenAlignment.Right;
  442. t.Graphics.DrawPath (p, path);
  443. t.Graphics.DrawPath (Pens.White, path);
  444. t.Show ();
  445. Assert.IsTrue (t.Compare (TOLERANCE));
  446. }
  447. #endregion
  448. #region Color test
  449. [Test]
  450. public void ColorTest_1 () {
  451. Assert.AreEqual (Color.Blue, p.Color);
  452. p.Width = 25;
  453. t.Graphics.DrawLine (p, 10, 100, 230, 100);
  454. t.Show ();
  455. Assert.IsTrue (t.Compare (TOLERANCE));
  456. }
  457. [Test]
  458. public void ColorTest_2 () {
  459. p.Color = Color.Red;
  460. p.Width = 25;
  461. t.Graphics.DrawLine (p, 10, 100, 230, 100);
  462. t.Show ();
  463. Assert.IsTrue (t.Compare (TOLERANCE));
  464. }
  465. [Test]
  466. public void ColorTest_3 () {
  467. p.Color = Color.BurlyWood;
  468. p.Width = 25;
  469. t.Graphics.DrawLine (p, 10, 100, 230, 100);
  470. t.Show ();
  471. Assert.IsTrue (t.Compare (TOLERANCE));
  472. }
  473. [Test]
  474. public void ColorTest_4 () {
  475. p.Color = Color.FromArgb (100, 120, 255);
  476. p.Width = 25;
  477. t.Graphics.DrawLine (p, 10, 100, 230, 100);
  478. t.Show ();
  479. Assert.IsTrue (t.Compare (TOLERANCE));
  480. }
  481. [Test]
  482. public void ColorTest_5 () {
  483. p.Color = Color.FromArgb (128, Color.White);
  484. p.Width = 25;
  485. t.Graphics.DrawLine (p, 10, 100, 230, 100);
  486. t.Show ();
  487. Assert.IsTrue (t.Compare (TOLERANCE));
  488. }
  489. #endregion
  490. #region MiterLimit
  491. [Test]
  492. public void MitterLimit_1 () {
  493. p.LineJoin = LineJoin.MiterClipped;
  494. Point [] points = new Point [] {new Point (0,30), new Point (180, 30),
  495. new Point (0, 90)};
  496. p.Width = 25;
  497. Assert.AreEqual (10F, p.MiterLimit);
  498. t.Graphics.DrawLines (p, points);
  499. t.Graphics.DrawLines (Pens.White, points);
  500. t.Show ();
  501. Assert.IsTrue (t.Compare (TOLERANCE));
  502. }
  503. [Test]
  504. public void MitterLimit_2 () {
  505. p.MiterLimit=1F;
  506. p.LineJoin = LineJoin.MiterClipped;
  507. Point [] points = new Point [] {new Point (0,30), new Point (180, 30),
  508. new Point (0, 120)};
  509. p.Width = 25;
  510. t.Graphics.DrawLines (p, points);
  511. t.Graphics.DrawLines (Pens.White, points);
  512. t.Show ();
  513. Assert.IsTrue (t.Compare (TOLERANCE));
  514. }
  515. #endregion
  516. #region TRansform
  517. [Test]
  518. public void Transform () {
  519. p.ScaleTransform (0.5F, 2);
  520. t.Graphics.DrawArc (p, 70, 70, 100, 100, 0, 360);
  521. t.Graphics.DrawArc (Pens.White, 70, 70, 100, 100, 0, 360);
  522. t.Show ();
  523. Assert.IsTrue (t.Compare (TOLERANCE));
  524. }
  525. #endregion
  526. #region Line StartCap
  527. [Test]
  528. #if TARGET_JVM
  529. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  530. #endif
  531. public void StartCap_Flat() {
  532. Assert.AreEqual(LineCap.Flat, p.StartCap);
  533. p.StartCap = LineCap.Flat;
  534. p.Width = 25;
  535. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  536. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  537. t.Show ();
  538. Assert.IsTrue (t.Compare (TOLERANCE));
  539. }
  540. [Test]
  541. #if TARGET_JVM
  542. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  543. #endif
  544. public void StartCap_Round() {
  545. p.StartCap = LineCap.Round;
  546. p.Width = 25;
  547. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  548. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  549. t.Show ();
  550. Assert.IsTrue (t.Compare (TOLERANCE));
  551. }
  552. [Test]
  553. #if TARGET_JVM
  554. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  555. #endif
  556. public void StartCap_Square() {
  557. p.StartCap = LineCap.Square;
  558. p.Width = 25;
  559. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  560. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  561. t.Show ();
  562. Assert.IsTrue (t.Compare (TOLERANCE));
  563. }
  564. [Test]
  565. #if TARGET_JVM
  566. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  567. #endif
  568. public void StartCap_AnchorMask() {
  569. p.StartCap = LineCap.AnchorMask;
  570. p.Width = 25;
  571. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  572. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  573. t.Show ();
  574. Assert.IsTrue (t.Compare (TOLERANCE));
  575. }
  576. [Test]
  577. #if TARGET_JVM
  578. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  579. #endif
  580. public void StartCap_ArrowAnchor() {
  581. p.StartCap = LineCap.ArrowAnchor;
  582. p.Width = 25;
  583. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  584. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  585. t.Show ();
  586. Assert.IsTrue (t.Compare (TOLERANCE));
  587. }
  588. [Test]
  589. #if TARGET_JVM
  590. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  591. #endif
  592. public void StartCap_DiamondAnchor() {
  593. p.StartCap = LineCap.DiamondAnchor;
  594. p.Width = 25;
  595. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  596. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  597. t.Show ();
  598. Assert.IsTrue (t.Compare (TOLERANCE));
  599. }
  600. [Test]
  601. #if TARGET_JVM
  602. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  603. #endif
  604. public void StartCap_NoAnchor() {
  605. p.StartCap = LineCap.NoAnchor;
  606. p.Width = 25;
  607. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  608. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  609. t.Show ();
  610. Assert.IsTrue (t.Compare (TOLERANCE));
  611. }
  612. [Test]
  613. #if TARGET_JVM
  614. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  615. #endif
  616. public void StartCap_RoundAnchor() {
  617. p.StartCap = LineCap.RoundAnchor;
  618. p.Width = 25;
  619. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  620. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  621. t.Show ();
  622. Assert.IsTrue (t.Compare (TOLERANCE));
  623. }
  624. [Test]
  625. #if TARGET_JVM
  626. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  627. #endif
  628. public void StartCap_SquareAnchor() {
  629. p.StartCap = LineCap.SquareAnchor;
  630. p.Width = 25;
  631. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  632. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  633. t.Show ();
  634. Assert.IsTrue (t.Compare (TOLERANCE));
  635. }
  636. [Test]
  637. #if TARGET_JVM
  638. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  639. #endif
  640. public void StartCap_Triangle() {
  641. p.StartCap = LineCap.Triangle;
  642. p.Width = 25;
  643. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  644. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  645. t.Show ();
  646. Assert.IsTrue (t.Compare (TOLERANCE));
  647. }
  648. [Test]
  649. #if TARGET_JVM
  650. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  651. #endif
  652. public void StartCap_Custom() {
  653. p.StartCap = LineCap.Custom;
  654. p.Width = 25;
  655. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  656. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  657. t.Show ();
  658. Assert.IsTrue (t.Compare (TOLERANCE));
  659. }
  660. #endregion
  661. #region Line EndCap
  662. [Test]
  663. #if TARGET_JVM
  664. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  665. #endif
  666. public void EndCap_Flat()
  667. {
  668. Assert.AreEqual(LineCap.Flat, p.EndCap);
  669. p.EndCap = LineCap.Flat;
  670. p.Width = 25;
  671. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  672. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  673. t.Show ();
  674. Assert.IsTrue (t.Compare (TOLERANCE));
  675. }
  676. [Test]
  677. #if TARGET_JVM
  678. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  679. #endif
  680. public void EndCap_Round()
  681. {
  682. p.EndCap = LineCap.Round;
  683. p.Width = 25;
  684. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  685. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  686. t.Show ();
  687. Assert.IsTrue (t.Compare (TOLERANCE));
  688. }
  689. [Test]
  690. #if TARGET_JVM
  691. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  692. #endif
  693. public void EndCap_Square() {
  694. p.EndCap = LineCap.Square;
  695. p.Width = 25;
  696. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  697. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  698. t.Show ();
  699. Assert.IsTrue (t.Compare (TOLERANCE));
  700. }
  701. [Test]
  702. #if TARGET_JVM
  703. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  704. #endif
  705. public void EndCap_AnchorMask() {
  706. p.EndCap = LineCap.AnchorMask;
  707. p.Width = 25;
  708. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  709. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  710. t.Show ();
  711. Assert.IsTrue (t.Compare (TOLERANCE));
  712. }
  713. [Test]
  714. #if TARGET_JVM
  715. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  716. #endif
  717. public void EndCap_ArrowAnchor() {
  718. p.EndCap = LineCap.ArrowAnchor;
  719. p.Width = 25;
  720. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  721. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  722. t.Show ();
  723. Assert.IsTrue (t.Compare (TOLERANCE));
  724. }
  725. [Test]
  726. #if TARGET_JVM
  727. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  728. #endif
  729. public void EndCap_DiamondAnchor() {
  730. p.EndCap = LineCap.DiamondAnchor;
  731. p.Width = 25;
  732. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  733. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  734. t.Show ();
  735. Assert.IsTrue (t.Compare (TOLERANCE));
  736. }
  737. [Test]
  738. #if TARGET_JVM
  739. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  740. #endif
  741. public void EndCap_NoAnchor() {
  742. p.EndCap = LineCap.NoAnchor;
  743. p.Width = 25;
  744. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  745. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  746. t.Show ();
  747. Assert.IsTrue (t.Compare (TOLERANCE));
  748. }
  749. [Test]
  750. #if TARGET_JVM
  751. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  752. #endif
  753. public void EndCap_RoundAnchor() {
  754. p.EndCap = LineCap.RoundAnchor;
  755. p.Width = 25;
  756. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  757. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  758. t.Show ();
  759. Assert.IsTrue (t.Compare (TOLERANCE));
  760. }
  761. [Test]
  762. #if TARGET_JVM
  763. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  764. #endif
  765. public void EndCap_SquareAnchor() {
  766. p.EndCap = LineCap.SquareAnchor;
  767. p.Width = 25;
  768. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  769. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  770. t.Show ();
  771. Assert.IsTrue (t.Compare (TOLERANCE));
  772. }
  773. [Test]
  774. #if TARGET_JVM
  775. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  776. #endif
  777. public void EndCap_Triangle() {
  778. p.EndCap = LineCap.Triangle;
  779. p.Width = 25;
  780. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  781. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  782. t.Show ();
  783. Assert.IsTrue (t.Compare (TOLERANCE));
  784. }
  785. [Test]
  786. #if TARGET_JVM
  787. [Category ("NotWorking")] //FIXME: cannot apply start or end line caps separately
  788. #endif
  789. public void EndCap_Custom() {
  790. p.EndCap = LineCap.Custom;
  791. p.Width = 25;
  792. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  793. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  794. t.Show ();
  795. Assert.IsTrue (t.Compare (TOLERANCE));
  796. }
  797. #endregion
  798. #region Basic LineCaps StartEnd
  799. [Test]
  800. public void StartEndCapBasic_Flat() {
  801. Assert.AreEqual(LineCap.Flat, p.StartCap);
  802. p.Width = 21;
  803. p.EndCap = LineCap.Flat;
  804. p.StartCap = LineCap.Flat;
  805. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  806. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  807. t.Show ();
  808. Assert.IsTrue (t.Compare (TOLERANCE));
  809. }
  810. [Test]
  811. public void StartEndCapBasic_Round() {
  812. p.Width = 21;
  813. p.EndCap = LineCap.Round;
  814. p.StartCap = LineCap.Round;
  815. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  816. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  817. t.Show ();
  818. Assert.IsTrue (t.Compare (TOLERANCE));
  819. }
  820. [Test]
  821. public void StartEndCapBasic_Square() {
  822. p.Width = 21;
  823. p.EndCap = LineCap.Square;
  824. p.StartCap = LineCap.Square;
  825. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  826. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  827. t.Show ();
  828. Assert.IsTrue (t.Compare (TOLERANCE));
  829. }
  830. [Test]
  831. public void SetLineCap_Flat() {
  832. Assert.AreEqual(LineCap.Flat, p.StartCap);
  833. p.Width = 21;
  834. p.SetLineCap(LineCap.Flat, LineCap.Flat, DashCap.Flat);
  835. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  836. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  837. t.Show ();
  838. Assert.IsTrue (t.Compare (TOLERANCE));
  839. }
  840. [Test]
  841. public void SetLineCap_Round() {
  842. p.Width = 21;
  843. p.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
  844. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  845. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  846. t.Show ();
  847. Assert.IsTrue (t.Compare (TOLERANCE));
  848. }
  849. [Test]
  850. public void SetLineCap_Square() {
  851. p.Width = 21;
  852. p.SetLineCap(LineCap.Square, LineCap.Square, DashCap.Flat);
  853. t.Graphics.DrawLine (p, 50, 100, 150, 100);
  854. t.Graphics.DrawLine (Pens.White, 50, 100, 150, 100);
  855. t.Show ();
  856. Assert.IsTrue (t.Compare (TOLERANCE));
  857. }
  858. #endregion
  859. }
  860. }