From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16992 invoked by alias); 12 Jun 2006 19:50:21 -0000 Received: (qmail 16848 invoked by uid 22791); 12 Jun 2006 19:50:20 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 12 Jun 2006 19:50:17 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k5CJoFAU013126 for ; Mon, 12 Jun 2006 15:50:15 -0400 Received: from pobox.toronto.redhat.com (pobox.toronto.redhat.com [172.16.14.4]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k5CJoFMD006009 for ; Mon, 12 Jun 2006 15:50:15 -0400 Received: from to-fcjpp2.toronto.redhat.com (toycar.toronto.redhat.com [172.16.14.97]) by pobox.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id k5CJoFve015872 for ; Mon, 12 Jun 2006 15:50:15 -0400 Subject: FYI: Combo box mouseclicks From: Francis Kung To: mauve-patches Content-Type: multipart/mixed; boundary="=-mAsMDVMFlioLMNZTSsMx" Date: Mon, 12 Jun 2006 19:50:00 -0000 Message-Id: <1150141814.2486.6.camel@to-fcjpp2.toronto.redhat.com> Mime-Version: 1.0 X-Mailer: Evolution 2.6.2 (2.6.2-1.fc5.5) 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/msg00394.txt.bz2 --=-mAsMDVMFlioLMNZTSsMx Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 351 Thanks to Lillian and Tom for pointing me to the Robot class; new mauve test (committed) for the JComboBox mouseclick patch I submitted earlier on the classpath list. Francis 2006-06-12 Francis Kung * gnu/testlet/javax/swing/JComboBox/basic.java: (test): added new test (testTogglingVisibility): new test for mouse clicks --=-mAsMDVMFlioLMNZTSsMx Content-Disposition: attachment; filename=mauve-JComboBox.diff Content-Type: text/x-patch; name=mauve-JComboBox.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 2671 Index: gnu/testlet/javax/swing/JComboBox/basic.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/JComboBox/basic.java,v retrieving revision 1.1 diff -u -r1.1 basic.java --- gnu/testlet/javax/swing/JComboBox/basic.java 23 Feb 2005 10:59:05 -0000 1.1 +++ gnu/testlet/javax/swing/JComboBox/basic.java 12 Jun 2006 19:35:33 -0000 @@ -24,12 +24,18 @@ import gnu.testlet.TestHarness; import gnu.testlet.Testlet; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Robot; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.InputEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.plaf.basic.BasicComboBoxUI; /** * The the basic JComboBox features (including listeners). @@ -52,6 +58,8 @@ testItemRemoving(harness, box); testAddingItems(harness, box); + + testTogglingVisibility(harness); } private void testAddingItems(TestHarness harness, JComboBox box) { @@ -161,6 +169,51 @@ command = UNASSIGNED; } + private void testTogglingVisibility(TestHarness harness) + { + JFrame frame = new JFrame(); + frame.setSize(200, 100); + Container contentPane = frame.getContentPane(); + + JComboBox box = new JComboBox(); + box.addItem("123"); + box.addItem("aaa"); + box.addItem("abc"); + + contentPane.add(box, BorderLayout.SOUTH); + frame.show(); + + // A new box should not be visible + harness.check(box.isPopupVisible() == false); + + // Prepare robot to perform mouse click; position in middle of box + Robot r = harness.createRobot (); + r.waitForIdle (); + r.delay (100); + r.mouseMove(box.getLocationOnScreen().x + (box.getSize().width / 2), + box.getLocationOnScreen().y + (box.getSize().height / 2)); + + // Simulate user click on button; popup should now be visible + r.waitForIdle (); + r.delay (100); + r.mousePress(InputEvent.BUTTON1_MASK); + r.mouseRelease(InputEvent.BUTTON1_MASK); + + r.waitForIdle (); + r.delay (100); + harness.check(box.isPopupVisible()); + + // Click it again - this should toggle the popup and make it invisible + r.waitForIdle (); + r.delay (100); + r.mousePress(InputEvent.BUTTON1_MASK); + r.mouseRelease(InputEvent.BUTTON1_MASK); + + r.waitForIdle (); + r.delay (100); + harness.check(box.isPopupVisible() == false); + } + public void actionPerformed(ActionEvent e) { command = e.getActionCommand(); --=-mAsMDVMFlioLMNZTSsMx--