diff options
author | Alexander Kurtakov | 2015-03-20 08:07:30 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2015-03-23 09:34:29 +0000 |
commit | 527e24f184dc9d18d8cfb49edef74c69c073816c (patch) | |
tree | 28b3b97bf62a96cdaaacf91661c0ae54010d0a53 /tests | |
parent | c516c040c5c35cacbd69ee1333629a7416eb7095 (diff) | |
download | eclipse.platform.swt-527e24f184dc9d18d8cfb49edef74c69c073816c.tar.gz eclipse.platform.swt-527e24f184dc9d18d8cfb49edef74c69c073816c.tar.xz eclipse.platform.swt-527e24f184dc9d18d8cfb49edef74c69c073816c.zip |
Bug 462631 - Adapt to JUnit 4 style tests
Change Accessible* tests and add AccessibleTextEvent to the test suite
so it gets called.
Change-Id: Ic5c610651fa609be503e532b9f1dc59c33d98a45
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'tests')
5 files changed, 68 insertions, 34 deletions
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllNonBrowserTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllNonBrowserTests.java index f16191efd1..97daff4495 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllNonBrowserTests.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllNonBrowserTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,12 +7,15 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Red Hat Inc. - Adapt to JUnit 4. *******************************************************************************/ package org.eclipse.swt.tests.junit; -import junit.framework.*; -import junit.textui.*; +import junit.framework.JUnit4TestAdapter; +import junit.framework.Test; +import junit.framework.TestSuite; +import junit.textui.TestRunner; /** * Suite for running most SWT test cases (all except for browser tests). @@ -83,9 +86,10 @@ public AllNonBrowserTests() { addTestSuite(Test_org_eclipse_swt_program_Program.class); - addTestSuite(Test_org_eclipse_swt_accessibility_Accessible.class); - addTestSuite(Test_org_eclipse_swt_accessibility_AccessibleControlEvent.class); - addTestSuite(Test_org_eclipse_swt_accessibility_AccessibleEvent.class); + addTest(new JUnit4TestAdapter(Test_org_eclipse_swt_accessibility_Accessible.class)); + addTest(new JUnit4TestAdapter(Test_org_eclipse_swt_accessibility_AccessibleControlEvent.class)); + addTest(new JUnit4TestAdapter(Test_org_eclipse_swt_accessibility_AccessibleEvent.class)); + addTest(new JUnit4TestAdapter(Test_org_eclipse_swt_accessibility_AccessibleTextEvent.class)); // Don't run AllBrowserTests here; see AllTests. } diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_Accessible.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_Accessible.java index 3816bba958..8b910671ed 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_Accessible.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_Accessible.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,10 +7,12 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Red Hat Inc. - Adapt to JUnit 4. *******************************************************************************/ package org.eclipse.swt.tests.junit; -import junit.framework.TestCase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import org.eclipse.swt.accessibility.Accessible; import org.eclipse.swt.accessibility.AccessibleControlEvent; @@ -20,27 +22,31 @@ import org.eclipse.swt.accessibility.AccessibleListener; import org.eclipse.swt.accessibility.AccessibleTextEvent; import org.eclipse.swt.accessibility.AccessibleTextListener; import org.eclipse.swt.widgets.Shell; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; /** * Automated Test Suite for class org.eclipse.swt.accessibility.Accessible * * @see org.eclipse.swt.accessibility.Accessible */ -public class Test_org_eclipse_swt_accessibility_Accessible extends TestCase { +public class Test_org_eclipse_swt_accessibility_Accessible { -@Override -protected void setUp() { +@Before +public void setUp() { shell = new Shell(); accessible = shell.getAccessible(); } -@Override -protected void tearDown() { +@After +public void tearDown() { assertEquals(false, shell.isDisposed()); shell.dispose(); assertTrue(shell.isDisposed()); } +@Test public void test_addAccessibleControlListenerLorg_eclipse_swt_accessibility_AccessibleControlListener() { AccessibleControlListener listener = new AccessibleControlListener() { public void getValue(AccessibleControlEvent e) { @@ -70,6 +76,7 @@ public void test_addAccessibleControlListenerLorg_eclipse_swt_accessibility_Acce accessible.removeAccessibleControlListener(listener); } +@Test public void test_addAccessibleListenerLorg_eclipse_swt_accessibility_AccessibleListener() { AccessibleListener listener = new AccessibleListener() { public void getName(AccessibleEvent e) { @@ -85,6 +92,7 @@ public void test_addAccessibleListenerLorg_eclipse_swt_accessibility_AccessibleL accessible.removeAccessibleListener(listener); } +@Test public void test_addAccessibleTextListenerLorg_eclipse_swt_accessibility_AccessibleTextListener() { AccessibleTextListener listener = new AccessibleTextListener() { public void getSelectionRange(AccessibleTextEvent e) { @@ -96,6 +104,7 @@ public void test_addAccessibleTextListenerLorg_eclipse_swt_accessibility_Accessi accessible.removeAccessibleTextListener(listener); } +@Test public void test_getControl() { assertEquals(shell, accessible.getControl()); } diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlEvent.java index 57e2d42b20..0eca2c9a74 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlEvent.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,31 +7,37 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Red Hat Inc. - Adapt to JUnit 4. *******************************************************************************/ package org.eclipse.swt.tests.junit; -import junit.framework.TestCase; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import org.eclipse.swt.accessibility.AccessibleControlEvent; import org.eclipse.swt.widgets.Shell; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; /** * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleControlEvent * * @see org.eclipse.swt.accessibility.AccessibleControlEvent */ -public class Test_org_eclipse_swt_accessibility_AccessibleControlEvent extends TestCase { +public class Test_org_eclipse_swt_accessibility_AccessibleControlEvent { -@Override -protected void setUp() { +@Before +public void setUp() { shell = new Shell(); } -@Override -protected void tearDown() { +@After +public void tearDown() { shell.dispose(); } +@Test public void test_ConstructorLjava_lang_Object() { // The source object should be a widget's accessible. AccessibleControlEvent event = new AccessibleControlEvent(shell.getAccessible()); @@ -42,6 +48,7 @@ public void test_ConstructorLjava_lang_Object() { assertNotNull(event); } +@Test public void test_toString() { AccessibleControlEvent event = new AccessibleControlEvent(shell.getAccessible()); assertNotNull(event.toString()); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleEvent.java index 06925d2d36..eb360efaf8 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleEvent.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,31 +7,37 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Red Hat Inc. - Adapt to JUnit 4. *******************************************************************************/ package org.eclipse.swt.tests.junit; -import junit.framework.TestCase; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import org.eclipse.swt.accessibility.AccessibleEvent; import org.eclipse.swt.widgets.Shell; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; /** * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleEvent * * @see org.eclipse.swt.accessibility.AccessibleEvent */ -public class Test_org_eclipse_swt_accessibility_AccessibleEvent extends TestCase { +public class Test_org_eclipse_swt_accessibility_AccessibleEvent { -@Override -protected void setUp() { +@Before +public void setUp() { shell = new Shell(); } -@Override -protected void tearDown() { +@After +public void tearDown() { shell.dispose(); } +@Test public void test_ConstructorLjava_lang_Object() { // The source object should be a widget's accessible. AccessibleEvent event = new AccessibleEvent(shell.getAccessible()); @@ -42,6 +48,7 @@ public void test_ConstructorLjava_lang_Object() { assertNotNull(event); } +@Test public void test_toString() { AccessibleEvent event = new AccessibleEvent(shell.getAccessible()); assertNotNull(event.toString()); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextEvent.java index 9d570b6873..3727f1bc56 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextEvent.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,31 +7,37 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Red Hat Inc. - Adapt to JUnit 4. *******************************************************************************/ package org.eclipse.swt.tests.junit; -import junit.framework.TestCase; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import org.eclipse.swt.accessibility.AccessibleTextEvent; import org.eclipse.swt.widgets.Shell; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; /** * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleTextEvent * * @see org.eclipse.swt.accessibility.AccessibleTextEvent */ -public class Test_org_eclipse_swt_accessibility_AccessibleTextEvent extends TestCase { +public class Test_org_eclipse_swt_accessibility_AccessibleTextEvent { -@Override -protected void setUp() { +@Before +public void setUp() { shell = new Shell(); } -@Override -protected void tearDown() { +@After +public void tearDown() { shell.dispose(); } +@Test public void test_ConstructorLjava_lang_Object() { // The source object should be a widget's accessible. AccessibleTextEvent event = new AccessibleTextEvent(shell.getAccessible()); @@ -42,6 +48,7 @@ public void test_ConstructorLjava_lang_Object() { assertNotNull(event); } +@Test public void test_toString() { AccessibleTextEvent event = new AccessibleTextEvent(shell.getAccessible()); assertNotNull(event.toString()); |