diff options
author | Chris Goldthorpe | 2009-07-15 16:11:24 +0000 |
---|---|---|
committer | Chris Goldthorpe | 2009-07-15 16:11:24 +0000 |
commit | 17c8128f5281662c346f19002bb477da04706180 (patch) | |
tree | da431fe4d74bfd25e64f730ccb74f95da5658ee5 /org.eclipse.ua.tests/browser/org | |
parent | 723efd3cab9249b54cff9c554a4b95ae6fc3bc10 (diff) | |
download | eclipse.platform.ua-17c8128f5281662c346f19002bb477da04706180.tar.gz eclipse.platform.ua-17c8128f5281662c346f19002bb477da04706180.tar.xz eclipse.platform.ua-17c8128f5281662c346f19002bb477da04706180.zip |
Bug 283359 [Browser] WebBrowserEditorInput#equals(Object) is wrong
Diffstat (limited to 'org.eclipse.ua.tests/browser/org')
3 files changed, 114 insertions, 0 deletions
diff --git a/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/AllBrowserTests.java b/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/AllBrowserTests.java index 2659ff91c..b3b481b90 100644 --- a/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/AllBrowserTests.java +++ b/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/AllBrowserTests.java @@ -14,6 +14,7 @@ import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.ua.tests.browser.external.AllExternalBrowserTests; +import org.eclipse.ua.tests.browser.other.AllOtherBrowserTests; /* * Tests all cheat sheet functionality (automated). @@ -32,5 +33,6 @@ public class AllBrowserTests extends TestSuite { */ public AllBrowserTests() { addTest(AllExternalBrowserTests.suite()); + addTest(AllOtherBrowserTests.suite()); } } diff --git a/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/other/AllOtherBrowserTests.java b/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/other/AllOtherBrowserTests.java new file mode 100644 index 000000000..56b8afa02 --- /dev/null +++ b/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/other/AllOtherBrowserTests.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ua.tests.browser.other; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllOtherBrowserTests extends TestSuite { + + /* + * Returns the entire test suite. + */ + public static Test suite() { + return new AllOtherBrowserTests(); + } + + /* + * Constructs a new test suite. + */ + public AllOtherBrowserTests() { + addTestSuite(TestInput.class); + } +} diff --git a/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/other/TestInput.java b/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/other/TestInput.java new file mode 100644 index 000000000..d77b9c891 --- /dev/null +++ b/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/other/TestInput.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ua.tests.browser.other; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.ui.browser.IWorkbenchBrowserSupport; +import org.eclipse.ui.internal.browser.WebBrowserEditorInput; +import junit.framework.TestCase; + +public class TestInput extends TestCase { + + private final String URL1 = "http://www.eclipse.org"; + private final String URL2 = "http://bugs.eclipse.org"; + private static final String ID1 = "browser.id1"; + private static final String ID2 = "browser.id2"; + + public void testCompareWithNull() throws MalformedURLException { + WebBrowserEditorInput input = new WebBrowserEditorInput(new URL(URL1), + 0, ID1); + assertFalse(input.equals(null)); + } + + public void testCompareWithSelf() throws MalformedURLException { + WebBrowserEditorInput input = new WebBrowserEditorInput(new URL(URL1), + 0, ID1); + assertTrue(input.equals(input)); + } + + public void testCompareWithSimilar() throws MalformedURLException { + WebBrowserEditorInput input = new WebBrowserEditorInput(new URL(URL1), + 0, ID1); + WebBrowserEditorInput input2 = new WebBrowserEditorInput(new URL(URL1), + 0, ID1); + assertTrue(input.equals(input2)); + } + + public void testCompareWithDifferentUrl() throws MalformedURLException { + WebBrowserEditorInput input = new WebBrowserEditorInput(new URL(URL1), + 0, ID1); + WebBrowserEditorInput input2 = new WebBrowserEditorInput(new URL(URL2), + 0, ID1); + assertFalse(input.equals(input2)); + } + + public void testCompareWithDifferentId() throws MalformedURLException { + WebBrowserEditorInput input = new WebBrowserEditorInput(new URL(URL1), + 0, ID1); + WebBrowserEditorInput input2 = new WebBrowserEditorInput(new URL(URL1), + 0, ID2); + assertFalse(input.equals(input2)); + } + + public void testCompareWithDifferentStyle() throws MalformedURLException { + WebBrowserEditorInput input = new WebBrowserEditorInput(new URL(URL1), + 0, ID1); + WebBrowserEditorInput input2 = new WebBrowserEditorInput(new URL(URL1), + 1, ID1); + assertTrue(input.equals(input2)); + } + + public void testCompareWithStatusbarVisible() throws MalformedURLException { + WebBrowserEditorInput input = new WebBrowserEditorInput(new URL(URL1), + 0, ID1); + WebBrowserEditorInput input2 = new WebBrowserEditorInput(new URL(URL1), + IWorkbenchBrowserSupport.STATUS, ID1); + assertFalse(input.equals(input2)); + } + +} |