FYI: new tests for BasicSliderUI

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FYI: new tests for BasicSliderUI

Dave Gilbert-4
I committed this patch:

2005-07-25  David Gilbert  <[hidden email]>

    *
gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/calculateGeometry.java:
new file,
    *
gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/constructors.java: new
file,
    *
gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getMaximumSize.java:
new file,
    *
gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getMinimumSize.java:
new file,
    *
gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getPreferredSize.java:
new file,
    *
gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getThumbSize.java: new
file,
    * gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/installUI.java:
new file,
    *
gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/MyBasicSliderUI.java:
new file,
    *
gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/valueForXPosition.java:
new file,
    *
gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/valueForYPosition.java:
new file,
    *
gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/xPositionForValue.java:
new file,
    *
gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/yPositionForValue.java:
new file.

Regards,

Dave Gilbert



Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/MyBasicSliderUI.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/MyBasicSliderUI.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/MyBasicSliderUI.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/MyBasicSliderUI.java 25 Jul 2005 08:50:38 -0000
@@ -0,0 +1,112 @@
+// Tags: not-a-test
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Rectangle;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * A utility class to provide access to protected attributes and methods.
+ */
+public class MyBasicSliderUI extends BasicSliderUI {
+    
+  public MyBasicSliderUI(JSlider slider)
+  {
+    super(slider);    
+  }
+
+  public JSlider getSlider()
+  {
+    return this.slider;
+  }
+  
+  public Color getFocusColor()
+  {
+    return super.getFocusColor();
+  }
+  
+  public Color getHighlightColor()
+  {
+    return super.getHighlightColor();
+  }
+  
+  public Color getShadowColor()
+  {
+    return super.getShadowColor();
+  }
+  
+  public int getTrackBuffer()
+  {
+    return super.trackBuffer;
+  }
+  
+  public int getTickLength()
+  {
+    return super.getTickLength();
+  }
+  
+  public Dimension getThumbSize() {
+    return super.getThumbSize();
+  }
+  
+  public Rectangle getFocusRect()
+  {
+    return this.focusRect;
+  }
+  
+  public Rectangle getContentRect()
+  {
+    return this.contentRect;    
+  }
+  
+  public Rectangle getTrackRect()
+  {
+    return this.trackRect;
+  }
+  
+  public Rectangle getThumbRect()
+  {
+    return this.thumbRect;
+  }
+  
+  public Rectangle getTickRect()
+  {
+    return this.tickRect;
+  }
+  
+  public void calculateGeometry()
+  {
+    super.calculateGeometry();    
+  }
+  
+  public int xPositionForValue(int v)
+  {
+    return super.xPositionForValue(v);
+  }
+  
+  public int yPositionForValue(int v)
+  {
+    return super.yPositionForValue(v);
+  }
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/calculateGeometry.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/calculateGeometry.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/calculateGeometry.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/calculateGeometry.java 25 Jul 2005 08:50:39 -0000
@@ -0,0 +1,61 @@
+// Tags: JDK1.2
+// Uses: MyBasicSliderUI.java
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Rectangle;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * Some checks for the calculateGeometry() method in the {@link BasicSliderUI}
+ * class.
+ */
+public class calculateGeometry implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    JSlider slider = new JSlider();
+    slider.setBounds(10, 20, 300, 40);
+    MyBasicSliderUI ui = new MyBasicSliderUI(slider);
+    ui.installUI(slider);
+    ui.calculateGeometry();
+    harness.check(ui.getContentRect(), new Rectangle(0, 0, 300, 40));
+    harness.check(ui.getTrackBuffer(), 5);
+    harness.check(ui.getFocusRect(), new Rectangle(0, 0, 300, 40));
+    harness.check(ui.getTrackRect(), new Rectangle(5, 9, 290, 20));
+    harness.check(ui.getThumbRect(), new Rectangle(145, 9, 11, 20));
+    harness.check(ui.getTickRect(), new Rectangle(5, 28, 290, 0));
+    
+    slider.setPaintTicks(true);
+    slider.setMajorTickSpacing(10);
+    ui.calculateGeometry();
+    harness.check(ui.getContentRect(), new Rectangle(0, 0, 300, 40));
+    harness.check(ui.getTrackBuffer(), 5);
+    harness.check(ui.getFocusRect(), new Rectangle(0, 0, 300, 40));
+    harness.check(ui.getTrackRect(), new Rectangle(5, 5, 290, 20));
+    harness.check(ui.getThumbRect(), new Rectangle(145, 5, 11, 20));
+    harness.check(ui.getTickRect(), new Rectangle(5, 25, 290, 8));
+  }
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/constructors.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/constructors.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/constructors.java 25 Jul 2005 08:50:39 -0000
@@ -0,0 +1,79 @@
+// Tags: JDK1.2
+// Uses: MyBasicSliderUI.java
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * Some checks for the constructors in the {@link BasicSliderUI} class.
+ */
+public class constructors implements Testlet
+{
+
+  /**
+   * Runs the test using the specified harness.
+   *
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    JSlider slider = new JSlider();
+    MyBasicSliderUI b = new MyBasicSliderUI(slider);
+    
+    // the constructor doesn't initialise anything
+    harness.check(b.getSlider(), null);
+    harness.check(b.getFocusColor(), null);
+    harness.check(b.getHighlightColor(), null);
+    harness.check(b.getShadowColor(), null);
+    
+    harness.check(b.getTrackBuffer(), 0);
+    harness.check(b.getTickLength(), 8);
+    
+    // accessing the thumb size at this point throws a NullPointerException
+    boolean pass = false;
+    try
+    {
+      /* Dimension d =*/ b.getThumbSize();
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // check null slider
+    pass = true;
+    try
+    {
+      /* MyBasicSliderUI b2 =*/ new MyBasicSliderUI(null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = false;
+    }
+    harness.check(pass);
+  }
+}
+
Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getMaximumSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getMaximumSize.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getMaximumSize.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getMaximumSize.java 25 Jul 2005 08:50:39 -0000
@@ -0,0 +1,72 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Dimension;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * Some checks for the getMaximumSize() method in the {@link BasicSliderUI}
+ * class.
+ */
+public class getMaximumSize implements Testlet
+{
+
+  /**
+   * Runs the test using the specified harness.
+   *
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    JSlider slider1 = new JSlider(JSlider.HORIZONTAL);
+    BasicSliderUI ui1 = new BasicSliderUI(slider1);
+    slider1.setUI(ui1);
+    Dimension d1 = ui1.getMaximumSize(slider1);
+    harness.check(d1, new Dimension(32767, 20));
+        
+    slider1.setPaintTicks(true);
+    slider1.setMajorTickSpacing(10);
+    d1 = ui1.getMaximumSize(slider1);
+    harness.check(d1, new Dimension(32767, 28));
+
+    JSlider slider2 = new JSlider(JSlider.VERTICAL);
+    BasicSliderUI ui2 = new BasicSliderUI(slider2);
+    slider2.setUI(ui2);
+    Dimension d2 = ui2.getMaximumSize(slider2);
+    harness.check(d2, new Dimension(20, 32767));
+
+    slider2.setPaintTicks(true);
+    slider2.setMajorTickSpacing(10);
+    d2 = ui2.getMaximumSize(slider2);
+    harness.check(d2, new Dimension(28, 32767));
+
+    // try null argument - the argument is ignored, probably the implementation
+    // uses the internal slider reference
+    d2 = ui2.getMaximumSize(null);
+    harness.check(d2, new Dimension(28, 32767));
+  }
+}
+
Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getMinimumSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getMinimumSize.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getMinimumSize.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getMinimumSize.java 25 Jul 2005 08:50:39 -0000
@@ -0,0 +1,73 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Dimension;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * Some checks for the getMinimumSize() method in the {@link BasicSliderUI}
+ * class.
+ */
+public class getMinimumSize implements Testlet
+{
+
+  /**
+   * Runs the test using the specified harness.
+   *
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    JSlider slider1 = new JSlider(JSlider.HORIZONTAL);
+    BasicSliderUI ui1 = new BasicSliderUI(slider1);
+    slider1.setUI(ui1);
+    Dimension d1 = ui1.getMinimumSize(slider1);
+    harness.check(d1, new Dimension(36, 20));
+        
+    slider1.setPaintTicks(true);
+    slider1.setMajorTickSpacing(10);
+    d1 = ui1.getMinimumSize(slider1);
+    harness.check(d1, new Dimension(36, 28));
+
+    JSlider slider2 = new JSlider(JSlider.VERTICAL);
+    BasicSliderUI ui2 = new BasicSliderUI(slider2);
+    slider2.setUI(ui2);
+    Dimension d2 = ui2.getMinimumSize(slider2);
+    harness.check(d2, new Dimension(20, 36));
+
+    slider2.setPaintTicks(true);
+    slider2.setMajorTickSpacing(10);
+    d2 = ui2.getMinimumSize(slider2);
+    harness.check(d2, new Dimension(28, 36));
+
+    // try null argument - the argument is ignored, probably the implementation
+    // uses the internal slider reference
+    d2 = ui2.getMinimumSize(null);
+    harness.check(d2, new Dimension(28, 36));
+  
+  }
+}
+
Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getPreferredSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getPreferredSize.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getPreferredSize.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getPreferredSize.java 25 Jul 2005 08:50:39 -0000
@@ -0,0 +1,72 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Dimension;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * Some checks for the getPreferredSize() method in the {@link BasicSliderUI}
+ * class.
+ */
+public class getPreferredSize implements Testlet
+{
+
+  /**
+   * Runs the test using the specified harness.
+   *
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    JSlider slider1 = new JSlider(JSlider.HORIZONTAL);
+    BasicSliderUI ui1 = new BasicSliderUI(slider1);
+    slider1.setUI(ui1);
+    Dimension d1 = ui1.getPreferredSize(slider1);
+    harness.check(d1, new Dimension(200, 20));
+    
+    slider1.setPaintTicks(true);
+    slider1.setMajorTickSpacing(10);
+    d1 = ui1.getPreferredSize(slider1);
+    harness.check(d1, new Dimension(200, 28));
+    
+    JSlider slider2 = new JSlider(JSlider.VERTICAL);
+    BasicSliderUI ui2 = new BasicSliderUI(slider2);
+    slider2.setUI(ui2);
+    Dimension d2 = ui2.getPreferredSize(slider2);
+    harness.check(d2, new Dimension(20, 200));
+    
+    slider2.setPaintTicks(true);
+    slider2.setMajorTickSpacing(10);
+    d2 = ui2.getPreferredSize(slider2);
+    harness.check(d2, new Dimension(28, 200));
+    
+    // try null argument - the argument is ignored, probably the implementation
+    // uses the internal slider reference
+    d2 = ui2.getPreferredSize(null);
+    harness.check(d2, new Dimension(28, 200));
+  }
+}
+
Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getThumbSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getThumbSize.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getThumbSize.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/getThumbSize.java 25 Jul 2005 08:50:39 -0000
@@ -0,0 +1,52 @@
+// Tags: JDK1.2
+// Uses: MyBasicSliderUI.java
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Dimension;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * Some checks for the getThumbSize method in the {@link BasicSliderUI} class.
+ */
+public class getThumbSize implements Testlet
+{
+
+  /**
+   * Runs the test using the specified harness.
+   *
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    JSlider slider = new JSlider();
+    slider.setUI(new MyBasicSliderUI(slider));
+    MyBasicSliderUI b = (MyBasicSliderUI) slider.getUI();
+    harness.check(b.getThumbSize(), new Dimension(11, 20));
+    slider.setOrientation(JSlider.VERTICAL);
+    harness.check(b.getThumbSize(), new Dimension(20, 11));    
+  }
+}
+
Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/installUI.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/installUI.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/installUI.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/installUI.java 25 Jul 2005 08:50:39 -0000
@@ -0,0 +1,48 @@
+// Tags: JDK1.2
+// Uses: MyBasicSliderUI.java
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Rectangle;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * Some checks for the installUI() method in the {@link BasicSliderUI} class.
+ */
+public class installUI implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    JSlider slider = new JSlider();
+    slider.setBounds(10, 20, 300, 40);
+    MyBasicSliderUI ui = new MyBasicSliderUI(slider);
+    ui.installUI(slider);
+    harness.check(ui.getContentRect(), new Rectangle(0, 0, 300, 40));
+    harness.check(ui.getTrackBuffer(), 5);
+    harness.check(ui.getTrackRect(), new Rectangle(5, 9, 290, 20));
+    harness.check(ui.getThumbRect(), new Rectangle(145, 9, 11, 20));
+    harness.check(ui.getTickRect(), new Rectangle(5, 28, 290, 0));
+  }
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/valueForXPosition.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/valueForXPosition.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/valueForXPosition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/valueForXPosition.java 25 Jul 2005 08:50:39 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * Some checks for the valueForXPosition() method in the {@link BasicSliderUI}
+ * class.
+ */
+public class valueForXPosition implements Testlet
+{
+
+  /**
+   * Runs the test using the specified harness.
+   *
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    JSlider slider1 = new JSlider(JSlider.HORIZONTAL);
+    slider1.setBounds(10, 20, 400, 40);
+    BasicSliderUI ui1 = new BasicSliderUI(slider1);
+    slider1.setUI(ui1);
+    harness.check(ui1.valueForXPosition(0), 0);
+    harness.check(ui1.valueForXPosition(200), 50);
+    harness.check(ui1.valueForXPosition(400), 100);
+    harness.check(ui1.valueForXPosition(-50), 0);
+    harness.check(ui1.valueForXPosition(450), 100);
+  }
+}
+
Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/valueForYPosition.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/valueForYPosition.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/valueForYPosition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/valueForYPosition.java 25 Jul 2005 08:50:39 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * Some checks for the valueForYPosition() method in the {@link BasicSliderUI}
+ * class.
+ */
+public class valueForYPosition implements Testlet
+{
+
+  /**
+   * Runs the test using the specified harness.
+   *
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    JSlider slider1 = new JSlider(JSlider.VERTICAL);
+    slider1.setBounds(10, 20, 40, 400);
+    BasicSliderUI ui1 = new BasicSliderUI(slider1);
+    slider1.setUI(ui1);
+    harness.check(ui1.valueForYPosition(0), 100);
+    harness.check(ui1.valueForYPosition(200), 50);
+    harness.check(ui1.valueForYPosition(400), 0);
+    harness.check(ui1.valueForYPosition(-50), 100);
+    harness.check(ui1.valueForYPosition(450), 0);
+  }
+}
+
Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/xPositionForValue.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/xPositionForValue.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/xPositionForValue.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/xPositionForValue.java 25 Jul 2005 08:50:39 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * Some checks for the xPositionForValue() method in the {@link BasicSliderUI}
+ * class.
+ */
+public class xPositionForValue implements Testlet
+{
+
+  /**
+   * Runs the test using the specified harness.
+   *
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    JSlider slider1 = new JSlider(JSlider.HORIZONTAL);
+    slider1.setBounds(10, 20, 400, 40);
+    MyBasicSliderUI ui1 = new MyBasicSliderUI(slider1);
+    slider1.setUI(ui1);
+    harness.check(ui1.xPositionForValue(0), 5);
+    harness.check(ui1.xPositionForValue(50), 200);
+    harness.check(ui1.xPositionForValue(100), 394);
+    harness.check(ui1.xPositionForValue(150), 394);
+    harness.check(ui1.xPositionForValue(-50), 5);
+  }
+}
+
Index: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/yPositionForValue.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/yPositionForValue.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/yPositionForValue.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicSliderUI/yPositionForValue.java 25 Jul 2005 08:50:39 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <[hidden email]>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.javax.swing.plaf.basic.BasicSliderUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JSlider;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+/**
+ * Some checks for the yPositionForValue() method in the {@link BasicSliderUI}
+ * class.
+ */
+public class yPositionForValue implements Testlet
+{
+
+  /**
+   * Runs the test using the specified harness.
+   *
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    JSlider slider1 = new JSlider(JSlider.VERTICAL);
+    slider1.setBounds(10, 20, 40, 400);
+    MyBasicSliderUI ui1 = new MyBasicSliderUI(slider1);
+    slider1.setUI(ui1);
+    harness.check(ui1.yPositionForValue(0), 394);
+    harness.check(ui1.yPositionForValue(50), 200);
+    harness.check(ui1.yPositionForValue(100), 5);
+    harness.check(ui1.yPositionForValue(150), 5);
+    harness.check(ui1.yPositionForValue(-50), 394);
+  }
+}
+