From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5927 invoked by alias); 15 Feb 2006 15:13:51 -0000 Received: (qmail 5909 invoked by uid 22791); 15 Feb 2006 15:13:50 -0000 X-Spam-Check-By: sourceware.org Received: from outmail128143.authsmtp.co.uk (HELO outmail128143.authsmtp.co.uk) (62.13.128.143) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 15 Feb 2006 15:13:48 +0000 Received: from [10.10.20.36] (host217-37-65-246.in-addr.btopenworld.com [217.37.65.246]) (authenticated bits=0) by squirrel.dmpriest.net.uk (8.13.3/8.13.3/Kp) with ESMTP id k1FFDirR001326 for ; Wed, 15 Feb 2006 15:13:44 GMT (envelope-from david.gilbert@object-refinery.com) Message-ID: <43F34662.3080308@object-refinery.com> Date: Wed, 15 Feb 2006 15:13:00 -0000 From: David Gilbert User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051026) MIME-Version: 1.0 To: mauve-patches@sources.redhat.com Subject: FYI: JSpinner.NumberEditor - new tests Content-Type: multipart/mixed; boundary="------------080209000107090608090404" X-Server-Quench: a8381ce5-9e35-11da-84c5-001185d377ca X-Authentic-SMTP: 61633132333134.squirrel.dmpriest.net.uk:1.47/Kp X-Powered-By: AuthSMTP - http://www.authsmtp.com - Authenticated SMTP Mail Relay X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-IsSubscribed: yes Mailing-List: contact mauve-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-patches-owner@sourceware.org X-SW-Source: 2006/txt/msg00146.txt.bz2 This is a multi-part message in MIME format. --------------080209000107090608090404 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 356 I committed the following new tests: 2006-02-15 David Gilbert * gnu/testlet/javax/swing/JSpinner/NumberEditor/constructors.java: New test, * gnu/testlet/javax/swing/JSpinner/NumberEditor/getFormat.java: Likewise, * gnu/testlet/javax/swing/JSpinner/NumberEditor/getModel.java: Likewise. Regards, Dave --------------080209000107090608090404 Content-Type: text/plain; name="diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff.txt" Content-length: 7647 Index: gnu/testlet/javax/swing/JSpinner/NumberEditor/constructors.java =================================================================== RCS file: gnu/testlet/javax/swing/JSpinner/NumberEditor/constructors.java diff -N gnu/testlet/javax/swing/JSpinner/NumberEditor/constructors.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/javax/swing/JSpinner/NumberEditor/constructors.java 15 Feb 2006 15:09:33 -0000 @@ -0,0 +1,112 @@ +/* constructors.java -- Checks for the constructors in the NumberEditor class. + Copyright (C) 2006 David Gilbert +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. + +*/ + +// Tags: JDK1.4 + +package gnu.testlet.javax.swing.JSpinner.NumberEditor; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +import java.text.DecimalFormat; +import java.text.NumberFormat; + +import javax.swing.JFormattedTextField; +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; +import javax.swing.text.NumberFormatter; + +public class constructors implements Testlet +{ + public void test(TestHarness harness) + { + testConstructor1(harness); + testConstructor2(harness); + } + + public void testConstructor1(TestHarness harness) + { + harness.checkPoint("(JSpinner)"); + JSpinner s = new JSpinner(); + JSpinner.NumberEditor e = new JSpinner.NumberEditor(s); + harness.check(e.getLayout(), e); + harness.check(e.getFormat(), NumberFormat.getInstance()); + JFormattedTextField ftf = e.getTextField(); + NumberFormatter nf = (NumberFormatter) ftf.getFormatter(); + harness.check(nf.getMinimum(), null); + harness.check(nf.getMaximum(), null); + + SpinnerNumberModel m = new SpinnerNumberModel(50.0, 0.0, 100.0, 5.0); + s = new JSpinner(m); + e = new JSpinner.NumberEditor(s); + harness.check(e.getFormat(), NumberFormat.getInstance()); + ftf = e.getTextField(); + nf = (NumberFormatter) ftf.getFormatter(); + harness.check(nf.getMinimum(), new Double(0.0)); + harness.check(nf.getMaximum(), new Double(100.0)); + + // try null argument + boolean pass = false; + try + { + e = new JSpinner.NumberEditor(null); + } + catch (NullPointerException npe) + { + pass = true; + } + harness.check(pass); + } + + public void testConstructor2(TestHarness harness) + { + harness.checkPoint("(JSpinner, String)"); + JSpinner s = new JSpinner(); + JSpinner.NumberEditor e = new JSpinner.NumberEditor(s, "0.00"); + harness.check(e.getLayout(), e); + harness.check(e.getFormat(), new DecimalFormat("0.00")); + + // try null spinner argument + boolean pass = false; + try + { + e = new JSpinner.NumberEditor(null, "0.00"); + } + catch (NullPointerException npe) + { + pass = true; + } + harness.check(pass); + + // try null format argument + pass = false; + try + { + e = new JSpinner.NumberEditor(s, null); + } + catch (NullPointerException npe) + { + pass = true; + } + harness.check(pass); + } + +} Index: gnu/testlet/javax/swing/JSpinner/NumberEditor/getFormat.java =================================================================== RCS file: gnu/testlet/javax/swing/JSpinner/NumberEditor/getFormat.java diff -N gnu/testlet/javax/swing/JSpinner/NumberEditor/getFormat.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/javax/swing/JSpinner/NumberEditor/getFormat.java 15 Feb 2006 15:09:33 -0000 @@ -0,0 +1,47 @@ +/* getFormat.java -- Checks for the getFormat() method in the NumberEditor + class. + Copyright (C) 2006 David Gilbert +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. + +*/ + +// Tags: JDK1.4 + +package gnu.testlet.javax.swing.JSpinner.NumberEditor; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +import java.text.NumberFormat; + +import javax.swing.JSpinner; +import javax.swing.text.DefaultFormatterFactory; + +public class getFormat implements Testlet +{ + public void test(TestHarness harness) + { + harness.checkPoint("()"); + JSpinner s = new JSpinner(); + JSpinner.NumberEditor e = new JSpinner.NumberEditor(s); + harness.check(e.getTextField().getFormatterFactory() + instanceof DefaultFormatterFactory); + harness.check(e.getFormat(), NumberFormat.getInstance()); + } + +} Index: gnu/testlet/javax/swing/JSpinner/NumberEditor/getModel.java =================================================================== RCS file: gnu/testlet/javax/swing/JSpinner/NumberEditor/getModel.java diff -N gnu/testlet/javax/swing/JSpinner/NumberEditor/getModel.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/javax/swing/JSpinner/NumberEditor/getModel.java 15 Feb 2006 15:09:34 -0000 @@ -0,0 +1,44 @@ +/* getModel.java -- Checks for the getModel() method in the + JSpinner.NumberEditor class. + Copyright (C) 2006 David Gilbert +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. + +*/ + +// Tags: JDK1.4 + +package gnu.testlet.javax.swing.JSpinner.NumberEditor; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; + +public class getModel implements Testlet +{ + + public void test(TestHarness harness) + { + harness.checkPoint("()"); + SpinnerNumberModel m = new SpinnerNumberModel(50.0, 0.0, 100.0, 5.0); + JSpinner s = new JSpinner(m); + JSpinner.NumberEditor editor = (JSpinner.NumberEditor) s.getEditor(); + harness.check(editor.getModel(), m); + } +} --------------080209000107090608090404--