From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30996 invoked by alias); 26 Jun 2006 15:21:09 -0000 Received: (qmail 30983 invoked by uid 22791); 26 Jun 2006 15:21:06 -0000 X-Spam-Check-By: sourceware.org Received: from outmail128142.authsmtp.net (HELO outmail128142.authsmtp.net) (62.13.128.142) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 26 Jun 2006 15:21:03 +0000 Received: from [192.168.1.32] (host217-37-65-246.in-addr.btopenworld.com [217.37.65.246]) (authenticated bits=0) by squirrel.dmpriest.net.uk (8.13.6/8.13.6/Kp) with ESMTP id k5QFKwvU074081 for ; Mon, 26 Jun 2006 16:20:58 +0100 (BST) Message-ID: <449FFB75.3040100@object-refinery.com> Date: Mon, 26 Jun 2006 15:21:00 -0000 From: David Gilbert User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060502) MIME-Version: 1.0 To: mauve-patches Subject: JList setValueIsAdjusting() and setVisibleRowCount() tests Content-Type: multipart/mixed; boundary="------------020405080200060100080804" X-Server-Quench: 5efcaf2b-0527-11db-b770-001185d377ca X-AuthRoute: OCdyYgsUB1ZZRRob BmULDStKRB85DhpG AxIIMU5ALVQIUwlL IwBRKV9FNVQBW1wc QzdPCAwBEy0yBiY3 OF8Sc0cINhIfGxs5 DxUHQFRNbkA2Hh4B BhgOUx94dQVMfXc+ Z0dlQHNcQkJ/a0R5 RFFWEHIGKzxlCRZk FwY9dwRQcAtLMBhE alExUSZbMjRRZCh9 R1JpYHVoZDlVbS4K HVlIdQpLGBZWEmVj GBsLCxcLHFYZDz4+ MyIvLkMRPV04Pkcv KkcgX11YclcbDAEW BExRPi5CJlMFShAs EihdQEgCUHwVXSpH HgZA X-Authentic-SMTP: 61633132333134.squirrel.dmpriest.net.uk:1.55/Kp 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/msg00473.txt.bz2 This is a multi-part message in MIME format. --------------020405080200060100080804 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 275 This patch (committed) adds a couple of new tests: 2006-06-26 David Gilbert * gnu/testlet/javax/swing/JList/setValueIsAdjusting.java: New test, * gnu/testlet/javax/swing/JList/setVisibleRowCount.java: New test. Regards, Dave --------------020405080200060100080804 Content-Type: text/plain; name="diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff.txt" Content-length: 5994 Index: gnu/testlet/javax/swing/JList/setValueIsAdjusting.java =================================================================== RCS file: gnu/testlet/javax/swing/JList/setValueIsAdjusting.java diff -N gnu/testlet/javax/swing/JList/setValueIsAdjusting.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/javax/swing/JList/setValueIsAdjusting.java 26 Jun 2006 15:17:06 -0000 @@ -0,0 +1,68 @@ +/* setValueIsAdjusting.java -- some checks for the setValueIsAdjusting() method + in the JList 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.JList; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.List; + +import javax.swing.JList; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +public class setValueIsAdjusting + implements Testlet, PropertyChangeListener, ListSelectionListener +{ + List events = new java.util.ArrayList(); + + public void valueChanged(ListSelectionEvent e) + { + events.add(e); + } + + public void propertyChange(PropertyChangeEvent e) + { + events.add(e); + } + + public void test(TestHarness harness) + { + JList list = new JList(); + list.addListSelectionListener(this); + harness.check(list.getValueIsAdjusting(), false); + harness.check(list.getSelectionModel().getValueIsAdjusting(), false); + list.setValueIsAdjusting(true); + harness.check(list.getValueIsAdjusting(), true); + harness.check(list.getSelectionModel().getValueIsAdjusting(), true); + harness.check(events.size(), 0); + + list.getSelectionModel().setValueIsAdjusting(false); + harness.check(list.getValueIsAdjusting(), false); + } + +} Index: gnu/testlet/javax/swing/JList/setVisibleRowCount.java =================================================================== RCS file: gnu/testlet/javax/swing/JList/setVisibleRowCount.java diff -N gnu/testlet/javax/swing/JList/setVisibleRowCount.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/javax/swing/JList/setVisibleRowCount.java 26 Jun 2006 15:17:06 -0000 @@ -0,0 +1,88 @@ +/* setVisibleRowCount.java -- some checks for the setVisibleRowCount() method + in the JList 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.2 + +package gnu.testlet.javax.swing.JList; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.List; + +import javax.swing.JList; + +public class setVisibleRowCount implements Testlet, PropertyChangeListener +{ + List events = new java.util.ArrayList(); + + public void propertyChange(PropertyChangeEvent e) + { + events.add(e); + } + + public void test(TestHarness harness) + { + JList list = new JList(); + harness.check(list.getVisibleRowCount(), 8); + list.addPropertyChangeListener(this); + list.setVisibleRowCount(13); + harness.check(list.getVisibleRowCount(), 13); + harness.check(events.size(), 1); + PropertyChangeEvent e0 = (PropertyChangeEvent) events.get(0); + harness.check(e0.getSource(), list); + harness.check(e0.getPropertyName(), "visibleRowCount"); + harness.check(e0.getOldValue(), new Integer(8)); + harness.check(e0.getNewValue(), new Integer(13)); + + // setting the same value generates no event + events.clear(); + list.setVisibleRowCount(13); + harness.check(events.size(), 0); + + // try zero + list.setVisibleRowCount(0); + harness.check(list.getVisibleRowCount(), 0); + + // try a negative value + events.clear(); + list.setVisibleRowCount(-1); + harness.check(list.getVisibleRowCount(), 0); + harness.check(events.size(), 1); + e0 = (PropertyChangeEvent) events.get(0); + harness.check(e0.getSource(), list); + harness.check(e0.getPropertyName(), "visibleRowCount"); + harness.check(e0.getOldValue(), new Integer(0)); + harness.check(e0.getNewValue(), new Integer(-1)); + + events.clear(); + list.setVisibleRowCount(-99); + harness.check(list.getVisibleRowCount(), 0); + e0 = (PropertyChangeEvent) events.get(0); + harness.check(e0.getSource(), list); + harness.check(e0.getPropertyName(), "visibleRowCount"); + harness.check(e0.getOldValue(), new Integer(0)); + harness.check(e0.getNewValue(), new Integer(-99)); + } +} --------------020405080200060100080804--