VScrollPropertiesTest.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //
  2. // VScrollPropertiesTest.cs
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining
  5. // a copy of this software and associated documentation files (the
  6. // "Software"), to deal in the Software without restriction, including
  7. // without limitation the rights to use, copy, modify, merge, publish,
  8. // distribute, sublicense, and/or sell copies of the Software, and to
  9. // permit persons to whom the Software is furnished to do so, subject to
  10. // the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be
  13. // included in all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  19. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  20. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  21. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. //
  23. // Copyright (c) 2007 Jonathan Pobst
  24. //
  25. // Authors:
  26. // Jonathan Pobst ([email protected])
  27. //
  28. #if NET_2_0
  29. using System;
  30. using NUnit.Framework;
  31. using System.Drawing;
  32. using System.Windows.Forms;
  33. namespace MonoTests.System.Windows.Forms
  34. {
  35. [TestFixture]
  36. public class VScrollPropertiesTests
  37. {
  38. [Test]
  39. public void Constructor ()
  40. {
  41. ScrollableControl sc = new ScrollableControl ();
  42. ScrollProperties sp = sc.VerticalScroll;
  43. Assert.AreEqual (true, sp.Enabled, "A1");
  44. Assert.AreEqual (10, sp.LargeChange, "A2");
  45. Assert.AreEqual (100, sp.Maximum, "A3");
  46. Assert.AreEqual (0, sp.Minimum, "A4");
  47. Assert.AreEqual (1, sp.SmallChange, "A5");
  48. Assert.AreEqual (0, sp.Value, "A6");
  49. Assert.AreEqual (false, sp.Visible, "A7");
  50. }
  51. [Test]
  52. public void PropertyEnabled ()
  53. {
  54. ScrollableControl sc = new ScrollableControl ();
  55. ScrollProperties sp = sc.VerticalScroll;
  56. sp.Enabled = false;
  57. Assert.AreEqual (false, sp.Enabled, "B1");
  58. }
  59. [Test]
  60. public void PropertyLargeChange ()
  61. {
  62. ScrollableControl sc = new ScrollableControl ();
  63. ScrollProperties sp = sc.VerticalScroll;
  64. sp.LargeChange = 25;
  65. Assert.AreEqual (25, sp.LargeChange, "B1");
  66. }
  67. [Test]
  68. public void PropertyMaximum ()
  69. {
  70. ScrollableControl sc = new ScrollableControl ();
  71. ScrollProperties sp = sc.VerticalScroll;
  72. sp.Maximum = 200;
  73. Assert.AreEqual (200, sp.Maximum, "B1");
  74. }
  75. [Test]
  76. public void PropertyMinimum ()
  77. {
  78. ScrollableControl sc = new ScrollableControl ();
  79. ScrollProperties sp = sc.VerticalScroll;
  80. sp.Minimum = 20;
  81. Assert.AreEqual (20, sp.Minimum, "B1");
  82. }
  83. [Test]
  84. public void PropertySmallChange ()
  85. {
  86. ScrollableControl sc = new ScrollableControl ();
  87. ScrollProperties sp = sc.VerticalScroll;
  88. sp.SmallChange = 5;
  89. Assert.AreEqual (5, sp.SmallChange, "B1");
  90. }
  91. [Test]
  92. public void PropertyValue ()
  93. {
  94. ScrollableControl sc = new ScrollableControl ();
  95. ScrollProperties sp = sc.VerticalScroll;
  96. sp.Value = 10;
  97. Assert.AreEqual (10, sp.Value, "B1");
  98. }
  99. [Test]
  100. public void PropertyVisible ()
  101. {
  102. ScrollableControl sc = new ScrollableControl ();
  103. ScrollProperties sp = sc.VerticalScroll;
  104. sp.Visible = true;
  105. Assert.AreEqual (true, sp.Visible, "B1");
  106. }
  107. }
  108. }
  109. #endif