This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: BasicScrollBarUI tests


I committed these tests:

2005-10-24 David Gilbert <david.gilbert@object-refinery.com>

* gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/constructor.java: New file,
* gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumSize.java: New file,
* gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumThumbSize.java: New file,
* gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumSize.java: New file,
* gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumThumbSize.java: New file,
* gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getPreferredSize.java: New file,
* gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/layoutContainer.java: New file,
* gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/MyBasicScrollBarUI.java: New file.


Regards,

Dave
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/MyBasicScrollBarUI.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/MyBasicScrollBarUI.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/MyBasicScrollBarUI.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/MyBasicScrollBarUI.java	24 Oct 2005 21:12:11 -0000
@@ -0,0 +1,54 @@
+// Tags: not-a-test
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// 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, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.plaf.basic.BasicScrollBarUI;
+
+import java.awt.Dimension;
+import java.awt.Rectangle;
+
+import javax.swing.plaf.basic.BasicScrollBarUI;
+
+/**
+ * Provides access to protected fields and methods.
+ */
+public class MyBasicScrollBarUI extends BasicScrollBarUI 
+{
+  public Dimension getMinimumThumbSize()
+  {
+    return super.getMinimumThumbSize();
+  }
+  
+  public Dimension getMaximumThumbSize() 
+  {
+    return super.getMaximumThumbSize();
+  }
+  
+  public Rectangle getTrackBounds() 
+  {
+    return super.getTrackBounds();
+  }
+  
+  public Rectangle getThumbBounds()
+  {
+    return super.getThumbBounds();
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/constructor.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/constructor.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/constructor.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/constructor.java	24 Oct 2005 21:12:11 -0000
@@ -0,0 +1,83 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// 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, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.plaf.basic.BasicScrollBarUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+import gnu.testlet.javax.swing.plaf.TestLookAndFeel;
+
+import java.awt.BorderLayout;
+import java.awt.Rectangle;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollBar;
+import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicScrollBarUI;
+
+/**
+ * Some checks for the constructor in the {@link BasicScrollBarUI} class.  
+ */
+public class constructor implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)  
+  {
+    // use a known look and feel
+    try
+    {
+      UIManager.setLookAndFeel(new TestLookAndFeel());
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
+    harness.check(ui.getTrackBounds(), null);
+    harness.check(ui.getThumbBounds(), null);
+    
+    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
+    scrollBar.setUI(ui);
+    harness.check(ui.getTrackBounds(), new Rectangle(0, 0, 0, 0));
+    harness.check(ui.getThumbBounds(), new Rectangle(0, 0, 0, 0));
+    
+    scrollBar.setBounds(0, 0, 100, 20);
+    harness.check(ui.getTrackBounds(), new Rectangle(0, 0, 0, 0));
+    harness.check(ui.getThumbBounds(), new Rectangle(0, 0, 0, 0));
+    
+    JPanel panel = new JPanel(new BorderLayout());
+    panel.setSize(100, 20);
+    panel.add(scrollBar);
+    panel.doLayout();
+    harness.check(ui.getTrackBounds(), new Rectangle(0, 0, 0, 0));
+    harness.check(ui.getThumbBounds(), new Rectangle(0, 0, 0, 0));
+    
+    ui.layoutContainer(scrollBar);
+    harness.check(ui.getTrackBounds(), new Rectangle(16, 0, 68, 20));    
+    harness.check(ui.getThumbBounds(), new Rectangle(16, 0, 8, 20));
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumSize.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumSize.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumSize.java	24 Oct 2005 21:12:11 -0000
@@ -0,0 +1,73 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// 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, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.plaf.basic.BasicScrollBarUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+import gnu.testlet.javax.swing.plaf.TestLookAndFeel;
+
+import java.awt.Dimension;
+
+import javax.swing.JScrollBar;
+import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicScrollBarUI;
+
+/**
+ * Some checks for the getMaximumSize() method in the {@link BasicScrollBarUI} 
+ * 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)  
+  {
+    // use a known look and feel
+    try
+    {
+      UIManager.setLookAndFeel(new TestLookAndFeel());
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+
+    // test horizontal scroll bar
+    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
+    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
+    scrollBar.setUI(ui);
+    harness.check(ui.getMaximumSize(scrollBar), 
+            new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
+  
+    // test vertical scroll bar
+    MyBasicScrollBarUI ui2 = new MyBasicScrollBarUI();
+    JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
+    scrollBar2.setUI(ui2);
+    harness.check(ui2.getMaximumSize(scrollBar2), 
+            new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumThumbSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumThumbSize.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumThumbSize.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumThumbSize.java	24 Oct 2005 21:12:11 -0000
@@ -0,0 +1,71 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// 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, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.plaf.basic.BasicScrollBarUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+import gnu.testlet.javax.swing.plaf.TestLookAndFeel;
+
+import java.awt.Dimension;
+
+import javax.swing.JScrollBar;
+import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicScrollBarUI;
+
+/**
+ * Some checks for the getMaximumThumbSize() method in the 
+ * {@link BasicScrollBarUI} class.  
+ */
+public class getMaximumThumbSize implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)  
+  {
+    // use a known look and feel
+    try
+    {
+      UIManager.setLookAndFeel(new TestLookAndFeel());
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+
+    // test horizontal scroll bar
+    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
+    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
+    scrollBar.setUI(ui);
+    harness.check(ui.getMaximumThumbSize(), new Dimension(4096, 4096));
+  
+    // test vertical scroll bar
+    MyBasicScrollBarUI ui2 = new MyBasicScrollBarUI();
+    JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
+    scrollBar2.setUI(ui2);
+    harness.check(ui2.getMaximumThumbSize(), new Dimension(4096, 4096));
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumSize.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumSize.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumSize.java	24 Oct 2005 21:12:11 -0000
@@ -0,0 +1,71 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// 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, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.plaf.basic.BasicScrollBarUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+import gnu.testlet.javax.swing.plaf.TestLookAndFeel;
+
+import java.awt.Dimension;
+
+import javax.swing.JScrollBar;
+import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicScrollBarUI;
+
+/**
+ * Some checks for the getMinimumSize() method in the {@link BasicScrollBarUI} 
+ * 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)  
+  {
+    // use a known look and feel
+    try
+    {
+      UIManager.setLookAndFeel(new TestLookAndFeel());
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+
+    // test horizontal scroll bar
+    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
+    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
+    scrollBar.setUI(ui);
+    harness.check(ui.getMinimumSize(scrollBar), new Dimension(48, 16));
+  
+    // test vertical scroll bar
+    MyBasicScrollBarUI ui2 = new MyBasicScrollBarUI();
+    JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
+    scrollBar2.setUI(ui2);
+    harness.check(ui2.getMinimumSize(scrollBar2), new Dimension(16, 48));
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumThumbSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumThumbSize.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumThumbSize.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumThumbSize.java	24 Oct 2005 21:12:11 -0000
@@ -0,0 +1,71 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// 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, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.plaf.basic.BasicScrollBarUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+import gnu.testlet.javax.swing.plaf.TestLookAndFeel;
+
+import java.awt.Dimension;
+
+import javax.swing.JScrollBar;
+import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicScrollBarUI;
+
+/**
+ * Some checks for the getMinimumThumbSize() method in the 
+ * {@link BasicScrollBarUI} class.  
+ */
+public class getMinimumThumbSize implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)  
+  {
+    // use a known look and feel
+    try
+    {
+      UIManager.setLookAndFeel(new TestLookAndFeel());
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+
+    // test horizontal scroll bar
+    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
+    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
+    scrollBar.setUI(ui);
+    harness.check(ui.getMinimumThumbSize(), new Dimension(8, 8));
+  
+    // test vertical scroll bar
+    MyBasicScrollBarUI ui2 = new MyBasicScrollBarUI();
+    JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
+    scrollBar2.setUI(ui2);
+    harness.check(ui2.getMinimumThumbSize(), new Dimension(8, 8));
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getPreferredSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getPreferredSize.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getPreferredSize.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getPreferredSize.java	24 Oct 2005 21:12:11 -0000
@@ -0,0 +1,71 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// 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, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.plaf.basic.BasicScrollBarUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+import gnu.testlet.javax.swing.plaf.TestLookAndFeel;
+
+import java.awt.Dimension;
+
+import javax.swing.JScrollBar;
+import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicScrollBarUI;
+
+/**
+ * Some checks for the getPreferredSize() method in the {@link BasicScrollBarUI} 
+ * 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)  
+  {
+    // use a known look and feel
+    try
+    {
+      UIManager.setLookAndFeel(new TestLookAndFeel());
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+
+    // test horizontal scroll bar
+    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
+    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
+    scrollBar.setUI(ui);
+    harness.check(ui.getPreferredSize(scrollBar), new Dimension(48, 16));
+  
+    // test vertical scroll bar
+    MyBasicScrollBarUI ui2 = new MyBasicScrollBarUI();
+    JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
+    scrollBar2.setUI(ui2);
+    harness.check(ui2.getPreferredSize(scrollBar2), new Dimension(16, 48));
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/layoutContainer.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/layoutContainer.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/layoutContainer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/layoutContainer.java	24 Oct 2005 21:12:12 -0000
@@ -0,0 +1,93 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// 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, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.plaf.basic.BasicScrollBarUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+import gnu.testlet.javax.swing.plaf.TestLookAndFeel;
+
+import java.awt.Rectangle;
+
+import javax.swing.JScrollBar;
+import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicScrollBarUI;
+
+/**
+ * Some checks for the layoutContainer() method in the 
+ * {@link BasicScrollBarUI} class.  
+ */
+public class layoutContainer implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)  
+  {
+    // use a known look and feel
+    try
+    {
+      UIManager.setLookAndFeel(new TestLookAndFeel());
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+    testHorizontal(harness);
+    testVertical(harness);
+  }
+  
+  public void testHorizontal(TestHarness harness)  
+  {
+    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
+        JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
+    scrollBar.setUI(ui);
+    scrollBar.setBounds(0, 0, 100, 20);
+    ui.layoutContainer(scrollBar);
+    harness.check(ui.getTrackBounds(), new Rectangle(16, 0, 68, 20));    
+    harness.check(ui.getThumbBounds(), new Rectangle(16, 0, 8, 20));
+    
+    scrollBar.setBounds(40, 50, 250, 37);
+    ui.layoutContainer(scrollBar);
+    harness.check(ui.getTrackBounds(), new Rectangle(16, 0, 218, 37));    
+    harness.check(ui.getThumbBounds(), new Rectangle(16, 0, 21, 37));
+  }
+
+  public void testVertical(TestHarness harness)  
+  {
+    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
+        JScrollBar scrollBar = new JScrollBar(JScrollBar.VERTICAL);
+    scrollBar.setUI(ui);
+    scrollBar.setBounds(0, 0, 20, 100);
+    ui.layoutContainer(scrollBar);
+    harness.check(ui.getTrackBounds(), new Rectangle(0, 16, 20, 68));    
+    harness.check(ui.getThumbBounds(), new Rectangle(0, 16, 20, 8));
+    
+    scrollBar.setBounds(40, 50, 37, 250);
+    ui.layoutContainer(scrollBar);
+    harness.check(ui.getTrackBounds(), new Rectangle(0, 16, 37, 218));    
+    harness.check(ui.getThumbBounds(), new Rectangle(0, 16, 37, 21));
+  }
+
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]