From 7ff1827cdc8b28d83309c71b9acc5929c7997319 Mon Sep 17 00:00:00 2001 From: Rolf Theunissen Date: Sat, 10 Mar 2018 21:33:20 +0100 Subject: Bug 488431 - Provide SWT/GTK3 port on Windows Test for windows style newlines (os=windows) instead of windows platform (platform=win32) Change-Id: I97d96c4b24c6b7ff9152c715ada973acfeb01075 Signed-off-by: Rolf Theunissen --- .../org/eclipse/swt/tests/junit/SwtTestUtil.java | 2 ++ .../junit/Test_org_eclipse_swt_custom_StyledText.java | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestUtil.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestUtil.java index 44bfcdebc7..2a3d254f9c 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestUtil.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestUtil.java @@ -61,9 +61,11 @@ public class SwtTestUtil { public static String[] reparentablePlatforms = new String[] {"win32", "gtk", "cocoa"}; public static final String testFontName; + // isWindows refers to windows platform, i.e. win32 windowing system; see also isWindowsOS public final static boolean isWindows = SWT.getPlatform().startsWith("win32"); public final static boolean isCocoa = SWT.getPlatform().startsWith("cocoa"); public final static boolean isGTK = SWT.getPlatform().equals("gtk"); + public final static boolean isWindowsOS = System.getProperty("os.name").startsWith("Windows"); public final static boolean isLinux = System.getProperty("os.name").equals("Linux"); public final static boolean isAIX = System.getProperty("os.name").equals("AIX"); public final static boolean isSolaris = System.getProperty("os.name").equals("Solaris") || System.getProperty("os.name").equals("SunOS"); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java index 7ed2c0c66c..470204641b 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java @@ -753,7 +753,7 @@ public void test_copy() { text.setSelectionRange(0, text.getCharCount()); text.copy(); clipboardText = (String) clipboard.getContents(transfer); - if (SwtTestUtil.isWindows) { + if (SwtTestUtil.isWindowsOS) { convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n"; } else { @@ -766,7 +766,7 @@ public void test_copy() { text.setSelectionRange(0, text.getCharCount()); text.copy(); clipboardText = (String) clipboard.getContents(transfer); - if (SwtTestUtil.isWindows) { + if (SwtTestUtil.isWindowsOS) { convertedText = "Line1\r\nLine2"; } else { @@ -821,7 +821,7 @@ public void test_cut() { text.setSelectionRange(0, text.getCharCount()); text.cut(); clipboardText = (String) clipboard.getContents(transfer); - if (SwtTestUtil.isWindows) { + if (SwtTestUtil.isWindowsOS) { convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n"; } else { @@ -834,7 +834,7 @@ public void test_cut() { text.setSelectionRange(0, text.getCharCount()); text.cut(); clipboardText = (String) clipboard.getContents(transfer); - if (SwtTestUtil.isWindows) { + if (SwtTestUtil.isWindowsOS) { convertedText = "Line1\r\nLine2"; } else { @@ -2349,7 +2349,7 @@ public void test_paste(){ // test line delimiter conversion clipboard.setContents(new String[]{"\rLine1\nLine2\r\nLine3\n\rLine4\n"}, new Transfer[]{transfer}); text.paste(); - if (SwtTestUtil.isWindows) { + if (SwtTestUtil.isWindowsOS) { convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n"; } else { @@ -2361,7 +2361,7 @@ public void test_paste(){ // test line delimiter conversion clipboard.setContents(new String[]{"Line1\r\nLine2"}, new Transfer[]{transfer}); text.paste(); - if (SwtTestUtil.isWindows) { + if (SwtTestUtil.isWindowsOS) { convertedText = "Line1\r\nLine2"; } else { @@ -2373,7 +2373,7 @@ public void test_paste(){ // test line delimiter conversion clipboard.setContents(new String[]{"Line1\rLine2"}, new Transfer[]{transfer}); text.paste(); - if (SwtTestUtil.isWindows) { + if (SwtTestUtil.isWindowsOS) { convertedText = "Line1\r\nLine2"; } else { @@ -2386,7 +2386,7 @@ public void test_paste(){ // test line delimiter conversion clipboard.setContents(new String[]{"Line1\nLine2"}, new Transfer[]{transfer}); text.paste(); - if (SwtTestUtil.isWindows) { + if (SwtTestUtil.isWindowsOS) { convertedText = "Line1\r\nLine2"; } else { -- cgit v1.2.3