diff options
author | Jonah Graham | 2020-05-13 22:49:30 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2020-06-11 13:32:20 +0000 |
commit | 89d25414f0d37b84ffa3b07444a99a6e4be18732 (patch) | |
tree | ba97c81b202f87077918b37da989eca665795255 /tests | |
parent | 7c367b4a6beb09d3caf68266d5495db6790afefa (diff) | |
download | eclipse.platform.swt-89d25414f0d37b84ffa3b07444a99a6e4be18732.tar.gz eclipse.platform.swt-89d25414f0d37b84ffa3b07444a99a6e4be18732.tar.xz eclipse.platform.swt-89d25414f0d37b84ffa3b07444a99a6e4be18732.zip |
Bug 563560: Stop using Color constructors which take a device
Change-Id: I3037f38fa716a7d8486ee7998f90e8fe0a493367
Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
Diffstat (limited to 'tests')
23 files changed, 153 insertions, 159 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug138265_SystemMemoryUsage.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug138265_SystemMemoryUsage.java index 8d244b5d13..ae3783cba6 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug138265_SystemMemoryUsage.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug138265_SystemMemoryUsage.java @@ -81,7 +81,7 @@ createComposites(false); } }); -color = new Color(display, new RGB(31,150,192)); +color = new Color(new RGB(31,150,192)); } diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug175964_LTRClippingGC.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug175964_LTRClippingGC.java index 86a300b898..be0bd71796 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug175964_LTRClippingGC.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug175964_LTRClippingGC.java @@ -35,7 +35,7 @@ public class Bug175964_LTRClippingGC { static Color lightGray; public static void main(String [] args) { Display display = new Display(); - lightGray = new Color(null, 192, 192, 192); + lightGray = new Color(192, 192, 192); final Image image = display.getSystemImage(SWT.ICON_INFORMATION); Shell shell = new Shell(display); shell.setText("Clipping rectangle for an RTL widget.tree");//"Images on the right side of the TreeItem"); diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug307441_DnDOverlappingControls.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug307441_DnDOverlappingControls.java index 7eff00e018..032b15c2b7 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug307441_DnDOverlappingControls.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug307441_DnDOverlappingControls.java @@ -62,13 +62,13 @@ public static void main (String [] args) { Rectangle clientArea = dropComp.getClientArea(); final Label label2 = new Label (dropComp, SWT.BORDER); - label2.setBackground(new Color(null,255,255,0)); + label2.setBackground(new Color(255,255,0)); label2.setText("DropLabel1"); label2.setSize(100,100); label2.setBounds(clientArea.x, clientArea.y, clientArea.width, (clientArea.height*2)/3); final Label label3 = new Label (dropComp, SWT.BORDER); - label3.setBackground(new Color(null, 255, 0,0)); + label3.setBackground(new Color(255, 0, 0)); label3.setText("DropLabel2"); label3.setSize(100,100); label3.setBounds(clientArea.x+10, clientArea.y+clientArea.height/3, clientArea.width-10, clientArea.height/2); @@ -171,7 +171,7 @@ public static void setDropTarget (final Control control) { event.detail = DND.DROP_NONE; return; } - control.setBackground(new Color(null,0,0,255)); + control.setBackground(new Color(0,0,255)); } @Override public void dragLeave(DropTargetEvent arg0) { diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug393723_checkForegroundBug.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug393723_checkForegroundBug.java index 586ff4e035..5d3628f6e4 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug393723_checkForegroundBug.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug393723_checkForegroundBug.java @@ -30,7 +30,7 @@ public static void main(String[] args) { System.out.println("shell fore=" + shell.getForeground()); System.out.println("back=" + comp.getBackground()); System.out.println("fore=" + comp.getForeground()); - shell.setForeground(new Color(display, 240, 240, 240)); + shell.setForeground(new Color(240, 240, 240)); comp.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); System.out.println("after"); System.out.println("shell back=" + shell.getBackground()); diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug477950_SystemColors.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug477950_SystemColors.java index 1646afa1c5..2c081f5d97 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug477950_SystemColors.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug477950_SystemColors.java @@ -59,64 +59,64 @@ public class Bug477950_SystemColors { actualRGBA.setWidth(150); Color [] colArray; Map<String, Color []> map = new HashMap<>(); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW), new Color (display, 0,0,0)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW), new Color (0, 0,0)}; map.put("COLOR_WIDGET_DARK_SHADOW", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), new Color (display, 164,164,161)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), new Color (164, 164,161)}; map.put("COLOR_WIDGET_NORMAL_SHADOW", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW), new Color (display, 232,232,231)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW), new Color (232, 232,231)}; map.put("COLOR_WIDGET_LIGHT_SHADOW", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW), new Color (display, 255,255,255)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW), new Color (255, 255,255)}; map.put("COLOR_WIDGET_HIGHLIGHT_SHADOW", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND), new Color (display, 46,52,54)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND), new Color (46, 52,54)}; map.put("COLOR_WIDGET_FOREGROUND", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND), new Color (display, 232,232,231)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND), new Color (232, 232,231)}; map.put("COLOR_WIDGET_BACKGROUND", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_BORDER), new Color (display, 0,0,0)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_BORDER), new Color (0, 0,0)}; map.put("COLOR_WIDGET_BORDER", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_FOREGROUND), new Color (display, 0,0,0)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_FOREGROUND), new Color (0, 0,0)}; map.put("COLOR_LIST_FOREGROUND", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_BACKGROUND), new Color (display, 255,255,255)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_BACKGROUND), new Color (255, 255,255)}; map.put("COLOR_LIST_BACKGROUND", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_SELECTION), new Color (display, 74,144,217)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_SELECTION), new Color (74, 144,217)}; map.put("COLOR_LIST_SELECTION", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT), new Color (display, 255,255,255)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT), new Color (255, 255,255)}; map.put("COLOR_LIST_SELECTION_TEXT", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_INFO_FOREGROUND), new Color (display, 255,255,255)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_INFO_FOREGROUND), new Color (255, 255,255)}; map.put("COLOR_INFO_FOREGROUND", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_INFO_BACKGROUND), new Color (display, 0,0,0)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_INFO_BACKGROUND), new Color (0, 0,0)}; map.put("COLOR_INFO_BACKGROUND", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_FOREGROUND), new Color (display, 255,255,255)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_FOREGROUND), new Color (255, 255,255)}; map.put("COLOR_TITLE_FOREGROUND", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND), new Color (display, 74,144,217)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND), new Color (74, 144,217)}; map.put("COLOR_TITLE_BACKGROUND", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT), new Color (display, 133,188,246)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT), new Color (133, 188,246)}; map.put("COLOR_TITLE_BACKGROUND_GRADIENT", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND), new Color (display, 139,142,143)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND), new Color (139, 142,143)}; map.put("COLOR_TITLE_INACTIVE_FOREGROUND", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND), new Color (display, 241,241,241)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND), new Color (241, 241,241)}; map.put("COLOR_TITLE_INACTIVE_BACKGROUND", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT), new Color (display, 255,255,255)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT), new Color (255, 255,255)}; map.put("COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT", colArray); - colArray = new Color [] {display.getSystemColor(SWT.COLOR_LINK_FOREGROUND), new Color (display, 42,118,198)}; + colArray = new Color [] {display.getSystemColor(SWT.COLOR_LINK_FOREGROUND), new Color (42, 118,198)}; map.put("COLOR_LINK_FOREGROUND", colArray); for (Entry<String, Color[]> entry : map.entrySet()) { diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug530969_ControlPrint.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug530969_ControlPrint.java index 96e2e063fb..84c50e0a78 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug530969_ControlPrint.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug530969_ControlPrint.java @@ -50,7 +50,7 @@ public class Bug530969_ControlPrint { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display, SWT.NO_TRIM); - Color gray = new Color (display, 222, 223, 224); + Color gray = new Color (222, 223, 224); Composite composite = new Composite(shell, SWT.NONE); RowLayout layout = new RowLayout(); layout.marginTop = 0; diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug558222_BlackIcon.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug558222_BlackIcon.java index e7f167b49d..eb6a672eab 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug558222_BlackIcon.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug558222_BlackIcon.java @@ -44,7 +44,7 @@ public class Bug558222_BlackIcon { */ Color border = display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW); Color background = display.getSystemColor(SWT.COLOR_LIST_BACKGROUND); - Color backgroundHot = new Color(display, new RGB(252, 160, 160)); + Color backgroundHot = new Color(new RGB(252, 160, 160)); Color transparent = display.getSystemColor(SWT.COLOR_MAGENTA); PaletteData palette = new PaletteData(new RGB[] { transparent.getRGB(), border.getRGB(), background.getRGB(), backgroundHot.getRGB() }); diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug85131_ToolTipSetNull.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug85131_ToolTipSetNull.java index b3af29d837..a804d46134 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug85131_ToolTipSetNull.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug85131_ToolTipSetNull.java @@ -48,9 +48,9 @@ public class Bug85131_ToolTipSetNull int hm = r.height/8; int rw = w2-wm, rh = r.height-2*hm; - e.gc.setBackground( new Color(null,200,0,0) ); + e.gc.setBackground( new Color(200,0,0) ); e.gc.fillRectangle( 0,hm,w2,rh); - e.gc.setBackground( new Color(null,0,0,200) ); + e.gc.setBackground( new Color(0,0,200) ); e.gc.fillRectangle( w2,hm+hm,rw+wm,rh-hm); } }); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java index c905190c01..826ba77720 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2019 IBM Corporation and others. + * Copyright (c) 2000, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -28,7 +28,6 @@ import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Device; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Text; @@ -161,8 +160,7 @@ public void test_redrawIIIIZ() { @Test public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { boolean exceptionThrown = false; - Device d = null; - Color colors[] = {new Color(d, 0, 0, 0), new Color(d, 255, 255, 255), new Color(d, 0, 45, 255)}; + Color colors[] = {new Color(0, 0, 0), new Color(255, 255, 255), new Color(0, 45, 255)}; try { for(int i=0; i<3; i++) { ccombo.setBackground(colors[i]); @@ -253,10 +251,9 @@ public void test_setFontLorg_eclipse_swt_graphics_Font() { @Test public void test_setForegroundLorg_eclipse_swt_graphics_Color() { boolean exceptionThrown = false; - Device d = null; - Color c1 = new Color(d, 0, 0, 0); - Color c2 = new Color(d, 255, 255, 255); - Color c3 = new Color(d, 23, 45, 151); + Color c1 = new Color(0, 0, 0); + Color c2 = new Color(255, 255, 255); + Color c3 = new Color(23, 45, 151); try { ccombo.setForeground(c1); ccombo.setForeground(c2); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java index 897f81a550..66e49ff73e 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. + * Copyright (c) 2000, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -27,7 +27,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyleRange; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -46,10 +45,9 @@ private Color getColor(RGB rgb) { return colors.get(rgb); } protected void initializeColors() { - Display display = Display.getDefault(); - colors.put(RED, new Color (display, RED)); - colors.put(GREEN, new Color (display, GREEN)); - colors.put(BLUE, new Color (display, BLUE)); + colors.put(RED, new Color (RED)); + colors.put(GREEN, new Color (GREEN)); + colors.put(BLUE, new Color (BLUE)); } @Before @@ -121,7 +119,7 @@ public void test_equalsLjava_lang_Object() { @Test public void test_hashCode() { Set<StyleRange> set = new HashSet<>(); - Color testColor = new Color(Display.getDefault(), 0, 0, 0); + Color testColor = new Color(0, 0, 0); //regression test for bug 30924 set.add(new StyleRange()); 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 0c4f1853b7..1f765a5349 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2019 IBM Corporation and others. + * Copyright (c) 2000, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -163,13 +163,12 @@ private Color getColor(RGB rgb) { } // this method must not be public so that the auto-gen tool keeps it protected void initializeColors() { - Display display = Display.getDefault(); - colors.put(RED, new Color (display, RED)); - colors.put(BLUE, new Color (display, BLUE)); - colors.put(GREEN, new Color (display, GREEN)); - colors.put(YELLOW, new Color (display, YELLOW)); - colors.put(CYAN, new Color (display, CYAN)); - colors.put(PURPLE, new Color (display, PURPLE)); + colors.put(RED, new Color (RED)); + colors.put(BLUE, new Color (BLUE)); + colors.put(GREEN, new Color (GREEN)); + colors.put(YELLOW, new Color (YELLOW)); + colors.put(CYAN, new Color (CYAN)); + colors.put(PURPLE, new Color (PURPLE)); } @Override diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java index f73b11b145..b1711875fb 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java @@ -213,9 +213,9 @@ public void test_drawFocusIIII() { @Test public void test_drawImageLorg_eclipse_swt_graphics_ImageII() { - Color c1 = new Color(display, 255, 0, 0); - Color c2 = new Color(display, 0, 0, 0); - Color c3 = new Color(display, 255, 255, 0); + Color c1 = new Color(255, 0, 0); + Color c2 = new Color(0, 0, 0); + Color c3 = new Color(255, 255, 0); PaletteData paletteData = new PaletteData(c1.getRGB(), c2.getRGB(), c3.getRGB()); ImageData data = new ImageData(30,30, 8, paletteData); @@ -257,9 +257,9 @@ public void test_drawImageLorg_eclipse_swt_graphics_ImageII() { @Test public void test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII() { - Color c1 = new Color(display, 255, 0, 0); - Color c2 = new Color(display, 0, 0, 0); - Color c3 = new Color(display, 255, 255, 0); + Color c1 = new Color(255, 0, 0); + Color c2 = new Color(0, 0, 0); + Color c3 = new Color(255, 255, 0); PaletteData paletteData = new PaletteData(c1.getRGB(), c2.getRGB(), c3.getRGB()); ImageData data = new ImageData(30,30, 8, paletteData); @@ -507,7 +507,7 @@ public void test_isDisposed() { @Test public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(shell.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); gc.setBackground(color); assertEquals(color, gc.getBackground()); try { @@ -571,7 +571,7 @@ public void test_setFontLorg_eclipse_swt_graphics_Font() { @Test public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(shell.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); gc.setForeground(color); assertEquals(color, gc.getForeground()); try { diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java index 8a78044072..ee066d93e5 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java @@ -934,7 +934,7 @@ public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { } image = new Image(display, 10, 10); - Color color = new Color(display, 255, 255, 255); + Color color = new Color(255, 255, 255); color.dispose(); try { image.setBackground(color); @@ -947,7 +947,7 @@ public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { image = new Image(display, 10, 10); image.dispose(); - color = new Color(display, 255, 255, 255); + color = new Color(255, 255, 255); try { image.setBackground(color); fail("No exception thrown for disposed image"); @@ -1015,7 +1015,7 @@ void getImageData1() { void getImageData2(int depth, PaletteData palette) { int width = 10; int height = 10; - Color color = new Color(display, 0, 0xff, 0); + Color color = new Color(0, 0xff, 0); RGB colorRGB = color.getRGB(); ImageData imageData = new ImageData(width, height, depth, palette); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java index 2edca6279c..8b187f2e3c 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java @@ -179,7 +179,7 @@ public void test_setAlignmentI() { @Test public void test_setBackgroundCheckButton() { Button checkButton = new Button(shell, SWT.CHECK); - Color color = new Color(checkButton.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); checkButton.setBackground(color); assertEquals("getBackground not equal after setBackground for SWT.CHECK Button", color, checkButton.getBackground()); @@ -187,7 +187,7 @@ public void test_setBackgroundCheckButton() { assertTrue("getBackground unchanged after setBackground(null) for SWT.CHECK Button", !checkButton.getBackground().equals(color)); color.dispose(); - color = new Color(checkButton.getDisplay(), 255, 0, 0, 0); + color = new Color(255, 0, 0, 0); checkButton.setBackground(color); assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.CHECK Button", color, checkButton.getBackground()); @@ -195,7 +195,7 @@ public void test_setBackgroundCheckButton() { assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.CHECK Button", !checkButton.getBackground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color fg = new Color(checkButton.getDisplay(), 0, 255, 0); + Color fg = new Color(0, 255, 0); checkButton.setBackground(color); checkButton.setForeground(fg); assertEquals("Setting a foreground disrupted the background color for SWT.CHECK Button", @@ -211,10 +211,10 @@ public void test_setBackgroundCheckButton() { @Test public void test_setBackgroundAlphaCheckButton() { Button checkButton = new Button(shell, SWT.CHECK); - Color color = new Color (checkButton.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); checkButton.setBackground(color); assertEquals(color, checkButton.getBackground()); - Color fg = new Color(checkButton.getDisplay(), 0, 255, 0, 0); + Color fg = new Color(0, 255, 0, 0); checkButton.setForeground(fg); assertEquals(color, checkButton.getBackground()); color.dispose(); @@ -225,7 +225,7 @@ public void test_setBackgroundAlphaCheckButton() { @Test public void test_setBackgroundRadioButton() { Button radioButton = new Button(shell, SWT.RADIO); - Color color = new Color(radioButton.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); radioButton.setBackground(color); assertEquals("getBackground not equal after setBackground for SWT.RADIO Button", color, radioButton.getBackground()); @@ -233,7 +233,7 @@ public void test_setBackgroundRadioButton() { assertTrue("getBackground unchanged after setBackground(null) for SWT.RADIO Button", !radioButton.getBackground().equals(color)); color.dispose(); - color = new Color(radioButton.getDisplay(), 255, 0, 0, 0); + color = new Color(255, 0, 0, 0); radioButton.setBackground(color); assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.RADIO Button", color, radioButton.getBackground()); @@ -241,7 +241,7 @@ public void test_setBackgroundRadioButton() { assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.RADIO Button", !radioButton.getBackground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color fg = new Color(radioButton.getDisplay(), 0, 255, 0); + Color fg = new Color(0, 255, 0); radioButton.setBackground(color); radioButton.setForeground(fg); assertEquals("Setting a foreground disrupted the background color for SWT.RADIO Button", @@ -257,10 +257,10 @@ public void test_setBackgroundRadioButton() { @Test public void test_setBackgroundAlphaRadioButton() { Button radioButton = new Button(shell, SWT.RADIO); - Color color = new Color (radioButton.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); radioButton.setBackground(color); assertEquals(color, radioButton.getBackground()); - Color fg = new Color(radioButton.getDisplay(), 0, 255, 0, 0); + Color fg = new Color(0, 255, 0, 0); radioButton.setForeground(fg); assertEquals(color, radioButton.getBackground()); color.dispose(); @@ -278,13 +278,13 @@ public void test_setFocus() { @Test public void test_setForegroundCheckButton() { Button checkButton = new Button(shell, SWT.CHECK); - Color color = new Color(checkButton.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); checkButton.setForeground(color); assertEquals(color, checkButton.getForeground()); checkButton.setForeground(null); assertFalse(checkButton.getForeground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color bg = new Color(checkButton.getDisplay(), 0, 255, 0); + Color bg = new Color(0, 255, 0); checkButton.setForeground(color); checkButton.setBackground(bg); assertEquals("Setting a background disrupted the foreground color for SWT.CHECK Button", @@ -302,10 +302,10 @@ public void test_setForegroundAlphaCheckButton() { Button checkButton = new Button(shell, SWT.CHECK); assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32", SwtTestUtil.isCocoa || SwtTestUtil.isGTK); - Color color = new Color (checkButton.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); checkButton.setForeground(color); assertEquals(color, checkButton.getForeground()); - Color bg = new Color(checkButton.getDisplay(), 0, 255, 0, 0); + Color bg = new Color(0, 255, 0, 0); checkButton.setBackground(bg); assertEquals(color, checkButton.getForeground()); color.dispose(); @@ -316,13 +316,13 @@ public void test_setForegroundAlphaCheckButton() { @Test public void test_setForegroundRadioButton() { Button radioButton = new Button(shell, SWT.RADIO); - Color color = new Color(radioButton.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); radioButton.setForeground(color); assertEquals(color, radioButton.getForeground()); radioButton.setForeground(null); assertFalse(radioButton.getForeground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color bg = new Color(radioButton.getDisplay(), 0, 255, 0); + Color bg = new Color(0, 255, 0); radioButton.setForeground(color); radioButton.setBackground(bg); assertEquals("Setting a background disrupted the foreground color for SWT.RADIO Button", @@ -340,10 +340,10 @@ public void test_setForegroundAlphaRadiokButton() { Button radioButton = new Button(shell, SWT.RADIO); assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32", SwtTestUtil.isCocoa || SwtTestUtil.isGTK); - Color color = new Color (radioButton.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); radioButton.setForeground(color); assertEquals(color, radioButton.getForeground()); - Color bg = new Color(radioButton.getDisplay(), 0, 255, 0, 0); + Color bg = new Color(0, 255, 0, 0); radioButton.setBackground(bg); assertEquals(color, radioButton.getForeground()); color.dispose(); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java index 35e386629a..1b117719a6 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java @@ -759,7 +759,7 @@ public void test_selectI() { @Test public void test_setBackgroundDropDownCombo() { Combo dropDown = new Combo(shell, SWT.DROP_DOWN); - Color color = new Color(dropDown.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); dropDown.setBackground(color); assertEquals("getBackground not equal after setBackground for SWT.DROP_DOWN Combo", color, dropDown.getBackground()); @@ -767,7 +767,7 @@ public void test_setBackgroundDropDownCombo() { assertTrue("getBackground unchanged after setBackground(null) for SWT.DROP_DOWN Combo", !dropDown.getBackground().equals(color)); color.dispose(); - color = new Color(dropDown.getDisplay(), 255, 0, 0, 0); + color = new Color(255, 0, 0, 0); dropDown.setBackground(color); assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.DROP_DOWN Combo", color, dropDown.getBackground()); @@ -775,7 +775,7 @@ public void test_setBackgroundDropDownCombo() { assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.DROP_DOWN Combo", !dropDown.getBackground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color fg = new Color(dropDown.getDisplay(), 0, 255, 0); + Color fg = new Color(0, 255, 0); dropDown.setBackground(color); dropDown.setForeground(fg); assertEquals("Setting a foreground disrupted the background color for SWT.DROP_DOWN Combo", @@ -791,10 +791,10 @@ public void test_setBackgroundDropDownCombo() { @Test public void test_setBackgroundAlphaDropDownCombo() { Combo dropDown = new Combo(shell, SWT.DROP_DOWN); - Color color = new Color (dropDown.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); dropDown.setBackground(color); assertEquals(color, dropDown.getBackground()); - Color fg = new Color(dropDown.getDisplay(), 0, 255, 0, 0); + Color fg = new Color(0, 255, 0, 0); dropDown.setForeground(fg); assertEquals(color, dropDown.getBackground()); color.dispose(); @@ -805,7 +805,7 @@ public void test_setBackgroundAlphaDropDownCombo() { @Test public void test_setBackgroundSimpleCombo() { Combo simple = new Combo(shell, SWT.SIMPLE); - Color color = new Color(simple.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); simple.setBackground(color); assertEquals("getBackground not equal after setBackground for SWT.SIMPLE Combo", color, simple.getBackground()); @@ -813,7 +813,7 @@ public void test_setBackgroundSimpleCombo() { assertTrue("getBackground unchanged after setBackground(null) for SWT.SIMPLE Combo", !simple.getBackground().equals(color)); color.dispose(); - color = new Color(simple.getDisplay(), 255, 0, 0, 0); + color = new Color(255, 0, 0, 0); simple.setBackground(color); assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.SIMPLE Combo", color, simple.getBackground()); @@ -821,7 +821,7 @@ public void test_setBackgroundSimpleCombo() { assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.SIMPLE Combo", !simple.getBackground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color fg = new Color(simple.getDisplay(), 0, 255, 0); + Color fg = new Color(0, 255, 0); simple.setBackground(color); simple.setForeground(fg); assertEquals("Setting a foreground disrupted the background color for SWT.SIMPLE Combo", @@ -837,10 +837,10 @@ public void test_setBackgroundSimpleCombo() { @Test public void test_setBackgroundAlphaSimpleCombo() { Combo simple = new Combo(shell, SWT.SIMPLE); - Color color = new Color (simple.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); simple.setBackground(color); assertEquals(color, simple.getBackground()); - Color fg = new Color(simple.getDisplay(), 0, 255, 0, 0); + Color fg = new Color(0, 255, 0, 0); simple.setForeground(fg); assertEquals(color, simple.getBackground()); color.dispose(); @@ -851,13 +851,13 @@ public void test_setBackgroundAlphaSimpleCombo() { @Test public void test_setForegroundDropDownCombo() { Combo dropDown = new Combo(shell, SWT.DROP_DOWN); - Color color = new Color(dropDown.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); dropDown.setForeground(color); assertEquals(color, dropDown.getForeground()); dropDown.setForeground(null); assertFalse(dropDown.getForeground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color bg = new Color(dropDown.getDisplay(), 0, 255, 0); + Color bg = new Color(0, 255, 0); dropDown.setForeground(color); dropDown.setBackground(bg); assertEquals("Setting a background disrupted the foreground color for SWT.DROP_DOWN Combo", @@ -875,10 +875,10 @@ public void test_setForegroundAlphaDropDownCombo() { Combo dropDown = new Combo(shell, SWT.DROP_DOWN); assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32", SwtTestUtil.isCocoa || SwtTestUtil.isGTK); - Color color = new Color (dropDown.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); dropDown.setForeground(color); assertEquals(color, dropDown.getForeground()); - Color bg = new Color(dropDown.getDisplay(), 0, 255, 0, 0); + Color bg = new Color(0, 255, 0, 0); dropDown.setBackground(bg); assertEquals(color, dropDown.getForeground()); color.dispose(); @@ -889,13 +889,13 @@ public void test_setForegroundAlphaDropDownCombo() { @Test public void test_setForegroundSimpleCombo() { Combo simple = new Combo(shell, SWT.SIMPLE); - Color color = new Color(simple.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); simple.setForeground(color); assertEquals(color, simple.getForeground()); simple.setForeground(null); assertFalse(simple.getForeground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color bg = new Color(simple.getDisplay(), 0, 255, 0); + Color bg = new Color(0, 255, 0); simple.setForeground(color); simple.setBackground(bg); assertEquals("Setting a background disrupted the foreground color for SWT.SIMPLE Combo", @@ -913,10 +913,10 @@ public void test_setForegroundAlphaSimpleCombo() { Combo simple = new Combo(shell, SWT.SIMPLE); assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32", SwtTestUtil.isCocoa || SwtTestUtil.isGTK); - Color color = new Color (simple.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); simple.setForeground(color); assertEquals(color, simple.getForeground()); - Color bg = new Color(simple.getDisplay(), 0, 255, 0, 0); + Color bg = new Color(0, 255, 0, 0); simple.setBackground(bg); assertEquals(color, simple.getForeground()); color.dispose(); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java index 6346ca1d0c..d08ad5ab7d 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java @@ -606,19 +606,19 @@ public void test_requestLayoutL() { } @Test public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(control.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); control.setBackground(color); assertEquals("getBackground not equal color after setBackground(color) for " + control, color, control.getBackground()); control.setBackground(null); assertTrue("getBackground unchanged after setBackground(null) for " + control, !control.getBackground().equals(color)); color.dispose(); - color = new Color(control.getDisplay(), 255, 0, 0, 0); + color = new Color(255, 0, 0, 0); control.setBackground(color); assertEquals("getBackground not equal color after setBackground(color) with 0 alpha for " + control + " " + control.getBackground(), color, control.getBackground()); control.setBackground(null); assertTrue("getBackground unchanged after setBackground(null) alpha for " + control + " " + control.getBackground() + " " + control, !control.getBackground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color fg = new Color(control.getDisplay(), 0, 255, 0); + Color fg = new Color(0, 255, 0); control.setBackground(color); control.setForeground(fg); assertEquals("Setting a foreground disrupted the background color for " + control, @@ -630,10 +630,10 @@ public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { } @Test public void test_setBackgroundAlphaLorg_eclipse_swt_graphics_Color() { - Color color = new Color (control.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); control.setBackground(color); assertEquals(color, control.getBackground()); - Color fg = new Color(control.getDisplay(), 0, 255, 0, 0); + Color fg = new Color(0, 255, 0, 0); control.setForeground(fg); assertEquals(color, control.getBackground()); color.dispose(); @@ -641,7 +641,7 @@ public void test_setBackgroundAlphaLorg_eclipse_swt_graphics_Color() { } @Test public void test_setBackgroundDisposedColorLorg_eclipse_swt_graphics_Color() { - Color color = new Color(control.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); color.dispose(); try { control.setBackground(color); @@ -747,13 +747,13 @@ public void test_setFontLorg_eclipse_swt_graphics_Font() { } @Test public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(control.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); control.setForeground(color); assertEquals(color, control.getForeground()); control.setForeground(null); assertFalse(control.getForeground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color bg = new Color(control.getDisplay(), 0, 255, 0); + Color bg = new Color(0, 255, 0); control.setForeground(color); control.setBackground(bg); assertEquals("Setting a background disrupted the foreground color for " + control, @@ -767,10 +767,10 @@ public void test_setForegroundLorg_eclipse_swt_graphics_Color() { public void test_setForegroundAlphaLorg_eclipse_swt_graphics_Color() { assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32", SwtTestUtil.isCocoa || SwtTestUtil.isGTK); - Color color = new Color (control.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); control.setForeground(color); assertEquals(color, control.getForeground()); - Color bg = new Color(control.getDisplay(), 0, 255, 0, 0); + Color bg = new Color(0, 255, 0, 0); control.setBackground(bg); assertEquals(color, control.getForeground()); color.dispose(); @@ -779,7 +779,7 @@ public void test_setForegroundAlphaLorg_eclipse_swt_graphics_Color() { @Test public void test_setForegroundDisposedColorLorg_eclipse_swt_graphics_Color() { - Color color = new Color(control.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); color.dispose(); try { control.setForeground(color); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java index a01e94f29f..a5b30054dd 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java @@ -152,7 +152,7 @@ public void test_addSelectionListenerWidgetSelectedAdapterLorg_eclipse_swt_event @Test public void test_setBackgroundCalendarDateTime() { DateTime calendar = new DateTime(shell, SWT.CALENDAR); - Color color = new Color(calendar.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); calendar.setBackground(color); assertEquals("getBackground not equal after setBackground for SWT.CALENDAR DateTime", color, calendar.getBackground()); @@ -160,7 +160,7 @@ public void test_setBackgroundCalendarDateTime() { assertTrue("getBackground unchanged after setBackground(null) for SWT.CALENDAR DateTime", !calendar.getBackground().equals(color)); color.dispose(); - color = new Color(calendar.getDisplay(), 255, 0, 0, 0); + color = new Color(255, 0, 0, 0); calendar.setBackground(color); assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.CALENDAR DateTime", color, calendar.getBackground()); @@ -168,7 +168,7 @@ public void test_setBackgroundCalendarDateTime() { assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.CALENDAR DateTime", !calendar.getBackground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color fg = new Color(calendar.getDisplay(), 0, 255, 0); + Color fg = new Color(0, 255, 0); calendar.setBackground(color); calendar.setForeground(fg); assertEquals("Setting a foreground disrupted the background color for SWT.CALENDAR DateTime", @@ -184,10 +184,10 @@ public void test_setBackgroundCalendarDateTime() { @Test public void test_setBackgroundAlphaCalendarDateTime() { DateTime calendar = new DateTime(shell, SWT.CALENDAR); - Color color = new Color (calendar.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); calendar.setBackground(color); assertEquals(color, calendar.getBackground()); - Color fg = new Color(calendar.getDisplay(), 0, 255, 0, 0); + Color fg = new Color(0, 255, 0, 0); calendar.setForeground(fg); assertEquals(color, calendar.getBackground()); color.dispose(); @@ -198,7 +198,7 @@ public void test_setBackgroundAlphaCalendarDateTime() { @Test public void test_setBackgroundTimeDateTime() { DateTime time = new DateTime(shell, SWT.TIME); - Color color = new Color(time.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); time.setBackground(color); assertEquals("getBackground not equal after setBackground for SWT.TIME DateTime", color, time.getBackground()); @@ -206,7 +206,7 @@ public void test_setBackgroundTimeDateTime() { assertTrue("getBackground unchanged after setBackground(null) for SWT.TIME DateTime", !time.getBackground().equals(color)); color.dispose(); - color = new Color(time.getDisplay(), 255, 0, 0, 0); + color = new Color(255, 0, 0, 0); time.setBackground(color); assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.TIME DateTime", color, time.getBackground()); @@ -214,7 +214,7 @@ public void test_setBackgroundTimeDateTime() { assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.TIME DateTime", !time.getBackground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color fg = new Color(time.getDisplay(), 0, 255, 0); + Color fg = new Color(0, 255, 0); time.setBackground(color); time.setForeground(fg); assertEquals("Setting a foreground disrupted the background color for SWT.TIME DateTime", @@ -230,10 +230,10 @@ public void test_setBackgroundTimeDateTime() { @Test public void test_setBackgroundAlphaTimeDateTime() { DateTime time = new DateTime(shell, SWT.TIME); - Color color = new Color (time.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); time.setBackground(color); assertEquals(color, time.getBackground()); - Color fg = new Color(time.getDisplay(), 0, 255, 0, 0); + Color fg = new Color(0, 255, 0, 0); time.setForeground(fg); assertEquals(color, time.getBackground()); color.dispose(); @@ -244,7 +244,7 @@ public void test_setBackgroundAlphaTimeDateTime() { @Test public void test_setBackgroundDateDateTime() { DateTime date = new DateTime(shell, SWT.DATE); - Color color = new Color(date.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); date.setBackground(color); assertEquals("getBackground not equal after setBackground for SWT.DATE DateTime", color, date.getBackground()); @@ -252,7 +252,7 @@ public void test_setBackgroundDateDateTime() { assertTrue("getBackground unchanged after setBackground(null) for SWT.DATE DateTime", !date.getBackground().equals(color)); color.dispose(); - color = new Color(date.getDisplay(), 255, 0, 0, 0); + color = new Color(255, 0, 0, 0); date.setBackground(color); assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.DATE DateTime", color, date.getBackground()); @@ -260,7 +260,7 @@ public void test_setBackgroundDateDateTime() { assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.DATE DateTime", !date.getBackground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color fg = new Color(date.getDisplay(), 0, 255, 0); + Color fg = new Color(0, 255, 0); date.setBackground(color); date.setForeground(fg); assertEquals("Setting a foreground disrupted the background color for SWT.DATE DateTime", @@ -276,10 +276,10 @@ public void test_setBackgroundDateDateTime() { @Test public void test_setBackgroundAlphaDateDateTime() { DateTime date = new DateTime(shell, SWT.DATE); - Color color = new Color (date.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); date.setBackground(color); assertEquals(color, date.getBackground()); - Color fg = new Color(date.getDisplay(), 0, 255, 0, 0); + Color fg = new Color(0, 255, 0, 0); date.setForeground(fg); assertEquals(color, date.getBackground()); color.dispose(); @@ -416,13 +416,13 @@ public void test_setDayI() { @Test public void test_setForegroundCalendarDateTime() { DateTime calendar = new DateTime(shell, SWT.CALENDAR); - Color color = new Color(calendar.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); calendar.setForeground(color); assertEquals(color, calendar.getForeground()); calendar.setForeground(null); assertFalse(calendar.getForeground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color bg = new Color(calendar.getDisplay(), 0, 255, 0); + Color bg = new Color(0, 255, 0); calendar.setForeground(color); calendar.setBackground(bg); assertEquals("Setting a background disrupted the foreground color for SWT.CALENDAR DateTime", @@ -440,10 +440,10 @@ public void test_setForegroundAlphaCalendarDateTime() { DateTime calendar = new DateTime(shell, SWT.CALENDAR); assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32", SwtTestUtil.isCocoa || SwtTestUtil.isGTK); - Color color = new Color (calendar.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); calendar.setForeground(color); assertEquals(color, calendar.getForeground()); - Color bg = new Color(calendar.getDisplay(), 0, 255, 0, 0); + Color bg = new Color(0, 255, 0, 0); calendar.setBackground(bg); assertEquals(color, calendar.getForeground()); color.dispose(); @@ -454,13 +454,13 @@ public void test_setForegroundAlphaCalendarDateTime() { @Test public void test_setForegroundTimeDateTime() { DateTime time = new DateTime(shell, SWT.TIME); - Color color = new Color(time.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); time.setForeground(color); assertEquals(color, time.getForeground()); time.setForeground(null); assertFalse(time.getForeground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color bg = new Color(time.getDisplay(), 0, 255, 0); + Color bg = new Color(0, 255, 0); time.setForeground(color); time.setBackground(bg); assertEquals("Setting a background disrupted the foreground color for SWT.TIME DateTime", @@ -478,10 +478,10 @@ public void test_setForegroundAlphaTimeDateTime() { DateTime time = new DateTime(shell, SWT.TIME); assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32", SwtTestUtil.isCocoa || SwtTestUtil.isGTK); - Color color = new Color (time.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); time.setForeground(color); assertEquals(color, time.getForeground()); - Color bg = new Color(time.getDisplay(), 0, 255, 0, 0); + Color bg = new Color(0, 255, 0, 0); time.setBackground(bg); assertEquals(color, time.getForeground()); color.dispose(); @@ -492,13 +492,13 @@ public void test_setForegroundAlphaTimeDateTime() { @Test public void test_setForegroundDateDateTime() { DateTime date = new DateTime(shell, SWT.DATE); - Color color = new Color(date.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); date.setForeground(color); assertEquals(color, date.getForeground()); date.setForeground(null); assertFalse(date.getForeground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { - Color bg = new Color(date.getDisplay(), 0, 255, 0); + Color bg = new Color(0, 255, 0); date.setForeground(color); date.setBackground(bg); assertEquals("Setting a background disrupted the foreground color for SWT.DATE DateTime", @@ -516,10 +516,10 @@ public void test_setForegroundAlphaDateDateTime() { DateTime date = new DateTime(shell, SWT.DATE); assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32", SwtTestUtil.isCocoa || SwtTestUtil.isGTK); - Color color = new Color (date.getDisplay(), 255, 0, 0, 0); + Color color = new Color (255, 0, 0, 0); date.setForeground(color); assertEquals(color, date.getForeground()); - Color bg = new Color(date.getDisplay(), 0, 255, 0, 0); + Color bg = new Color(0, 255, 0, 0); date.setBackground(bg); assertEquals(color, date.getForeground()); color.dispose(); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java index b8ef51f0d1..0c567b58a5 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java @@ -176,7 +176,7 @@ public void test_setTextLjava_lang_String() { @Test public void test_setLinkForegroundLorg_eclipse_swt_graphics_Color() { assertNotNull(link.getLinkForeground()); - Color color = new Color(control.getDisplay(), 12, 34, 56); + Color color = new Color(12, 34, 56); link.setLinkForeground(color); assertEquals(color, link.getLinkForeground()); link.setLinkForeground(null); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java index cfb4de6952..59f04666ae 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java @@ -1402,7 +1402,7 @@ public void test_setFontLorg_eclipse_swt_graphics_Font() { @Test public void test_setHeaderBackgroundLorg_eclipse_swt_graphics_Color() { assertNotNull(table.getHeaderBackground()); - Color color = new Color(control.getDisplay(), 12, 34, 56); + Color color = new Color(12, 34, 56); table.setHeaderBackground(color); assertEquals(color, table.getHeaderBackground()); table.setHeaderBackground(null); @@ -1413,7 +1413,7 @@ public void test_setHeaderBackgroundLorg_eclipse_swt_graphics_Color() { @Test public void test_setHeaderForegroundLorg_eclipse_swt_graphics_Color() { assertNotNull(table.getHeaderForeground()); - Color color = new Color(control.getDisplay(), 12, 34, 56); + Color color = new Color(12, 34, 56); table.setHeaderForeground(color); assertEquals(color, table.getHeaderForeground()); table.setHeaderForeground(null); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java index 784a155364..2cea892313 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java @@ -448,7 +448,7 @@ public void test_setBackgroundILorg_eclipse_swt_graphics_Color() { assertEquals(table.getBackground(),tableItem.getBackground(0)); try { - Color color = new Color(display, 255, 0, 0); + Color color = new Color(255, 0, 0); color.dispose(); tableItem.setBackground(color); fail("No exception thrown for color disposed"); @@ -458,7 +458,7 @@ public void test_setBackgroundILorg_eclipse_swt_graphics_Color() { @Test public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(tableItem.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); tableItem.setBackground(color); assertEquals(color, tableItem.getBackground()); tableItem.setBackground(null); @@ -601,7 +601,7 @@ public void test_setForegroundILorg_eclipse_swt_graphics_Color() { assertEquals(table.getForeground(),tableItem.getForeground(0)); try { - Color color = new Color(display, 255, 0, 0); + Color color = new Color(255, 0, 0); color.dispose(); tableItem.setForeground(color); fail("No exception thrown for color disposed"); @@ -611,7 +611,7 @@ public void test_setForegroundILorg_eclipse_swt_graphics_Color() { @Test public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(tableItem.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); tableItem.setForeground(color); assertEquals(color, tableItem.getForeground()); tableItem.setForeground(null); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java index 89c15cae38..aa256cf681 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java @@ -369,7 +369,7 @@ public void test_selectAll() { @Test public void test_setHeaderBackgroundLorg_eclipse_swt_graphics_Color() { assertNotNull(tree.getHeaderBackground()); - Color color = new Color(control.getDisplay(), 12, 34, 56); + Color color = new Color(12, 34, 56); tree.setHeaderBackground(color); assertEquals(color, tree.getHeaderBackground()); tree.setHeaderBackground(null); @@ -380,7 +380,7 @@ public void test_setHeaderBackgroundLorg_eclipse_swt_graphics_Color() { @Test public void test_setHeaderForegroundLorg_eclipse_swt_graphics_Color() { assertNotNull(tree.getHeaderForeground()); - Color color = new Color(control.getDisplay(), 12, 34, 56); + Color color = new Color(12, 34, 56); tree.setHeaderForeground(color); assertEquals(color, tree.getHeaderForeground()); tree.setHeaderForeground(null); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java index 01cf2ca5da..c5cb3c0d17 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java @@ -745,7 +745,7 @@ public void test_setBackgroundILorg_eclipse_swt_graphics_Color() { assertEquals(tree.getBackground(),treeItem.getBackground(0)); try { - Color color = new Color(display, 255, 0, 0); + Color color = new Color(255, 0, 0); color.dispose(); treeItem.setBackground(color); fail("No exception thrown for color disposed"); @@ -755,7 +755,7 @@ public void test_setBackgroundILorg_eclipse_swt_graphics_Color() { @Test public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(treeItem.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); treeItem.setBackground(color); assertEquals(color, treeItem.getBackground()); treeItem.setBackground(null); @@ -919,7 +919,7 @@ public void test_setForegroundILorg_eclipse_swt_graphics_Color() { assertEquals(tree.getForeground(),treeItem.getForeground(0)); try { - Color color = new Color(display, 255, 0, 0); + Color color = new Color(255, 0, 0); color.dispose(); treeItem.setForeground(color); fail("No exception thrown for color disposed"); @@ -929,7 +929,7 @@ public void test_setForegroundILorg_eclipse_swt_graphics_Color() { @Test public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(treeItem.getDisplay(), 255, 0, 0); + Color color = new Color(255, 0, 0); treeItem.setForeground(color); assertEquals(color, treeItem.getForeground()); treeItem.setForeground(null); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_situational.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_situational.java index 2e9cab4c42..0ff14c88d0 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_situational.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_situational.java @@ -226,8 +226,8 @@ public void test_imageDrawing() { int width = 640; int height = 480; Image image = new Image(display, width, height); - Color color1 = new Color(display, 0xff, 0, 0xff); - Color color2 = new Color(display, 0, 0xff, 0xff); + Color color1 = new Color(0xff, 0, 0xff); + Color color2 = new Color(0, 0xff, 0xff); int x1 = 0, y1 = height/2, x2 = width/2, y2 = 0; meter.start(); GC gc = new GC(image); @@ -277,8 +277,8 @@ public void test_windowDrawing() { while(display.readAndDispatch()){/*empty*/} try { Thread.sleep(2000); } catch (Exception e) {} while(display.readAndDispatch()){/*empty*/} - Color color1 = new Color(display, 0xff, 0, 0xff); - Color color2 = new Color(display, 0, 0xff, 0xff); + Color color1 = new Color(0xff, 0, 0xff); + Color color2 = new Color(0, 0xff, 0xff); int x1 = 0, y1 = height/2, x2 = width/2, y2 = 0; meter.start(); GC gc = new GC(c); @@ -323,8 +323,8 @@ public void test_stringDrawing() { while(display.readAndDispatch()){/*empty*/} try { Thread.sleep(2000); } catch (Exception e) {} while(display.readAndDispatch()){/*empty*/} - Color color1 = new Color(display, 0xff, 0, 0xff); - Color color2 = new Color(display, 0, 0xff, 0xff); + Color color1 = new Color(0xff, 0, 0xff); + Color color2 = new Color(0, 0xff, 0xff); Font font1 = new Font(display, "Helvetica", 20, SWT.NONE); Font font2 = new Font(display, "Helvetica", 10, SWT.BOLD); String testString = "The quick \tbr&own SWT jum&ped foxily o\nver the lazy dog."; @@ -372,8 +372,8 @@ public void test_fastStringDrawing() { while(display.readAndDispatch()){/*empty*/} try { Thread.sleep(2000); } catch (Exception e) {} while(display.readAndDispatch()){/*empty*/} - Color color1 = new Color(display, 0xff, 0, 0xff); - Color color2 = new Color(display, 0, 0xff, 0xff); + Color color1 = new Color(0xff, 0, 0xff); + Color color2 = new Color(0, 0xff, 0xff); Font font1 = new Font(display, "Helvetica", 20, SWT.NONE); Font font2 = new Font(display, "Helvetica", 10, SWT.BOLD); String testString = "The quick brown SWT jumped foxily over the lazy dog."; |