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: JRootPane tests


Here comes some tests for the JRootPane.RootLayout layout manager.

2005-11-08  Roman Kennke  <kennke@aicas.com>

        *
gnu/testlet/javax/swing/JRootPane/RootLayout/getLayoutAlignmentX.java:  
     New test.
        *
gnu/testlet/javax/swing/JRootPane/RootLayout/getLayoutAlignmentY.java:  
     New test.
        *
gnu/testlet/javax/swing/JRootPane/RootLayout/layoutContainer.java:
        New test.

/Roman
Index: gnu/testlet/javax/swing/JRootPane/RootLayout/getLayoutAlignmentX.java
===================================================================
RCS file: gnu/testlet/javax/swing/JRootPane/RootLayout/getLayoutAlignmentX.java
diff -N gnu/testlet/javax/swing/JRootPane/RootLayout/getLayoutAlignmentX.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JRootPane/RootLayout/getLayoutAlignmentX.java	8 Nov 2005 13:57:59 -0000
@@ -0,0 +1,60 @@
+// Tags: JDK1.2
+
+//Copyright (C) 2005 Roman Kennke <kennke@aicas.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, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.javax.swing.JRootPane.RootLayout;
+
+import java.awt.LayoutManager2;
+
+import javax.swing.JComponent;
+import javax.swing.JRootPane;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class getLayoutAlignmentX implements Testlet
+{
+
+  public void test(TestHarness harness)
+  {
+    JRootPane rp = new JRootPane();
+    LayoutManager2 lm2 = (LayoutManager2) rp.getLayout();
+
+    // Check for the value when nothing is touched.
+    harness.check(lm2.getLayoutAlignmentX(rp), 0.0F);
+
+    // Setting the root pane's alignmentX doesn't change anything.
+    rp.setAlignmentX(0.5F);
+    harness.check(lm2.getLayoutAlignmentX(rp), 0.0F);
+
+    // Setting the content pane's alignmentX doesn't change anything.
+    ((JComponent) rp.getContentPane()).setAlignmentX(0.5F);
+    harness.check(lm2.getLayoutAlignmentX(rp), 0.0F);
+
+    // Setting the glass pane's alignmentX doesn't change anything.
+    ((JComponent) rp.getGlassPane()).setAlignmentX(0.5F);
+    harness.check(lm2.getLayoutAlignmentX(rp), 0.0F);
+
+    // Setting the layered pane's alignmentX doesn't change anything.
+    ((JComponent) rp.getLayeredPane()).setAlignmentX(0.5F);
+    harness.check(lm2.getLayoutAlignmentX(rp), 0.0F);
+  }
+
+}
Index: gnu/testlet/javax/swing/JRootPane/RootLayout/getLayoutAlignmentY.java
===================================================================
RCS file: gnu/testlet/javax/swing/JRootPane/RootLayout/getLayoutAlignmentY.java
diff -N gnu/testlet/javax/swing/JRootPane/RootLayout/getLayoutAlignmentY.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JRootPane/RootLayout/getLayoutAlignmentY.java	8 Nov 2005 13:57:59 -0000
@@ -0,0 +1,60 @@
+// Tags: JDK1.2
+
+//Copyright (C) 2005 Roman Kennke <kennke@aicas.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, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.javax.swing.JRootPane.RootLayout;
+
+import java.awt.LayoutManager2;
+
+import javax.swing.JComponent;
+import javax.swing.JRootPane;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class getLayoutAlignmentY implements Testlet
+{
+
+  public void test(TestHarness harness)
+  {
+    JRootPane rp = new JRootPane();
+    LayoutManager2 lm2 = (LayoutManager2) rp.getLayout();
+
+    // Check for the value when nothing is touched.
+    harness.check(lm2.getLayoutAlignmentY(rp), 0.0F);
+
+    // Setting the root pane's alignmentY doesn't change anything.
+    rp.setAlignmentY(0.5F);
+    harness.check(lm2.getLayoutAlignmentY(rp), 0.0F);
+
+    // Setting the content pane's alignmentY doesn't change anything.
+    ((JComponent) rp.getContentPane()).setAlignmentY(0.5F);
+    harness.check(lm2.getLayoutAlignmentY(rp), 0.0F);
+
+    // Setting the glass pane's alignmentY doesn't change anything.
+    ((JComponent) rp.getGlassPane()).setAlignmentY(0.5F);
+    harness.check(lm2.getLayoutAlignmentY(rp), 0.0F);
+
+    // Setting the layered pane's alignmentY doesn't change anything.
+    ((JComponent) rp.getLayeredPane()).setAlignmentY(0.5F);
+    harness.check(lm2.getLayoutAlignmentY(rp), 0.0F);
+  }
+
+}
Index: gnu/testlet/javax/swing/JRootPane/RootLayout/layoutContainer.java
===================================================================
RCS file: gnu/testlet/javax/swing/JRootPane/RootLayout/layoutContainer.java
diff -N gnu/testlet/javax/swing/JRootPane/RootLayout/layoutContainer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JRootPane/RootLayout/layoutContainer.java	8 Nov 2005 13:57:59 -0000
@@ -0,0 +1,89 @@
+// Tags: JDK1.2
+
+//Copyright (C) 2005 Roman Kennke <kennke@aicas.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, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.javax.swing.JRootPane.RootLayout;
+
+import java.awt.Component;
+import java.awt.Insets;
+import java.awt.Rectangle;
+
+import javax.swing.BorderFactory;
+import javax.swing.JRootPane;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+/**
+ * Checks the functionality of the JRootPane.RootLayout.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class layoutContainer implements Testlet
+{
+
+  // TODO: Implement a test that checks the layout in case we have a menubar
+  // installed.
+
+  /**
+   * Starts the test run.
+   *
+   * @param harness the test harness to use
+   */
+  public void test(TestHarness harness)
+  {
+    testWithBorder(harness);
+  }
+
+  /**
+   * Tests if the RootLayout works correctly when a border is set on the
+   * rootpane.
+   *
+   * @param harness
+   */
+  private void testWithBorder(TestHarness harness)
+  {
+    harness.checkPoint("withBorder");
+    JRootPane rp = new JRootPane();
+    rp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+    rp.setSize(100, 100);
+    rp.getLayout().layoutContainer(rp);
+    Insets i = rp.getInsets();
+
+    // Check the glass pane.
+    Component gp = rp.getGlassPane();
+    harness.check(gp.getBounds(),
+                  new Rectangle(i.left, i.right,
+                                rp.getWidth() - i.left - i.right,
+                                rp.getHeight() - i.top - i.bottom));
+    // Check the layered pane.
+    Component lp = rp.getLayeredPane();
+    harness.check(lp.getBounds(),
+                  new Rectangle(i.left, i.right,
+                                rp.getWidth() - i.left - i.right,
+                                rp.getHeight() - i.top - i.bottom));
+
+    // Check the content pane.
+    Component cp = rp.getContentPane();
+    harness.check(cp.getBounds(),
+                  new Rectangle(0, 0, rp.getWidth() - i.left - i.right,
+                                rp.getHeight() - i.top - i.bottom));
+  }
+}

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