tmf: Skip CopyToClipboardTest tests when running GTK3 and Eclipse 4.5
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tue, 29 Mar 2016 06:09:09 +0000 (02:09 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tue, 29 Mar 2016 16:42:43 +0000 (12:42 -0400)
These tests will never work in Eclipse 4.5.x because there was a bug
in SWT that only got fixed in 4.6.0. See bug 486302.

Change-Id: I78d9b95970bf3b99b07108e98d046f8d6dd58b94
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/69395
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/CopyToClipboardTest.java

index 2ff9cdbb225a78e32820e67974f0431f9765465b..cccd73bc98e0038ed4e4fb63c53af80c8135fadd 100644 (file)
@@ -26,7 +26,9 @@ import org.apache.log4j.Logger;
 import org.apache.log4j.SimpleLayout;
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
 import org.eclipse.swt.dnd.Clipboard;
 import org.eclipse.swt.dnd.TextTransfer;
 import org.eclipse.swt.widgets.Display;
@@ -147,6 +149,7 @@ public class CopyToClipboardTest {
      */
     @Test
     public void testCopySingleSelection() {
+        assumeTrue(!isAffectedByBug486302());
         final SWTBotTable tableBot = fEditorBot.bot().table();
         tableBot.getTableItem(1).click();
 
@@ -159,6 +162,7 @@ public class CopyToClipboardTest {
      */
     @Test
     public void testCopyMultipleSelection() {
+        assumeTrue(!isAffectedByBug486302());
         final SWTBotTable tableBot = fEditorBot.bot().table();
         tableBot.getTableItem(1).click();
         KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.DOWN);
@@ -168,6 +172,22 @@ public class CopyToClipboardTest {
         assertClipboardContentsEquals(HEADER_TEXT + EVENT1_TEXT + EVENT2_TEXT + EVENT3_TEXT);
     }
 
+    /**
+     * Returns whether or not the running Eclipse is affected by Bug 486302. The
+     * bug is present in Eclipse 4.5.2 and earlier running GTK3.
+     */
+    private static boolean isAffectedByBug486302() {
+        String property = System.getProperty("org.eclipse.swt.internal.gtk.version");
+        if (property != null) {
+            @NonNull String @NonNull [] versionSegments = property.split("\\.");
+            if (versionSegments.length > 0) {
+                return SWT.getVersion() <= 4530 && versionSegments[0].equals("3");
+            }
+        }
+
+        return false;
+    }
+
     /**
      * Test copy to clipboard not enabled when selection includes search row
      */
This page took 0.026515 seconds and 5 git commands to generate.