Skip to content

Commit b78efbf

Browse files
committed
Add clipboard tag to all SWT tests
Add 'clipboard' Tag to all tests that use it, and mark all suites as `failIfNoTests` = `false` so that tags are useful This makes it easy to run all tests that affect the clipboard even though they are spread across many different tests. Part of #2126
1 parent 6ff8e6f commit b78efbf

10 files changed

+33
-4
lines changed

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllBrowserTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.junit.platform.suite.api.SelectClasses;
1818
import org.junit.platform.suite.api.Suite;
1919

20-
@Suite
20+
@Suite(failIfNoTests = false)
2121
@SelectClasses({
2222
Test_org_eclipse_swt_browser_Browser.class,
2323
Test_org_eclipse_swt_browser_Browser_IE.class

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* Suite for testing all of the graphics test cases.
2121
*/
22-
@Suite
22+
@Suite(failIfNoTests = false)
2323
@SelectClasses({ //
2424
// Sorted list of tests
2525
Test_org_eclipse_swt_graphics_Color.class, //

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllNonBrowserTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
* Suite for running most SWT test cases (all except for browser tests).
2828
*/
29-
@Suite
29+
@Suite(failIfNoTests = false)
3030
@SelectClasses({ //
3131
// Basic tests
3232
Test_org_eclipse_swt_SWT.class, //

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/**
2121
* Suite for running all SWT test cases.
2222
*/
23-
@Suite
23+
@Suite(failIfNoTests = false)
2424
@SelectClasses({
2525
AllNonBrowserTests.class,
2626
AllBrowserTests.class

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.eclipse.swt.widgets.Control;
3434
import org.eclipse.swt.widgets.Text;
3535
import org.junit.jupiter.api.BeforeEach;
36+
import org.junit.jupiter.api.Tag;
3637
import org.junit.jupiter.api.Test;
3738

3839
/**
@@ -75,6 +76,7 @@ public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
7576
assertNotNull(ccombo.getAccessible());
7677
}
7778

79+
@Tag("clipboard")
7880
@Test
7981
public void test_copy() {
8082
if (SwtTestUtil.isCocoa) {
@@ -93,6 +95,7 @@ public void test_copy() {
9395
assertEquals("23123456", ccombo.getText());
9496
}
9597

98+
@Tag("clipboard")
9699
@Test
97100
public void test_cut() {
98101
if (SwtTestUtil.isCocoa) {
@@ -130,6 +133,7 @@ public void test_isFocusControl() {
130133
}
131134
}
132135

136+
@Tag("clipboard")
133137
@Test
134138
public void test_paste() {
135139
if (SwtTestUtil.isCocoa) {

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.eclipse.swt.custom.StyledText;
2323
import org.eclipse.swt.widgets.Shell;
2424
import org.junit.jupiter.api.BeforeEach;
25+
import org.junit.jupiter.api.Tag;
2526
import org.junit.jupiter.api.Test;
2627

2728
/**
@@ -40,6 +41,7 @@ public void setUp() {
4041
shell.open();
4142
}
4243

44+
@Tag("clipboard")
4345
@Test
4446
public void test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent() {
4547
LineBackgroundListener listener = event -> {

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
import org.eclipse.swt.widgets.Text;
7979
import org.eclipse.swt.widgets.Widget;
8080
import org.junit.jupiter.api.BeforeEach;
81+
import org.junit.jupiter.api.Tag;
8182
import org.junit.jupiter.api.Test;
8283

8384
/**
@@ -323,6 +324,7 @@ public void test_removeCaretListener_CaretListenerNotCalled() {
323324
assertFalse(listenerCalled);
324325
}
325326

327+
@Tag("clipboard")
326328
@Test
327329
public void test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener() {
328330
String line = "Line1";
@@ -348,6 +350,7 @@ public void test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackground
348350
assertFalse(listenerCalled);
349351
}
350352

353+
@Tag("clipboard")
351354
@Test
352355
public void test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener() {
353356
String line = "Line1";
@@ -687,6 +690,8 @@ public void test_marginsCorrect(){
687690
assertEquals(leftMargin, singleText.getLeftMargin());
688691
singleText.dispose();
689692
}
693+
694+
@Tag("clipboard")
690695
@Test
691696
public void test_copy() {
692697
if (SwtTestUtil.isCocoa) {
@@ -763,6 +768,7 @@ private static StyleRange getRangeForText(String str, String subStr) {
763768
return null;
764769
}
765770

771+
@Tag("clipboard")
766772
@Test
767773
public void test_clipboardWithHtml() {
768774
String content = "This is red, background yellow, bold, italic, underscore, big, small, super, sub.";
@@ -814,6 +820,7 @@ public void test_clipboardWithHtml() {
814820
fontArial8.dispose();
815821
}
816822

823+
@Tag("clipboard")
817824
@Test
818825
public void test_cut() {
819826
if (SwtTestUtil.isCocoa) {
@@ -2239,6 +2246,7 @@ public void test_invokeActionI() {
22392246
text.invokeAction(ST.TOGGLE_OVERWRITE);
22402247
}
22412248

2249+
@Tag("clipboard")
22422250
@Test
22432251
public void test_paste(){
22442252
if (SwtTestUtil.isCocoa) {
@@ -5265,6 +5273,7 @@ public void test_selectAllInBlockSelectionMode() {
52655273
assertEquals("Test" + System.lineSeparator(), text.getSelectionText());
52665274
}
52675275

5276+
@Tag("clipboard")
52685277
@Test
52695278
public void test_cutTextInBlockSelection() {
52705279
text.setText(blockSelectionTestText());
@@ -5281,6 +5290,7 @@ public void test_cutTextInBlockSelection() {
52815290
+ "Sample Test Selection" + System.lineSeparator()));
52825291
}
52835292

5293+
@Tag("clipboard")
52845294
@Test
52855295
public void test_pasteInsertsTextInBlockSelectionAsBlock() {
52865296
text.setText(blockSelectionTestText());
@@ -5300,6 +5310,7 @@ public void test_pasteInsertsTextInBlockSelectionAsBlock() {
53005310
+ blockSelectionTestTextOneLine()));
53015311
}
53025312

5313+
@Tag("clipboard")
53035314
@Test
53045315
public void test_cutAndPasteInBlockSelection() {
53055316
text.setText(blockSelectionTestText());
@@ -5811,6 +5822,7 @@ public void test_bug551335_lostStyles() throws InterruptedException {
58115822
* from clipboard. It should be still possible to paste text which was copied
58125823
* from a now disposed/unavailable StyledText.
58135824
*/
5825+
@Tag("clipboard")
58145826
@Test
58155827
public void test_clipboardCarryover() {
58165828
assumeFalse(SwtTestUtil.isCocoa, "Disabled on Mac because similar clipboard tests are also disabled.");

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText_multiCaretsSelections.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.eclipse.test.Screenshots;
2929
import org.junit.jupiter.api.AfterEach;
3030
import org.junit.jupiter.api.BeforeEach;
31+
import org.junit.jupiter.api.Tag;
3132
import org.junit.jupiter.api.Test;
3233
import org.junit.jupiter.api.extension.AfterTestExecutionCallback;
3334
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -220,6 +221,7 @@ public void test_MultiCarets_Delete() {
220221
assertArrayEquals(new int[] { 2, 0, 7, 0 }, text.getSelectionRanges());
221222
}
222223

224+
@Tag("clipboard")
223225
@Test
224226
public void test_MultiCarets_CopyPaste() {
225227
text.setText("1\n2");

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.eclipse.swt.widgets.Combo;
3737
import org.eclipse.swt.widgets.Display;
3838
import org.junit.jupiter.api.BeforeEach;
39+
import org.junit.jupiter.api.Tag;
3940
import org.junit.jupiter.api.Test;
4041

4142
/**
@@ -222,6 +223,7 @@ public void test_computeSizeIIZ() {
222223
// super class test is sufficient
223224
}
224225

226+
@Tag("clipboard")
225227
@Test
226228
public void test_copy() {
227229
if (SwtTestUtil.isCocoa) {
@@ -245,6 +247,7 @@ public void test_copy() {
245247
assertEquals("23123456", combo.getText());
246248
}
247249

250+
@Tag("clipboard")
248251
@Test
249252
public void test_cut() {
250253
if (SwtTestUtil.isCocoa) {
@@ -492,6 +495,7 @@ public void test_indexOfLjava_lang_StringI() {
492495
assertEquals(i, combo.indexOf("fred" + i, i));
493496
}
494497

498+
@Tag("clipboard")
495499
@Test
496500
public void test_paste() {
497501
if (SwtTestUtil.isCocoa) {
@@ -1036,6 +1040,7 @@ public void test_consistency_DragDetect () {
10361040
consistencyEvent(10, 5, 20, 10, ConsistencyUtility.MOUSE_DRAG);
10371041
}
10381042

1043+
@Tag("clipboard")
10391044
@Test
10401045
public void test_consistency_Segments () {
10411046
if (!SwtTestUtil.isWindows) {

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.eclipse.swt.widgets.Text;
3636
import org.eclipse.swt.widgets.Widget;
3737
import org.junit.jupiter.api.BeforeEach;
38+
import org.junit.jupiter.api.Tag;
3839
import org.junit.jupiter.api.Test;
3940

4041
/**
@@ -263,6 +264,7 @@ public void test_computeSizeIIZ() {
263264
// super class test is sufficient
264265
}
265266

267+
@Tag("clipboard")
266268
@Test
267269
public void test_copy() {
268270
if (SwtTestUtil.isCocoa) {
@@ -928,6 +930,7 @@ public void test_isVisible() {
928930
assertFalse(control.isVisible());
929931
}
930932

933+
@Tag("clipboard")
931934
@Test
932935
public void test_paste() {
933936
if (SwtTestUtil.isCocoa) {
@@ -1429,6 +1432,7 @@ public void test_consistency_DragDetect () {
14291432
consistencyEvent(30, 10, 50, 0, ConsistencyUtility.MOUSE_DRAG);
14301433
}
14311434

1435+
@Tag("clipboard")
14321436
@Test
14331437
public void test_consistency_Segments () {
14341438
if (SwtTestUtil.isCocoa) {

0 commit comments

Comments
 (0)