diff options
author | Lars Vogel | 2015-03-10 09:48:10 +0000 |
---|---|---|
committer | Lars Vogel | 2015-03-10 09:48:10 +0000 |
commit | a85f5faa2038ea8ffcf2b849c211f3830ec55ca4 (patch) | |
tree | 651e3ade74b45ceeda89122199559cbb31e0ed93 | |
parent | 9ab5e5216430b8847f9c25e11c31afbc3521d5d0 (diff) | |
download | eclipse.platform.ui-a85f5faa2038ea8ffcf2b849c211f3830ec55ca4.tar.gz eclipse.platform.ui-a85f5faa2038ea8ffcf2b849c211f3830ec55ca4.tar.xz eclipse.platform.ui-a85f5faa2038ea8ffcf2b849c211f3830ec55ca4.zip |
Bug 449736 - [Tests] Solve whitespace issues in org.eclipse.ui.tests
plug-ins
Change-Id: I763ce4ad6df12112598b0df8288d6f92dff414ab
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
10 files changed, 63 insertions, 62 deletions
diff --git a/tests/org.eclipse.ui.tests.forms/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.ui.tests.forms/.settings/org.eclipse.jdt.core.prefs index c0e9757ff94..f2e31d96a2d 100755 --- a/tests/org.eclipse.ui.tests.forms/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.eclipse.ui.tests.forms/.settings/org.eclipse.jdt.core.prefs @@ -288,3 +288,4 @@ org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/tests/org.eclipse.ui.tests.forms/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.ui.tests.forms/.settings/org.eclipse.jdt.ui.prefs index 32fe9378abc..d7de1c3d8a3 100644 --- a/tests/org.eclipse.ui.tests.forms/.settings/org.eclipse.jdt.ui.prefs +++ b/tests/org.eclipse.ui.tests.forms/.settings/org.eclipse.jdt.ui.prefs @@ -4,7 +4,7 @@ formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile formatter_settings_version=12 sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_annotations=false sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false @@ -28,7 +28,7 @@ sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=false sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true @@ -37,10 +37,10 @@ sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_redundant_type_arguments=true -sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_casts=false sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=false sp_cleanup.remove_unused_local_variables=false diff --git a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/layout/TestColumnWrapLayout.java b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/layout/TestColumnWrapLayout.java index 64db3710afe..c55b22c5a3e 100644 --- a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/layout/TestColumnWrapLayout.java +++ b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/layout/TestColumnWrapLayout.java @@ -24,9 +24,9 @@ import org.eclipse.ui.forms.widgets.ColumnLayout; import org.eclipse.ui.internal.forms.widgets.ColumnLayoutUtils; public class TestColumnWrapLayout extends TestCase { - - private final Point p20 = new Point(100, 20); - private final Point p30 = new Point(100, 30); + + private final Point p20 = new Point(100, 20); + private final Point p30 = new Point(100, 30); private final Point p50 = new Point(100, 50); private final Point p100 = new Point(100, 100); private final Point p200 = new Point(100, 200); @@ -35,7 +35,7 @@ public class TestColumnWrapLayout extends TestCase { Point[] sizes = { p20, p30, p30, p20, p20, p30 }; assertEquals(50, ColumnLayoutUtils.computeColumnHeight(3, sizes, 237, 0)); } - + public void testEqualSizeColumnsWithMargins() { Point[] sizes = { p20, p30, p30, p20, p20, p30 }; assertEquals(60, ColumnLayoutUtils.computeColumnHeight(3, sizes, 200, 10)); @@ -50,26 +50,26 @@ public class TestColumnWrapLayout extends TestCase { Point[] sizes = { p50, p30, p30, p30, p50, p50, p100 }; assertEquals(100, ColumnLayoutUtils.computeColumnHeight(4, sizes, 100, 0)); } - + public void testLargeMargins() { Point[] sizes = { p20, p20, p20, p20, p20, p50, p50}; assertEquals(260, ColumnLayoutUtils.computeColumnHeight(3, sizes, 100, 100)); } - + private class SizedComposite extends Composite { - + int height; public SizedComposite(Composite parent, int style, int height) { super(parent, style); this.height = height; } - + public Point computeSize(int wHint, int hHint, boolean changed) { - return new Point( 20, height); - } + return new Point( 20, height); + } } - + /** * Test that labels with the WRAP property set do indeed wrap. */ diff --git a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/layout/TestTableWrapLayout.java b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/layout/TestTableWrapLayout.java index da8ffea5b9e..ec1348fe6cc 100755 --- a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/layout/TestTableWrapLayout.java +++ b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/layout/TestTableWrapLayout.java @@ -31,13 +31,13 @@ public class TestTableWrapLayout extends TestCase { private final String A20 = A10 + " " + A10; private final String A40 = A20 + " " + A20; private final String A80 = A40 + " " + A40; - + // Returns the width + left private int rightEdge(Label lab) { Rectangle r = lab.getBounds(); return r.x + r.width; } - + /** * Test that labels with the WRAP property set do indeed wrap. */ @@ -57,7 +57,7 @@ public class TestTableWrapLayout extends TestCase { assertTrue(l2.getSize().x > 100); shell.dispose(); } - + /** * Test that labels with the WRAP property set do indeed wrap. */ @@ -86,11 +86,11 @@ public class TestTableWrapLayout extends TestCase { assertTrue(l1.getSize().y > originalHeight); shell.dispose(); } - + /** * Test that labels with the WRAP property set do indeed wrap. */ - // Test suppressed for now, see Bug 196686 + // Test suppressed for now, see Bug 196686 public void suppressed_testTableWrapLayoutWrappingLabels() { Display display = PlatformUI.getWorkbench().getDisplay(); Shell shell = new Shell(display); @@ -109,7 +109,7 @@ public class TestTableWrapLayout extends TestCase { assertTrue("Labels overlap", l2.getBounds().y >= l1.getBounds().y + l1.getBounds().height); shell.dispose(); } - + /** * Test a 2x2 grid with unequal sizes */ @@ -142,11 +142,11 @@ public class TestTableWrapLayout extends TestCase { assertTrue("Labels overlap", l4.getBounds().y >= l2.getBounds().y + l2.getBounds().height); shell.dispose(); } - + /** * Test alignments and margins */ - // Suppressed for now - see Bug 196686 + // Suppressed for now - see Bug 196686 public void suppressed_testTableWrapLayoutAlignment() { Display display = PlatformUI.getWorkbench().getDisplay(); Shell shell = new Shell(display); @@ -190,18 +190,18 @@ public class TestTableWrapLayout extends TestCase { assertEquals(LEFT_MARGIN , labLeft.getBounds().x); assertTrue(rightEdge(lab0) > rightEdge(labLeft)); assertTrue(rightEdge(labLeft) + tableWrapLayout.rightMargin < 100); - + assertEquals(rightEdge(labRight), rightEdge(lab0)); assertTrue(labRight.getBounds().x > LEFT_MARGIN); - + assertTrue(labCenter.getBounds().x > LEFT_MARGIN); assertTrue(rightEdge(lab0) > rightEdge(labCenter)); - - int offCenter = rightEdge(labCenter) + labCenter.getBounds().x + + int offCenter = rightEdge(labCenter) + labCenter.getBounds().x - rightEdge(lab0) + lab0.getBounds().x; assertTrue(offCenter >= -2); assertTrue(offCenter <= 2); - + assertEquals(LEFT_MARGIN , labFill.getBounds().x); assertEquals(rightEdge(labFill), rightEdge(lab0)); shell.dispose(); diff --git a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/performance/FormsPerformanceTest.java b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/performance/FormsPerformanceTest.java index ec8a6425c81..b043bded346 100755 --- a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/performance/FormsPerformanceTest.java +++ b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/performance/FormsPerformanceTest.java @@ -40,11 +40,11 @@ import org.eclipse.ui.forms.widgets.TableWrapData; import org.eclipse.ui.forms.widgets.TableWrapLayout; public class FormsPerformanceTest extends PerformanceTestCase { - + public void test_createForm() { tagAsSummary("Create Form", Dimension.ELAPSED_PROCESS); Performance.getDefault(); - + // Warm up. Display display = PlatformUI.getWorkbench().getDisplay(); @@ -61,7 +61,7 @@ public class FormsPerformanceTest extends PerformanceTestCase { Composite c = new Composite(shell, SWT.H_SCROLL + SWT.V_SCROLL); c.setLayout(new FillLayout()); createPartControl(c, toolkit); - shell.layout(true); + shell.layout(true); while(display.readAndDispatch()){/*empty*/} c.dispose(); } @@ -83,15 +83,15 @@ public class FormsPerformanceTest extends PerformanceTestCase { while(display.readAndDispatch()){/*empty*/} c.dispose(); } - stopMeasuring(); + stopMeasuring(); shell.dispose(); while(display.readAndDispatch()){/*empty*/} - } + } toolkit.dispose(); commitMeasurements(); assertPerformance(); } - + public void createPartControl(Composite parent, FormToolkit toolkit) { //Label l = new Label(parent, SWT.NULL); //l.setText ("a label"); @@ -100,7 +100,7 @@ public class FormsPerformanceTest extends PerformanceTestCase { form.setText("Hello, Eclipse Forms"); TableWrapLayout layout = new TableWrapLayout(); form.getBody().setLayout(layout); - + Hyperlink link = toolkit.createHyperlink(form.getBody(), "Click here.", SWT.WRAP); link.addHyperlinkListener(new HyperlinkAdapter() { @@ -122,13 +122,13 @@ public class FormsPerformanceTest extends PerformanceTestCase { td = new TableWrapData(); td.colspan = 2; button.setLayoutData(td); - + ImageHyperlink ih = toolkit.createImageHyperlink(form.getBody(), SWT.NULL); ih.setText("Image link with no image"); ih = toolkit.createImageHyperlink(form.getBody(), SWT.NULL); //ih.setImage(ExamplesPlugin.getDefault().getImageRegistry().get(ExamplesPlugin.IMG_SAMPLE)); ih.setText("Link with image and text"); - + ExpandableComposite ec = toolkit.createExpandableComposite(form.getBody(), ExpandableComposite.TREE_NODE|ExpandableComposite.CLIENT_INDENT); ImageHyperlink eci = toolkit.createImageHyperlink(ec, SWT.NULL); //eci.setImage(ExamplesPlugin.getDefault().getImageRegistry().get(ExamplesPlugin.IMG_SAMPLE)); @@ -205,7 +205,7 @@ public class FormsPerformanceTest extends PerformanceTestCase { /* layout.numColumns = 3; Label label; TableWrapData td; - + label = toolkit.createLabel(form.getBody(), "Some text to put in the first column", SWT.WRAP); label = toolkit.createLabel(form.getBody() ,"Some text to put in the second column and make it a bit longer so that we can see what happens with column distribution. This text must be the longest so that it can get more space allocated to the columns it belongs to.", SWT.WRAP); td = new TableWrapData(); @@ -224,7 +224,7 @@ public class FormsPerformanceTest extends PerformanceTestCase { label = toolkit.createLabel(form.getBody(), "This text goes into column 3 and consumes only one cell too", SWT.WRAP); label.setLayoutData(new TableWrapData(TableWrapData.FILL)); form.getBody().setBackground(form.getBody().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));*/ - + toolkit.paintBordersFor(form.getBody()); } diff --git a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/plugin/FormsTestPlugin.java b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/plugin/FormsTestPlugin.java index 0e3ceb246e0..dc0b816d0e2 100755 --- a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/plugin/FormsTestPlugin.java +++ b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/plugin/FormsTestPlugin.java @@ -23,7 +23,7 @@ public class FormsTestPlugin extends AbstractUIPlugin { // The shared instance private static FormsTestPlugin plugin; - + /** * The constructor */ diff --git a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormColorsTests.java b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormColorsTests.java index 94c2089ff84..74e438a7689 100644 --- a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormColorsTests.java +++ b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormColorsTests.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ - + package org.eclipse.ui.tests.forms.util; import junit.framework.TestCase; @@ -45,7 +45,7 @@ public class FormColorsTests extends TestCase { private static String TEST_KEY_1 = "testKey1"; private static String TEST_KEY_2 = "testKey2"; - + public void testStandalone() { FormColors fColors = new FormColors(Display.getCurrent()); Color[] colors = new Color[KEYS_NON_NULL.length]; @@ -78,7 +78,7 @@ public class FormColorsTests extends TestCase { if (testBorderDispose) Assert.assertFalse("FormColors disposed getBorderColor() when it shouldn't have", bc.isDisposed()); } - + public void testMultiple() { FormColors fColors = new FormColors(Display.getCurrent()); Color[] colors = new Color[KEYS_NON_NULL.length]; @@ -165,7 +165,7 @@ public class FormColorsTests extends TestCase { Assert.assertFalse("Last FormToolkit with shared FormColors disposed getBorderColor() when it shouldn't have", bc.isDisposed()); fColors.dispose(); } - + public void testCustom() { FormColors fColors = new FormColors(Display.getCurrent()); Color test1 = fColors.createColor(TEST_KEY_1, 255, 155, 55); diff --git a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormFontsTests.java b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormFontsTests.java index d15c3b3bf5d..6ec258d05fa 100755 --- a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormFontsTests.java +++ b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormFontsTests.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ - + package org.eclipse.ui.tests.forms.util; import junit.framework.TestCase; @@ -30,7 +30,7 @@ public class FormFontsTests extends TestCase { // ensure the singleton is returning the same instance after creating and disposing one gradient Assert.assertTrue("getInstance() returned a different FormFonts instance after creation and disposal of one bold font", instance.equals(FormFonts.getInstance())); } - + public void testDisposeOne() { Display display = Display.getCurrent(); Font boldSystemFont = FormFonts.getInstance().getBoldFont(display, display.getSystemFont()); @@ -38,7 +38,7 @@ public class FormFontsTests extends TestCase { // ensure that getting a single gradient and marking it as finished disposed it Assert.assertTrue("markFinished(...) did not dispose a font after a single getBoldFont()", boldSystemFont.isDisposed()); } - + public void testMultipleInstances() { Display display = Display.getCurrent(); Font boldSystemFont = FormFonts.getInstance().getBoldFont(display, display.getSystemFont()); @@ -57,7 +57,7 @@ public class FormFontsTests extends TestCase { Assert.assertTrue("markFinished(...) did not dispose a shared font on the last call",boldSystemFont.isDisposed()); } } - + public void testMultipleFonts() { Display display = Display.getCurrent(); Font veranda = new Font(display, "Veranda",12,SWT.NORMAL); @@ -73,7 +73,7 @@ public class FormFontsTests extends TestCase { veranda.dispose(); arial.dispose(); } - + public void testDisposeUnknown() { Display display = Display.getCurrent(); Font system = new Font(display, display.getSystemFont().getFontData()); diff --git a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormImagesTests.java b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormImagesTests.java index 92a594f9ffb..d28f983b992 100755 --- a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormImagesTests.java +++ b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormImagesTests.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ - + package org.eclipse.ui.tests.forms.util; import java.lang.reflect.Field; @@ -36,7 +36,7 @@ public class FormImagesTests extends TestCase { Assert.assertTrue("getInstance() returned a different FormImages instance after creation and disposal of one image", instance.equals(FormImages.getInstance())); Assert.assertNull("descriptors map", getDescriptors(FormImages.getInstance())); } - + public void testDisposeOne() throws Exception { Display display = Display.getCurrent(); Image gradient = FormImages.getInstance().getGradient(new Color(display, 255, 255, 255), new Color(display, 0, 0, 0), 21, 21, 0, display); @@ -45,7 +45,7 @@ public class FormImagesTests extends TestCase { Assert.assertTrue("markFinished(...) did not dispose an image after a single getGradient()", gradient.isDisposed()); Assert.assertNull("descriptors map", getDescriptors(FormImages.getInstance())); } - + public void testMultipleSimpleInstances() throws Exception { Display display = Display.getCurrent(); Image gradient = FormImages.getInstance().getGradient(new Color(display, 200, 200, 200), new Color(display, 0, 0, 0), 30, 16, 3, display); @@ -65,7 +65,7 @@ public class FormImagesTests extends TestCase { } Assert.assertNull("descriptors map", getDescriptors(FormImages.getInstance())); } - + public void testMultipleComplexInstances() throws Exception { Display display = Display.getCurrent(); Image gradient = FormImages.getInstance().getGradient(new Color[] {new Color(display, 200, 200, 200), new Color(display, 0, 0, 0)}, @@ -87,7 +87,7 @@ public class FormImagesTests extends TestCase { } Assert.assertNull("descriptors map", getDescriptors(FormImages.getInstance())); } - + public void testMultipleUniqueInstances() throws Exception { Display display = Display.getCurrent(); Image[] images = new Image[24]; @@ -141,7 +141,7 @@ public class FormImagesTests extends TestCase { } Assert.assertNull("descriptors map", getDescriptors(FormImages.getInstance())); } - + public void testComplexEquality() throws Exception { Display display = Display.getCurrent(); Image image1 = FormImages.getInstance().getGradient(new Color[] {new Color(display,0,0,0), new Color(display,255,255,255)}, @@ -160,11 +160,11 @@ public class FormImagesTests extends TestCase { FormImages.getInstance().markFinished(image2, display); Assert.assertNull("descriptors map", getDescriptors(FormImages.getInstance())); } - + public void testToolkitColors() throws Exception { String blueKey = "blue"; String redKey = "red"; - + Display display = Display.getCurrent(); FormToolkit kit1 = new FormToolkit(display); kit1.getColors().createColor(blueKey, new RGB(0,0,255)); @@ -189,7 +189,7 @@ public class FormImagesTests extends TestCase { Assert.assertTrue("image was not disposed", image3.isDisposed()); Assert.assertNull("descriptors map", getDescriptors(FormImages.getInstance())); } - + public void testDisposeUnknown() throws Exception { Display display = Display.getCurrent(); Image image = new Image(display, 10, 10); diff --git a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormToolkitTest.java b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormToolkitTest.java index f2a3601d61c..455665f3e59 100644 --- a/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormToolkitTest.java +++ b/tests/org.eclipse.ui.tests.forms/forms/org/eclipse/ui/tests/forms/util/FormToolkitTest.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ - + package org.eclipse.ui.tests.forms.util; import junit.framework.TestCase; @@ -17,7 +17,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.ui.forms.widgets.FormToolkit; public class FormToolkitTest extends TestCase { - + /* * Verify that calling dispose twice does not cause an NPE */ @@ -26,6 +26,6 @@ public class FormToolkitTest extends TestCase { FormToolkit toolkit = new FormToolkit(display); toolkit.dispose(); toolkit.dispose(); - } - + } + } |