* FYI: Added a new test for JTextField
@ 2006-11-01 14:33 Tania Bento
2006-11-01 14:35 ` Tania Bento
0 siblings, 1 reply; 2+ messages in thread
From: Tania Bento @ 2006-11-01 14:33 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 227 bytes --]
Hey,
This adds one other test for
javax.swing.JTextField.fireActionPerformed().
2006-10-31 Tania Bento <tbento@redhat.com>
* gnu/testlet/javax/swing/JTextField/fireActionPerfomed: Added a
new test.
Cheers,
Tania
[-- Attachment #2: patch.diff --]
[-- Type: text/x-patch, Size: 2475 bytes --]
Index: gnu/testlet/javax/swing/JTextField/fireActionPerformed.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/JTextField/fireActionPerformed.java,v
retrieving revision 1.2
diff -u -r1.2 fireActionPerformed.java
--- gnu/testlet/javax/swing/JTextField/fireActionPerformed.java 31 Oct 2006 19:53:17 -0000 1.2
+++ gnu/testlet/javax/swing/JTextField/fireActionPerformed.java 1 Nov 2006 14:32:05 -0000
@@ -44,7 +44,7 @@
JTextField text;
Robot robot;
- protected void setUp(final TestHarness harness) throws Exception
+ protected void setUp1(final TestHarness harness) throws Exception
{
text = new JTextField();
text.setActionCommand(null);
@@ -66,6 +66,29 @@
robot.delay(500);
}
+ protected void setUp2(final TestHarness harness) throws Exception
+ {
+ text = new JTextField();
+ text.setActionCommand("Action Command");
+ text.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent event)
+ {
+ harness.check(event.getActionCommand() != null);
+ harness.check(event.getActionCommand() != text.getText());
+ harness.check(event.getActionCommand() == "Action Command");
+ }
+ });
+
+ frame = new JFrame();
+ frame.setSize(200, 200);
+ frame.getContentPane().add(text);
+ frame.show();
+
+ robot = new Robot();
+ robot.setAutoDelay(50);
+ robot.delay(500);
+ }
+
protected void tearDown() throws Exception
{
frame.dispose();
@@ -106,9 +129,11 @@
public void test(TestHarness harness)
{
+ // This test ensures that if actionCommand == null,
+ // then the user's input is used as the actionCommand.
try
{
- setUp(harness);
+ setUp1(harness);
try
{
click(text, text.getWidth() / 2, text.getHeight() / 2);
@@ -124,6 +149,27 @@
e.printStackTrace();
harness.fail("Exception: " + e);
}
+
+ // This test ensures that if actionCommand != null,
+ // then the actionCommand is used.
+ try
+ {
+ setUp2(harness);
+ try
+ {
+ click(text, text.getWidth() / 2, text.getHeight() / 2);
+ enterInput(harness);
+ }
+ finally
+ {
+ tearDown();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ harness.fail("Exception: " + e);
+ }
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: FYI: Added a new test for JTextField
2006-11-01 14:33 FYI: Added a new test for JTextField Tania Bento
@ 2006-11-01 14:35 ` Tania Bento
0 siblings, 0 replies; 2+ messages in thread
From: Tania Bento @ 2006-11-01 14:35 UTC (permalink / raw)
To: mauve-patches
Sorry.. Wrong date in the changelog entry.
2006-11-01 Tania Bento <tbento@redhat.com>
* gnu/testlet/javax/swing/JTextField/fireActionPerformed.java:
Added a new test.
On Wed, 2006-11-01 at 09:32 -0500, Tania Bento wrote:
> Hey,
>
> This adds one other test for
> javax.swing.JTextField.fireActionPerformed().
>
> 2006-10-31 Tania Bento <tbento@redhat.com>
>
> * gnu/testlet/javax/swing/JTextField/fireActionPerfomed: Added a
> new test.
>
> Cheers,
> Tania
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-01 14:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-01 14:33 FYI: Added a new test for JTextField Tania Bento
2006-11-01 14:35 ` Tania Bento
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).