StatusBarPanelTest.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // StatusBarPanelTest.cs: Test cases for StatusBar.
  3. //
  4. // (C) 2006 Novell, Inc. (http://www.novell.com)
  5. //
  6. using System;
  7. using NUnit.Framework;
  8. using System.Windows.Forms;
  9. using System.Drawing;
  10. using System.Runtime.Remoting;
  11. namespace MonoTests.System.Windows.Forms
  12. {
  13. [TestFixture]
  14. public class StatusBarPanelTest
  15. {
  16. [Test]
  17. public void MinimumWidth1 ()
  18. {
  19. StatusBarPanel p = new StatusBarPanel ();
  20. Assert.AreEqual (10, p.MinWidth, "1");
  21. }
  22. [Test]
  23. public void MinimumWidth2 ()
  24. {
  25. StatusBarPanel p = new StatusBarPanel ();
  26. p.Width = 50;
  27. p.MinWidth = 100;
  28. Assert.AreEqual (100, p.Width, "1");
  29. }
  30. [Test]
  31. public void MinimumWidth3 ()
  32. {
  33. StatusBarPanel p = new StatusBarPanel ();
  34. p.Width = 50;
  35. p.MinWidth = 200;
  36. p.MinWidth = 25;
  37. Assert.AreEqual (200, p.Width, "#1");
  38. p = new StatusBarPanel ();
  39. p.Width = 50;
  40. p.MinWidth = 25;
  41. Assert.AreEqual (50, p.Width, "#2");
  42. p = new StatusBarPanel ();
  43. p.Width = 50;
  44. p.MinWidth = 100;
  45. Assert.AreEqual (100, p.Width, "#3");
  46. p = new StatusBarPanel ();
  47. p.MinWidth = 200;
  48. Assert.AreEqual (200, p.Width, "#4");
  49. }
  50. [Test]
  51. [ExpectedException(typeof(ArgumentException))]
  52. public void MinimumWidth4 ()
  53. {
  54. StatusBarPanel p = new StatusBarPanel ();
  55. p.MinWidth = -50;
  56. }
  57. [Test]
  58. public void MinWidth_AutoSize_None ()
  59. {
  60. StatusBarPanel p = new StatusBarPanel ();
  61. p.Width = 50;
  62. Assert.AreEqual (10, p.MinWidth, "#1");
  63. }
  64. [Test]
  65. public void ToStringTest ()
  66. {
  67. StatusBarPanel p = new StatusBarPanel ();
  68. Assert.AreEqual ("StatusBarPanel: {}", p.ToString(), "1");
  69. p.Text = "Hello";
  70. Assert.AreEqual ("StatusBarPanel: {Hello}", p.ToString(), "2");
  71. p.Text = "}";
  72. Assert.AreEqual ("StatusBarPanel: {}}", p.ToString(), "3");
  73. }
  74. [Test]
  75. public void DefaultPropertiesTest ()
  76. {
  77. StatusBarPanel p = new StatusBarPanel ();
  78. Assert.AreEqual (100, p.Width, "#1");
  79. Assert.AreEqual (10, p.MinWidth, "#2");
  80. Assert.AreEqual (String.Empty, p.Text, "#3");
  81. Assert.AreEqual (HorizontalAlignment.Left, p.Alignment, "#4");
  82. Assert.AreEqual (StatusBarPanelAutoSize.None, p.AutoSize, "#5");
  83. Assert.AreEqual (StatusBarPanelBorderStyle.Sunken, p.BorderStyle, "#6");
  84. Assert.AreEqual (StatusBarPanelStyle.Text, p.Style, "#7");
  85. Assert.AreEqual (String.Empty, p.ToolTipText, "#8");
  86. }
  87. }
  88. }