* FYI: BasicScrollBarUI tests
@ 2005-10-24 21:17 David Gilbert
0 siblings, 0 replies; 2+ messages in thread
From: David Gilbert @ 2005-10-24 21:17 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 848 bytes --]
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
[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 22495 bytes --]
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));
+ }
+
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
* FYI: BasicScrollBarUI tests
@ 2006-02-01 14:49 David Gilbert
0 siblings, 0 replies; 2+ messages in thread
From: David Gilbert @ 2006-02-01 14:49 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 992 bytes --]
These tests set a TestLookAndFeel which can interfere with other tests
that are run subsequently, so this patch cleans up by setting the
MetalLookAndFeel at the end:
2006-02-01 David Gilbert <david.gilbert@object-refinery.com>
* gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/constructor.java
(test): Set MetalLookAndFeel at end of test,
*
gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumSize.java
(test): Likewise,
*
gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumThumbSize.java
(test): Likewise,
*
gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumSize.java
(test): Likewise,
*
gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumThumbSize.java
(test): Likewise,
*
gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getPreferredSize.java
(test): Likewise,
*
gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/layoutContainer.java
(test): Likewise.
Regards,
Dave
[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 9671 bytes --]
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/constructor.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/constructor.java,v
retrieving revision 1.1
diff -u -r1.1 constructor.java
--- gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/constructor.java 24 Oct 2005 21:16:06 -0000 1.1
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/constructor.java 1 Feb 2006 14:39:44 -0000
@@ -1,6 +1,6 @@
// Tags: JDK1.2
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006 David Gilbert <david.gilbert@object-refinery.com>
// This file is part of Mauve.
@@ -32,6 +32,7 @@
import javax.swing.JScrollBar;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicScrollBarUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
/**
* Some checks for the constructor in the {@link BasicScrollBarUI} class.
@@ -78,6 +79,17 @@
ui.layoutContainer(scrollBar);
harness.check(ui.getTrackBounds(), new Rectangle(16, 0, 68, 20));
harness.check(ui.getThumbBounds(), new Rectangle(16, 0, 8, 20));
+
+ // restore a sane look and feel
+ try
+ {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
}
}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumSize.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumSize.java,v
retrieving revision 1.1
diff -u -r1.1 getMaximumSize.java
--- gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumSize.java 24 Oct 2005 21:16:06 -0000 1.1
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumSize.java 1 Feb 2006 14:39:44 -0000
@@ -1,6 +1,6 @@
// Tags: JDK1.2
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006 David Gilbert <david.gilbert@object-refinery.com>
// This file is part of Mauve.
@@ -30,6 +30,7 @@
import javax.swing.JScrollBar;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicScrollBarUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
/**
* Some checks for the getMaximumSize() method in the {@link BasicScrollBarUI}
@@ -68,6 +69,16 @@
scrollBar2.setUI(ui2);
harness.check(ui2.getMaximumSize(scrollBar2),
new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
+
+ // restore a sane look and feel
+ try
+ {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumThumbSize.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumThumbSize.java,v
retrieving revision 1.1
diff -u -r1.1 getMaximumThumbSize.java
--- gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumThumbSize.java 24 Oct 2005 21:16:06 -0000 1.1
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMaximumThumbSize.java 1 Feb 2006 14:39:44 -0000
@@ -1,6 +1,6 @@
// Tags: JDK1.2
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006 David Gilbert <david.gilbert@object-refinery.com>
// This file is part of Mauve.
@@ -30,6 +30,7 @@
import javax.swing.JScrollBar;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicScrollBarUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
/**
* Some checks for the getMaximumThumbSize() method in the
@@ -66,6 +67,16 @@
JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
scrollBar2.setUI(ui2);
harness.check(ui2.getMaximumThumbSize(), new Dimension(4096, 4096));
+
+ // restore a sane look and feel
+ try
+ {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumSize.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumSize.java,v
retrieving revision 1.1
diff -u -r1.1 getMinimumSize.java
--- gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumSize.java 24 Oct 2005 21:16:06 -0000 1.1
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumSize.java 1 Feb 2006 14:39:44 -0000
@@ -1,6 +1,6 @@
// Tags: JDK1.2
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006 David Gilbert <david.gilbert@object-refinery.com>
// This file is part of Mauve.
@@ -30,6 +30,7 @@
import javax.swing.JScrollBar;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicScrollBarUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
/**
* Some checks for the getMinimumSize() method in the {@link BasicScrollBarUI}
@@ -66,6 +67,16 @@
JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
scrollBar2.setUI(ui2);
harness.check(ui2.getMinimumSize(scrollBar2), new Dimension(16, 48));
+
+ // restore a sane look and feel
+ try
+ {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumThumbSize.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumThumbSize.java,v
retrieving revision 1.1
diff -u -r1.1 getMinimumThumbSize.java
--- gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumThumbSize.java 24 Oct 2005 21:16:06 -0000 1.1
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getMinimumThumbSize.java 1 Feb 2006 14:39:44 -0000
@@ -1,6 +1,6 @@
// Tags: JDK1.2
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006 David Gilbert <david.gilbert@object-refinery.com>
// This file is part of Mauve.
@@ -30,6 +30,7 @@
import javax.swing.JScrollBar;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicScrollBarUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
/**
* Some checks for the getMinimumThumbSize() method in the
@@ -66,6 +67,16 @@
JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
scrollBar2.setUI(ui2);
harness.check(ui2.getMinimumThumbSize(), new Dimension(8, 8));
+
+ // restore a sane look and feel
+ try
+ {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getPreferredSize.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getPreferredSize.java,v
retrieving revision 1.1
diff -u -r1.1 getPreferredSize.java
--- gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getPreferredSize.java 24 Oct 2005 21:16:06 -0000 1.1
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/getPreferredSize.java 1 Feb 2006 14:39:44 -0000
@@ -1,6 +1,6 @@
// Tags: JDK1.2
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006 David Gilbert <david.gilbert@object-refinery.com>
// This file is part of Mauve.
@@ -30,6 +30,7 @@
import javax.swing.JScrollBar;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicScrollBarUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
/**
* Some checks for the getPreferredSize() method in the {@link BasicScrollBarUI}
@@ -66,6 +67,16 @@
JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
scrollBar2.setUI(ui2);
harness.check(ui2.getPreferredSize(scrollBar2), new Dimension(16, 48));
+
+ // restore a sane look and feel
+ try
+ {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
}
Index: gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/layoutContainer.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/layoutContainer.java,v
retrieving revision 1.1
diff -u -r1.1 layoutContainer.java
--- gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/layoutContainer.java 24 Oct 2005 21:16:06 -0000 1.1
+++ gnu/testlet/javax/swing/plaf/basic/BasicScrollBarUI/layoutContainer.java 1 Feb 2006 14:39:44 -0000
@@ -1,6 +1,6 @@
// Tags: JDK1.2
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006 David Gilbert <david.gilbert@object-refinery.com>
// This file is part of Mauve.
@@ -30,6 +30,7 @@
import javax.swing.JScrollBar;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicScrollBarUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
/**
* Some checks for the layoutContainer() method in the
@@ -56,6 +57,17 @@
}
testHorizontal(harness);
testVertical(harness);
+
+ // restore a sane look and feel
+ try
+ {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
}
public void testHorizontal(TestHarness harness)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-01 14:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-24 21:17 FYI: BasicScrollBarUI tests David Gilbert
2006-02-01 14:49 David Gilbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).