diff options
Diffstat (limited to 'tests/org.eclipse.wst.css.ui.tests')
25 files changed, 0 insertions, 1539 deletions
diff --git a/tests/org.eclipse.wst.css.ui.tests/.classpath b/tests/org.eclipse.wst.css.ui.tests/.classpath deleted file mode 100644 index ce7393340..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/tests/org.eclipse.wst.css.ui.tests/.cvsignore b/tests/org.eclipse.wst.css.ui.tests/.cvsignore deleted file mode 100644 index fb621e75d..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -bin -bin.project -build.xml -dev.properties -org.eclipse.wst.css.ui.tests_1.0.0.jar -cssuitests.jar -temp.folder -PerformanceResults diff --git a/tests/org.eclipse.wst.css.ui.tests/.project b/tests/org.eclipse.wst.css.ui.tests/.project deleted file mode 100644 index d41d16cab..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.wst.css.ui.tests</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.core.resources.prefs b/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index afa5c9135..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Apr 04 03:36:32 EDT 2006 -eclipse.preferences.version=1 -encoding/<project>=ISO-8859-1 diff --git a/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2dd8b5cef..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,80 +0,0 @@ -#Sun Apr 16 14:37:21 EDT 2006 -eclipse.preferences.version=1 -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.builder.duplicateResourceTask=warning -org.eclipse.jdt.core.builder.invalidClasspath=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.classpath.exclusionPatterns=enabled -org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=error -org.eclipse.jdt.core.compiler.problem.unusedLabel=error -org.eclipse.jdt.core.compiler.problem.unusedLocal=error -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 -org.eclipse.jdt.core.incompatibleJDKLevel=ignore -org.eclipse.jdt.core.incompleteClasspath=error diff --git a/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index ef2ac6532..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Apr 04 03:36:39 EDT 2006 -eclipse.preferences.version=1 -internal.default.compliance=default diff --git a/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.ltk.core.refactoring.prefs b/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.ltk.core.refactoring.prefs deleted file mode 100644 index c59368c5e..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.ltk.core.refactoring.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Apr 04 03:36:32 EDT 2006 -eclipse.preferences.version=1 -org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.pde.prefs b/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.pde.prefs deleted file mode 100644 index f72495846..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,15 +0,0 @@ -#Sun Apr 16 14:05:29 EDT 2006 -compilers.p.build=0 -compilers.p.deprecated=1 -compilers.p.illegal-att-value=0 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=0 -compilers.p.unknown-attribute=0 -compilers.p.unknown-class=0 -compilers.p.unknown-element=0 -compilers.p.unknown-resource=0 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.p.unused-element-or-attribute=0 -compilers.use-project=true -eclipse.preferences.version=1 diff --git a/tests/org.eclipse.wst.css.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.css.ui.tests/META-INF/MANIFEST.MF deleted file mode 100644 index 9eba7c89a..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/META-INF/MANIFEST.MF +++ /dev/null @@ -1,26 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %Bundle-Name.0 -Bundle-SymbolicName: org.eclipse.wst.css.ui.tests; singleton:=true -Bundle-Version: 1.0.300.qualifier -Bundle-Activator: org.eclipse.wst.css.ui.tests.CSSUITestsPlugin -Bundle-Vendor: %Bundle-Vendor.0 -Bundle-Localization: plugin -Export-Package: org.eclipse.wst.css.ui.tests, - org.eclipse.wst.css.ui.tests.viewer -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.wst.css.ui, - org.eclipse.wst.sse.ui, - org.eclipse.wst.css.core, - org.eclipse.jface.text, - org.eclipse.ui.workbench, - org.eclipse.ui.editors, - org.eclipse.wst.sse.core, - org.junit;bundle-version=3.8.2, - org.eclipse.core.resources, - org.eclipse.ui.ide -Eclipse-LazyStart: true -Bundle-ClassPath: cssuitests.jar -Bundle-RequiredExecutionEnvironment: J2SE-1.4 -Import-Package: org.eclipse.core.resources diff --git a/tests/org.eclipse.wst.css.ui.tests/about.html b/tests/org.eclipse.wst.css.ui.tests/about.html deleted file mode 100644 index 2199df3f0..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<HTML> - -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> - -<BODY lang="EN-US"> - -<H3>About This Content</H3> - -<P>June, 2008</P> - -<H3>License</H3> - -<P>The Eclipse Foundation makes available all content in this plug-in -("Content"). Unless otherwise indicated below, the Content is provided to you -under the terms and conditions of the Eclipse Public License Version 1.0 -("EPL"). A copy of the EPL is available at -<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>. -For purposes of the EPL, "Program" will mean the Content.</P> - -<P>If you did not receive this Content directly from the Eclipse Foundation, the -Content is being redistributed by another party ("Redistributor") and different -terms and conditions may apply to your use of any object code in the Content. -Check the Redistributor’s license that was provided with the Content. If no such -license exists, contact the Redistributor. Unless otherwise indicated below, the -terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at -<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P> - -</BODY> -</HTML> diff --git a/tests/org.eclipse.wst.css.ui.tests/build.properties b/tests/org.eclipse.wst.css.ui.tests/build.properties deleted file mode 100644 index 841a8852c..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/build.properties +++ /dev/null @@ -1,11 +0,0 @@ -bin.includes = META-INF/,\ - cssuitests.jar,\ - about.html,\ - src/,\ - test.xml,\ - testresources/,\ - plugin.properties,\ - plugin.xml -jars.compile.order = cssuitests.jar -source.cssuitests.jar = src/ -output.cssuitests.jar = bin/ diff --git a/tests/org.eclipse.wst.css.ui.tests/plugin.properties b/tests/org.eclipse.wst.css.ui.tests/plugin.properties deleted file mode 100644 index 81436bb88..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2005, 2006 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 -############################################################################### -# properties file for org.eclipse.wst.css.ui.tests -Bundle-Vendor.0 = Eclipse -Bundle-Name.0 = CSS UI Tests Plug-in
\ No newline at end of file diff --git a/tests/org.eclipse.wst.css.ui.tests/plugin.xml b/tests/org.eclipse.wst.css.ui.tests/plugin.xml deleted file mode 100644 index e31b4d14f..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/plugin.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> -<plugin> - <extension point="org.eclipse.wst.sse.ui.editorConfiguration"> - <provisionalConfiguration - type="sourceReconcilingListener" target="org.eclipse.wst.css.core.csssource" class="org.eclipse.wst.css.ui.tests.viewer.CSSCodeFoldingTest"/> - </extension> -</plugin> diff --git a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/CSSUITestSuite.java b/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/CSSUITestSuite.java deleted file mode 100644 index 5aeb29117..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/CSSUITestSuite.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.eclipse.wst.css.ui.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.wst.css.ui.tests.viewer.CSSCodeFoldingTest; -import org.eclipse.wst.css.ui.tests.viewer.TestCSSContentAssist; -import org.eclipse.wst.css.ui.tests.viewer.TestViewerConfigurationCSS; - -public class CSSUITestSuite extends TestSuite { - public static Test suite() { - return new CSSUITestSuite(); - } - - public CSSUITestSuite() { - super("CSS UI Test Suite"); - addTest(new TestSuite(ExistenceTest.class, "CSS UI Existence Test")); - addTest(new TestSuite(TestViewerConfigurationCSS.class)); - addTest(new TestSuite(TestEditorConfigurationCSS.class)); - addTest(new TestSuite(TestCSSContentAssist.class)); - addTest(CSSCodeFoldingTest.suite()); - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/CSSUITestsPlugin.java b/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/CSSUITestsPlugin.java deleted file mode 100644 index 21f0f047c..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/CSSUITestsPlugin.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.wst.css.ui.tests; - -import org.eclipse.ui.plugin.*; -import org.eclipse.jface.resource.ImageDescriptor; -import org.osgi.framework.BundleContext; - -/** - * The main plugin class to be used in the desktop. - */ -public class CSSUITestsPlugin extends AbstractUIPlugin { - - //The shared instance. - private static CSSUITestsPlugin plugin; - - /** - * The constructor. - */ - public CSSUITestsPlugin() { - plugin = this; - } - - /** - * This method is called upon plug-in activation - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /** - * This method is called when the plug-in is stopped - */ - public void stop(BundleContext context) throws Exception { - super.stop(context); - plugin = null; - } - - /** - * Returns the shared instance. - */ - public static CSSUITestsPlugin getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given - * plug-in relative path. - * - * @param path the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.wst.css.ui.tests", path); - } -} diff --git a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/ExistenceTest.java b/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/ExistenceTest.java deleted file mode 100644 index 893127f34..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/ExistenceTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.eclipse.wst.css.ui.tests; - -import junit.framework.TestCase; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.wst.css.ui.internal.CSSUIPlugin; - -/** - * - * @since 1.0 - */ -public class ExistenceTest extends TestCase { - /** - * tests if CSSUIPlugin can be loaded - */ - public void testExists() { - Plugin p = CSSUIPlugin.getDefault(); - assertNotNull("couldn't load CSS UI plugin", p); - } -} diff --git a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/ProjectUtil.java b/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/ProjectUtil.java deleted file mode 100644 index d655fd14f..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/ProjectUtil.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * 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.wst.css.ui.tests; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; - -public class ProjectUtil { - static void _copyBundleEntriesIntoWorkspace(final String rootEntry, final String fullTargetPath) throws CoreException { - Enumeration entries = CSSUITestsPlugin.getDefault().getBundle().getEntryPaths(rootEntry); - while (entries != null && entries.hasMoreElements()) { - String entryPath = entries.nextElement().toString(); - String targetPath = new Path(fullTargetPath + "/" + entryPath.substring(rootEntry.length())).toString(); - if (entryPath.endsWith("/")) { - IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(targetPath)); - if (!folder.exists()) { - folder.create(true, true, new NullProgressMonitor()); - } - _copyBundleEntriesIntoWorkspace(entryPath, targetPath); - } - else { - _copyBundleEntryIntoWorkspace(entryPath, targetPath); - } - // System.out.println(entryPath + " -> " + targetPath); - } - } - - static IFile _copyBundleEntryIntoWorkspace(String entryname, String fullPath) throws CoreException { - IFile file = null; - URL entry = CSSUITestsPlugin.getDefault().getBundle().getEntry(entryname); - if (entry != null) { - try { - byte[] b = new byte[2048]; - InputStream input = entry.openStream(); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - int i = -1; - while ((i = input.read(b)) > -1) { - output.write(b, 0, i); - } - file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fullPath)); - if (file != null) { - if (!file.exists()) { - file.create(new ByteArrayInputStream(output.toByteArray()), true, new NullProgressMonitor()); - } - else { - file.setContents(new ByteArrayInputStream(output.toByteArray()), true, false, new NullProgressMonitor()); - } - } - } - catch (IOException e) { - e.printStackTrace(); - } - catch (CoreException e) { - e.printStackTrace(); - } - } - return file; - } - - /** - * @param rootEntry - avoid trailing separators - * @param fullTargetPath - */ - public static void copyBundleEntriesIntoWorkspace(final String rootEntry, final String fullTargetPath) { - IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - _copyBundleEntriesIntoWorkspace(rootEntry, fullTargetPath); - ResourcesPlugin.getWorkspace().checkpoint(true); - } - }; - try { - ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor()); - } - catch (CoreException e) { - e.printStackTrace(); - } - } - - /** - * - * @param entryname - * path relative to TEST plugin starting w/ a "/" (eg. - * "/testfiles/bugnumber/struts-logic.tld") - * @param fullPath - * path relative to junit test workpace (eg. - * "/myruntimeproj/struts-logic.tld") - * @return - */ - public static IFile copyBundleEntryIntoWorkspace(final String entryname, final String fullPath) { - final IFile file[] = new IFile[1]; - IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - file[0] = _copyBundleEntryIntoWorkspace(entryname, fullPath); - ResourcesPlugin.getWorkspace().checkpoint(true); - } - }; - try { - ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor()); - } - catch (CoreException e) { - e.printStackTrace(); - } - return file[0]; - } - - public static IProject createProject(String name, IPath location, String[] natureIds) { - IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(name); - if (location != null) { - description.setLocation(location); - } - if (natureIds != null) { - description.setNatureIds(natureIds); - } - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - try { - project.create(description, new NullProgressMonitor()); - project.open(new NullProgressMonitor()); - } - catch (CoreException e) { - e.printStackTrace(); - } - return project; - } -} diff --git a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/TestEditorConfigurationCSS.java b/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/TestEditorConfigurationCSS.java deleted file mode 100644 index 65ad4c94f..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/TestEditorConfigurationCSS.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - Initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - * / - *******************************************************************************/ -package org.eclipse.wst.css.ui.tests; - -import junit.framework.TestCase; - -import org.eclipse.wst.css.core.internal.provisional.contenttype.ContentTypeIdForCSS; -import org.eclipse.wst.css.core.text.ICSSPartitions; -import org.eclipse.wst.css.ui.StructuredTextViewerConfigurationCSS; -import org.eclipse.wst.css.ui.views.contentoutline.CSSContentOutlineConfiguration; -import org.eclipse.wst.css.ui.views.properties.CSSPropertySheetConfiguration; -import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder; - -/** - * Tests retrieving editor contributions for css content type - */ -public class TestEditorConfigurationCSS extends TestCase { - public void testGetSourceViewerConfiguration() { - Object o = ExtendedConfigurationBuilder.getInstance().getConfiguration(ExtendedConfigurationBuilder.SOURCEVIEWERCONFIGURATION, ContentTypeIdForCSS.ContentTypeID_CSS); - assertNotNull("no source viewer configuration for " + ContentTypeIdForCSS.ContentTypeID_CSS, o); - // check for over-qualified subclasses - assertEquals("unexpected source viewer configuration for " + ContentTypeIdForCSS.ContentTypeID_CSS, o.getClass(), StructuredTextViewerConfigurationCSS.class); - } - - public void testGetContentOutlineViewerConfiguration() { - Object o = ExtendedConfigurationBuilder.getInstance().getConfiguration(ExtendedConfigurationBuilder.CONTENTOUTLINECONFIGURATION, ContentTypeIdForCSS.ContentTypeID_CSS); - assertNotNull("no content outline configuration for " + ContentTypeIdForCSS.ContentTypeID_CSS, o); - // check for over-qualified subclasses - assertEquals("unexpected content outline configuration for " + ContentTypeIdForCSS.ContentTypeID_CSS, o.getClass(), CSSContentOutlineConfiguration.class); - } - - public void testGetPropertySheetConfiguration() { - Object o = ExtendedConfigurationBuilder.getInstance().getConfiguration(ExtendedConfigurationBuilder.PROPERTYSHEETCONFIGURATION, ContentTypeIdForCSS.ContentTypeID_CSS); - assertNotNull("no property sheet configuration for " + ContentTypeIdForCSS.ContentTypeID_CSS, o); - // check for over-qualified subclasses - assertEquals("unexpected property sheet configuration for " + ContentTypeIdForCSS.ContentTypeID_CSS, o.getClass(), CSSPropertySheetConfiguration.class); - } - - public void testGetDocumentationTextHover() { - Object o = ExtendedConfigurationBuilder.getInstance().getConfiguration(ExtendedConfigurationBuilder.DOCUMENTATIONTEXTHOVER, ICSSPartitions.STYLE); - assertNull("unexpected documentation text hover for " + ICSSPartitions.STYLE, o); - } -} diff --git a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/viewer/CSSCodeFoldingTest.java b/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/viewer/CSSCodeFoldingTest.java deleted file mode 100644 index cba40a8e5..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/viewer/CSSCodeFoldingTest.java +++ /dev/null @@ -1,434 +0,0 @@ -/******************************************************************************* - * 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.wst.css.ui.tests.viewer; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import junit.extensions.TestSetup; -import junit.framework.Assert; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.source.IAnnotationModel; -import org.eclipse.jface.text.source.projection.ProjectionAnnotation; -import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; -import org.eclipse.wst.css.ui.tests.ProjectUtil; -import org.eclipse.wst.sse.core.utils.StringUtils; -import org.eclipse.wst.sse.ui.StructuredTextEditor; -import org.eclipse.wst.sse.ui.internal.StructuredTextViewer; -import org.eclipse.wst.sse.ui.reconcile.ISourceReconcilingListener; - -/** - * <p>Tests that code folding annotations are correctly added/removed from CSS Documents</p> - * <p>All of these tests use the same project and when possible the same open documents</p> - * - * @see org.eclipse.wst.xml.ui.tests.XMLCodeFoldingTest Similar Test - XML Code Folding Test - * @see org.eclipse.wst.css.ui.tests.viewer.CSSCodeFoldingTest Similar Test - CSS Code Folding Test - * @see org.eclipse.wst.dtd.ui.tests.viewer.DTDCodeFoldingTest Similar Test - DTD Code Folding Test - */ -public class CSSCodeFoldingTest extends TestCase implements ISourceReconcilingListener { - /** max amount of time to wait for */ - private static final int MAX_WAIT_TIME = 4000; - - /** amount of time to wait for */ - private static final int WAIT_TIME = 200; - - /** - * The name of the project that all of these tests will use - */ - private static final String PROJECT_NAME = "CSSCodeFoldingTest"; - - /** - * The location of the testing files - */ - private static final String PROJECT_FILES = "/testresources/folding"; - - /** - * The project that all of the tests use - */ - protected static IProject fProject; - - /** - * Used to keep track of the already open editors so that the tests don't go through - * the trouble of opening the same editors over and over again - */ - protected static Map fFileToEditorMap = new HashMap(); - - /** the last {@link IDocument} to be reconciled */ - private static IDocument fReconciledDoc = null; - - /** - * <p>Default constructor<p> - * <p>Use {@link #suite()}</p> - * - * @see #suite() - */ - public CSSCodeFoldingTest() { - super("CSS Code Folding Test"); - } - - /** - * <p>Constructor that takes a test name.</p> - * <p>Use {@link #suite()}</p> - * - * @param name The name this test run should have. - * - * @see #suite() - */ - public CSSCodeFoldingTest(String name) { - super(name); - } - - /** - * <p>Use this method to add these tests to a larger test suite so set up - * and tear down can be performed</p> - * - * @return a {@link TestSetup} that will run all of the tests in this class - * with set up and tear down. - */ - public static Test suite() { - TestSuite ts = new TestSuite(CSSCodeFoldingTest.class, "CSS Code Folding Test"); - return new CSSCodeFoldingTestSetup(ts); - - } - - /** - * Reset the state between tests - * - * @see junit.framework.TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - - fReconciledDoc = null; - } - - /** - * <p><b>TEST:</b> the initially placed folding annotations</p> - */ - public void testInitFolding() throws Exception { - IFile file = getFile("CSSFoldingTest1.css"); - - StructuredTextEditor editor = getEditor(file); - - List expectedPositions = new ArrayList(); - expectedPositions.add(new Position(401, 120)); - expectedPositions.add(new Position(333, 62)); - expectedPositions.add(new Position(181, 72)); - expectedPositions.add(new Position(258, 69)); - expectedPositions.add(new Position(21, 113)); - - waitForReconcileThenVerify(editor.getTextViewer(), expectedPositions); - } - - /** - * <p><b>TEST:</b> that folding annotations are updated after node is removed</p> - */ - public void testRemoveNode() throws Exception{ - IFile file = getFile("CSSFoldingTest1.css"); - - StructuredTextEditor editor = getEditor(file); - - try { - StructuredTextViewer viewer = editor.getTextViewer(); - IDocument doc = viewer.getDocument(); - doc.replace(253, 76, ""); - editor.doSave(null); - - final List expectedPositions = new ArrayList(); - expectedPositions.add(new Position(325, 120)); - expectedPositions.add(new Position(21, 113)); - expectedPositions.add(new Position(181, 72)); - expectedPositions.add(new Position(257, 62)); - - waitForReconcileThenVerify(viewer, expectedPositions); - } catch(BadLocationException e) { - fail("Test is broken, replace location has become invalid.\n" + e.getMessage()); - } - } - - /** - * <p><b>TEST:</b> that folding annotations are updated after node is added</p> - */ - public void testAddNode() throws Exception { - IFile file = getFile("CSSFoldingTest2.css"); - - StructuredTextEditor editor = getEditor(file); - - try { - StructuredTextViewer viewer = editor.getTextViewer(); - IDocument doc = viewer.getDocument(); - doc.replace(255, 0, "\ntd {\nborder: 1px solid black;\n}\n"); - editor.doSave(null); - - List expectedPositions = new ArrayList(); - expectedPositions.add(new Position(291, 69)); - expectedPositions.add(new Position(256, 31)); - expectedPositions.add(new Position(21, 113)); - expectedPositions.add(new Position(434, 120)); - expectedPositions.add(new Position(181, 72)); - expectedPositions.add(new Position(366, 62)); - - waitForReconcileThenVerify(viewer, expectedPositions); - } catch(BadLocationException e) { - fail("Test is broken, add location has become invalid.\n" + e.getMessage()); - } - } - - /** - * <p>Given a file name in <code>fProject</code> attempts to get an <code>IFile</code> - * for it, if the file doesn't exist the test fails.</p> - * - * @param name the name of the file to get - * @return the <code>IFile</code> associated with the given <code>name</code> - */ - private static IFile getFile(String name) { - IFile file = fProject.getFile(name); - assertTrue("Test file " + file + " can not be found", file.exists()); - - return file; - } - - /** - * <p>Given a <code>file</code> get an editor for it. If an editor has already - * been retrieved for the given <code>file</code> then return the same already - * open editor.</p> - * - * @param file open and return an editor for this - * @return <code>StructuredTextEditor</code> opened from the given <code>file</code> - */ - private StructuredTextEditor getEditor(IFile file) { - StructuredTextEditor editor = (StructuredTextEditor)fFileToEditorMap.get(file); - - if(editor == null) { - try { - IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - IEditorPart editorPart = IDE.openEditor(page, file, true, true); - if(editorPart instanceof StructuredTextEditor) { - editor = ((StructuredTextEditor)editorPart); - standardizeLineEndings(editor); - } else { - fail("Unable to open structured text editor"); - } - - if(editor != null) { - fFileToEditorMap.put(file, editor); - } else { - fail("Could not open viewer for " + file); - } - } catch (Exception e) { - fail("Could not open editor for " + file + " exception: " + e.getMessage()); - } - } - - return editor; - } - - /** - * Waits for the dirty region reconciler to finish and then verifies that only and all - * of the <code>expectedPositions</code> have folding annotations in the given <code>viewer</code> - * - * @param viewer check for annotations at the given <code>expectedPositions</code> - * in here after the dirty region reconciler job has finished - * @param expectedPositions check for annotations at these positions in the given <code>viewer</code> - * after the dirty region reconciler job has finished - */ - private void waitForReconcileThenVerify(final StructuredTextViewer viewer, final List expectedPositions) throws Exception{ - IDocument doc = viewer.getDocument(); - int time = 0; - while(doc != fReconciledDoc && time <= MAX_WAIT_TIME) { - Thread.sleep(WAIT_TIME); - time += WAIT_TIME; - } - - if(doc == fReconciledDoc) { - verifyAnnotationPositions(viewer, expectedPositions); - } else { - Assert.fail("Document " + viewer.getDocument() + " was not reconciled with in " + MAX_WAIT_TIME + - " so gave up waiting and in turn could not validate folding anotations"); - } - } - - /** - * Verifies that only and all of the <code>expectedPositions</code> have folding annotations - * in the given <code>viewer</code> - * - * @param viewer check for annotations at the given <code>expectedPositions</code> in here - * @param expectedPositions check for annotations at these positions in the given <code>viewer</code> - */ - private void verifyAnnotationPositions(StructuredTextViewer viewer, List expectedPositions) throws Exception{ - ProjectionAnnotationModel projectionModel = viewer.getProjectionAnnotationModel(); - Iterator annotationIter = projectionModel.getAnnotationIterator(); - - //even with the waiting for the job sometimes the test is just to fast - int attempts = 0; - while(!annotationIter.hasNext() && attempts < 3) { - ++attempts; - annotationIter = projectionModel.getAnnotationIterator(); - Thread.sleep(500); - } - - List unexpectedPositions = new ArrayList(); - - while(annotationIter.hasNext()) { - Object obj = annotationIter.next(); - if(obj instanceof ProjectionAnnotation) { - ProjectionAnnotation annotation = (ProjectionAnnotation)obj; - Position pos = projectionModel.getPosition(annotation); - - boolean found = expectedPositions.remove(pos); - if(!found) { - unexpectedPositions.add(pos); - } - - } - } - - String error = ""; - if(unexpectedPositions.size() != 0) { - error += "There were " + unexpectedPositions.size() + " unexpected positions that were found"; - for(int i = 0; i < unexpectedPositions.size(); ++i) { - error += "\n\t" + unexpectedPositions.get(i); - } - } - - if(expectedPositions.size() != 0 ) { - error += "\nThere were " + expectedPositions.size() + " expected positions that were not found"; - for(int i = 0; i < expectedPositions.size(); ++i) { - error += "\n\t" + expectedPositions.get(i); - } - } - - if(error.length() != 0) { - fail(error); - } - } - - /** - * <p>Line endings can be an issue when running tests on different OSs. - * This function standardizes the line endings to use <code>\n</code></p> - * - * <p>It will get the text from the given editor, change the line endings, - * and then save the editor</p> - * - * @param editor standardize the line endings of the text presented in this - * editor. - */ - private void standardizeLineEndings(StructuredTextEditor editor) { - IDocument doc = editor.getTextViewer().getDocument(); - String contents = doc.get(); - contents = StringUtils.replace(contents, "\r\n", "\n"); - contents = StringUtils.replace(contents, "\r", "\n"); - doc.set(contents); - } - - /** - * <p>This inner class is used to do set up and tear down before and - * after (respectively) all tests in the inclosing class have run.</p> - */ - private static class CSSCodeFoldingTestSetup extends TestSetup { - private static final String WTP_AUTOTEST_NONINTERACTIVE = "wtp.autotest.noninteractive"; - private static String previousWTPAutoTestNonInteractivePropValue = null; - - /** - * Default constructor - * - * @param test do setup for the given test - */ - public CSSCodeFoldingTestSetup(Test test) { - super(test); - } - - /** - * <p>This is run once before all of the tests</p> - * - * @see junit.extensions.TestSetup#setUp() - */ - public void setUp() throws Exception { - initializeResources(); - - String noninteractive = System.getProperty(WTP_AUTOTEST_NONINTERACTIVE); - - if (noninteractive != null) { - previousWTPAutoTestNonInteractivePropValue = noninteractive; - } else { - previousWTPAutoTestNonInteractivePropValue = "false"; - } - System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, "true"); - } - - /** - * <p>This is run once after all of the tests have been run</p> - * - * @see junit.extensions.TestSetup#tearDown() - */ - public void tearDown() throws Exception { - //close out the editors - Iterator iter = fFileToEditorMap.values().iterator(); - while(iter.hasNext()) { - StructuredTextEditor editor = (StructuredTextEditor)iter.next(); - editor.doSave(null); - editor.close(false); - } - - if (previousWTPAutoTestNonInteractivePropValue != null) { - System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, previousWTPAutoTestNonInteractivePropValue); - } - - fProject.delete(true, new NullProgressMonitor()); - } - - /** - * Set up the project and workbench, this should only be done once - */ - private static void initializeResources() { - fProject = ProjectUtil.createProject(PROJECT_NAME, null, null); - ProjectUtil.copyBundleEntriesIntoWorkspace(PROJECT_FILES, PROJECT_NAME); - } - } - - /** - * ignore - * @see org.eclipse.wst.sse.ui.reconcile.ISourceReconcilingListener#aboutToBeReconciled() - */ - public void aboutToBeReconciled() { - //ignore - } - - /** - * keep track of last document reconciled - * - * @see org.eclipse.wst.sse.ui.reconcile.ISourceReconcilingListener#reconciled(org.eclipse.jface.text.IDocument, org.eclipse.jface.text.source.IAnnotationModel, boolean, org.eclipse.core.runtime.IProgressMonitor) - */ - public void reconciled(IDocument document, IAnnotationModel model, - boolean forced, IProgressMonitor progressMonitor) { - fReconciledDoc = document; - } -} diff --git a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/viewer/TestCSSContentAssist.java b/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/viewer/TestCSSContentAssist.java deleted file mode 100644 index 6b9904e4d..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/viewer/TestCSSContentAssist.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * 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.wst.css.ui.tests.viewer; - -import java.io.IOException; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.css.ui.StructuredTextViewerConfigurationCSS; -import org.eclipse.wst.css.ui.internal.contentassist.CSSContentAssistProcessor; -import org.eclipse.wst.css.ui.tests.ProjectUtil; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceAlreadyExists; -import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.ui.internal.StructuredTextViewer; - -public class TestCSSContentAssist extends TestCase { - - protected String projectName = null; - protected String fileName = null; - protected String resourcesFolder = null; - private StructuredTextViewer sourceViewer = null; - protected IStructuredDocument document = null; - private IStructuredModel model; - protected IFile file = null; - - public TestCSSContentAssist() { - } - - protected void setUp() throws Exception { - - super.setUp(); - projectName = "CSSContentAssistForMedia"; - fileName = "mediaexample.css"; - resourcesFolder = "/testresources"; - - String filePath = setupProject(); - file = ResourcesPlugin.getWorkspace().getRoot().getFile( - new Path(filePath)); - - if (file != null && !file.exists()) { - Assert.fail("Unable to locate " + file + "."); - } - - loadFile(); - - initializeSourceViewer(); - } - - private void initializeSourceViewer() { - if (Display.getCurrent() != null) { - - Shell shell = null; - Composite parent = null; - - if (PlatformUI.isWorkbenchRunning()) { - shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - } else { - shell = new Shell(Display.getCurrent()); - } - parent = new Composite(shell, SWT.NONE); - - // dummy viewer - sourceViewer = new StructuredTextViewer(parent, null, null, false, SWT.NONE); - } else { - Assert.fail("Unable to run the test as a display must be available."); - } - - configureSourceViewer(); - } - - protected void configureSourceViewer() { - sourceViewer.configure(new StructuredTextViewerConfigurationCSS()); - - sourceViewer.setDocument(document); - } - - protected void loadFile() throws ResourceAlreadyExists, ResourceInUse, IOException, CoreException { - IModelManager modelManager = StructuredModelManager.getModelManager(); - model = modelManager.getModelForEdit(file); - document = model.getStructuredDocument(); - } - - protected String setupProject() throws Exception{ - IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(projectName); - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - try { - project.create(description, new NullProgressMonitor()); - project.open(new NullProgressMonitor()); - } catch (CoreException e) { - - } - String filePath = project.getFullPath().addTrailingSeparator().append(fileName).toString(); - - ProjectUtil.copyBundleEntriesIntoWorkspace(resourcesFolder, project.getFullPath().toString()); - - return filePath; - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testContentAssistInsideMedia() throws Exception { - - try { - CSSContentAssistProcessor processor = new CSSContentAssistProcessor(); - ICompletionProposal[] proposals = processor.computeCompletionProposals(sourceViewer, 24); - assertTrue("No proposals at offset.", proposals.length > 0); - ICompletionProposal proposal = proposals[0]; - assertEquals("Wrong proposal returned for ACRONYM.", "azimuth", proposal.getDisplayString()); - } finally { - model.releaseFromEdit(); - } - } -} diff --git a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/viewer/TestViewerConfigurationCSS.java b/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/viewer/TestViewerConfigurationCSS.java deleted file mode 100644 index 0a0f2d4d2..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/viewer/TestViewerConfigurationCSS.java +++ /dev/null @@ -1,241 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 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.wst.css.ui.tests.viewer; - -import junit.framework.TestCase; - -import org.eclipse.jface.text.IAutoEditStrategy; -import org.eclipse.jface.text.IInformationControlCreator; -import org.eclipse.jface.text.ITextDoubleClickStrategy; -import org.eclipse.jface.text.ITextHover; -import org.eclipse.jface.text.contentassist.IContentAssistant; -import org.eclipse.jface.text.formatter.IContentFormatter; -import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; -import org.eclipse.jface.text.information.IInformationPresenter; -import org.eclipse.jface.text.reconciler.IReconciler; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.css.core.text.ICSSPartitions; -import org.eclipse.wst.css.ui.StructuredTextViewerConfigurationCSS; -import org.eclipse.wst.css.ui.internal.Logger; -import org.eclipse.wst.sse.ui.internal.StructuredTextViewer; -import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider; - -public class TestViewerConfigurationCSS extends TestCase { - - private StructuredTextViewerConfigurationCSS fConfig = null; - private boolean fDisplayExists = true; - private StructuredTextViewer fViewer = null; - private boolean isSetup = false; - - public TestViewerConfigurationCSS() { - super("TestViewerConfigurationCSS"); - } - - protected void setUp() throws Exception { - - super.setUp(); - if (!this.isSetup) { - setUpViewerConfiguration(); - this.isSetup = true; - } - } - - private void setUpViewerConfiguration() { - - if (Display.getCurrent() != null) { - - Shell shell = null; - Composite parent = null; - - if (PlatformUI.isWorkbenchRunning()) { - shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - } - else { - shell = new Shell(Display.getCurrent()); - } - parent = new Composite(shell, SWT.NONE); - - // dummy viewer - fViewer = new StructuredTextViewer(parent, null, null, false, SWT.NONE); - fConfig = new StructuredTextViewerConfigurationCSS(); - } - else { - fDisplayExists = false; - Logger.log(Logger.INFO, "Remember, viewer configuration tests are not run because workbench is not open (normal on build machine)"); - } - } - - public void testGetAutoEditStrategies() { - - // probably no display - if (!fDisplayExists) - return; - - IAutoEditStrategy[] strategies = fConfig.getAutoEditStrategies(fViewer, ICSSPartitions.STYLE); - assertNotNull(strategies); - assertTrue("there are no auto edit strategies", strategies.length > 0); - } - - public void testGetConfiguredContentTypes() { - - // probably no display - if (!fDisplayExists) - return; - - String[] configuredContentTypes = fConfig.getConfiguredContentTypes(fViewer); - assertNotNull(configuredContentTypes); - assertTrue("there are no configured content types", configuredContentTypes.length > 1); - } - - /* - * not necessary - */ - public void testGetContentAssistant() { - - // probably no display - if (!fDisplayExists) - return; - - IContentAssistant ca = fConfig.getContentAssistant(fViewer); - assertNotNull("there is no content assistant", ca); - } - - public void testGetContentFormatter() { - - // probably no display - if (!fDisplayExists) - return; - - IContentFormatter cf = fConfig.getContentFormatter(fViewer); - assertNotNull("there is no content formatter", cf); - } - - /* - * not necessary - */ - public void testGetDoubleClickStrategy() { - - // probably no display - if (!fDisplayExists) - return; - - String[] contentTypes = fConfig.getConfiguredContentTypes(fViewer); - for (int i = 0; i < contentTypes.length; i++) { - ITextDoubleClickStrategy strategy = fConfig.getDoubleClickStrategy(fViewer, contentTypes[i]); - if (strategy != null) { - return; - } - } - assertTrue("there are no configured double click strategies", false); - } - - /* - * not necessary - */ - public void testGetHyperlinkDetectors() { - - // probably no display - if (!fDisplayExists) - return; - - IHyperlinkDetector[] detectors = fConfig.getHyperlinkDetectors(fViewer); - assertNotNull("there are no hyperlink detectors", detectors); - assertTrue("there are no hyperlink detectors", detectors.length > 0); - } - - public void testGetIndentPrefixes() { - // probably no display - if (!fDisplayExists) - return; - - String[] contentTypes = fConfig.getConfiguredContentTypes(fViewer); - for (int i = 0; i < contentTypes.length; i++) { - String prefixes[] = fConfig.getIndentPrefixes(fViewer, contentTypes[i]); - if (prefixes != null) { - return; - } - } - assertTrue("there are no configured indent prefixes", false); - } - - /* - * not necessary - */ - public void testGetInformationControlCreator() { - // probably no display - if (!fDisplayExists) - return; - - IInformationControlCreator infoCreator = fConfig.getInformationControlCreator(fViewer); - assertNotNull("InformationControlCreator is null", infoCreator); - } - - /* - * not necessary - */ - public void testGetInformationPresenter() { - - // probably no display - if (!fDisplayExists) - return; - - IInformationPresenter presenter = fConfig.getInformationPresenter(fViewer); - assertNotNull("InformationPresenter is null", presenter); - } - - public void testGetLineStyleProviders() { - // probably no display - if (!fDisplayExists) - return; - - String[] contentTypes = fConfig.getConfiguredContentTypes(fViewer); - for (int i = 0; i < contentTypes.length; i++) { - LineStyleProvider providers[] = fConfig.getLineStyleProviders(fViewer, contentTypes[i]); - if (providers != null) { - return; - } - } - assertTrue("there are no configured line style providers", false); - } - - /* - * not necessary - */ - public void testGetReconciler() { - - // probably no display - if (!fDisplayExists) - return; - - IReconciler r = fConfig.getReconciler(fViewer); - assertNotNull("Reconciler not null", r); - } - - /* - * not necessary - */ - public void testGetTextHover() { - - // probably no display - if (!fDisplayExists) - return; - - String[] hoverPartitions = new String[]{ICSSPartitions.STYLE}; - for (int i = 0; i < hoverPartitions.length; i++) { - ITextHover hover = fConfig.getTextHover(fViewer, hoverPartitions[i], SWT.NONE); - assertNotNull("hover was null for partition: " + hoverPartitions[i], hover); - } - } -} diff --git a/tests/org.eclipse.wst.css.ui.tests/test.xml b/tests/org.eclipse.wst.css.ui.tests/test.xml deleted file mode 100644 index f55274dd6..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/test.xml +++ /dev/null @@ -1,115 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<project - name="testsuite" - default="run" - basedir="."> - - <!-- The following properties should be passed into this script --> - <!-- ${eclipse-home} --> - <!-- ${buildDirectory} --> - <!-- ${buildLabel} --> - - <!-- should be little need to change what's above --> - - <property - name="plugin-name" - value="org.eclipse.wst.css.ui.tests" /> - <property - name="classname" - value="org.eclipse.wst.css.ui.tests.CSSUITestSuite" /> - <property - name="testType" - value="ui-test" /> - - <!-- should be little need to change what's below --> - - <echo message="basedir: ${basedir}" /> - <echo message="eclipse-home: ${eclipse-home}" /> - <echo message="buildDirectory: ${buildDirectory}" /> - <echo message="plugin-name: ${plugin-name}" /> - <echo message="classname: ${classname}" /> - <echo message="testType ${testType}" /> - - - <property - name="library-file" - value="${eclipse-home}/plugins/org.eclipse.test_3.1.0/library.xml" /> - <property - name="workspace" - value="${eclipse-home}/junitworkspaces/${plugin-name}" /> - - <!-- This target holds all initialization code that needs to be done for --> - <!-- all tests that are to be run. Initialization for individual tests --> - <!-- should be done within the body of the suite target. --> - <target name="init"> - <tstamp /> - <delete> - <fileset - dir="${eclipse-home}" - includes="${plugin-name}.*xml" /> - </delete> - <!-- make directory, in case path doesn't exist yet --> - <mkdir dir="${workspace}" /> - <!-- but delete to make sure fresh contents--> - <delete - dir="${workspace}" - quiet="true" /> - - </target> - - <!-- This target defines the tests that need to be run. --> - <target name="suite"> - - <ant - target="${testType}" - antfile="${library-file}" - dir="${eclipse-home}"> - <property - name="data-dir" - value="${workspace}" /> - <property - name="plugin-name" - value="${plugin-name}" /> - <property - name="classname" - value="${classname}" /> - <property - name="plugin-path" - value="${eclipse-home}/plugins/${plugin-name}" /> - </ant> - - <copy - failonerror="false" - file="${workspace}/.metadata/.log" - tofile="${buildDirectory}/${buildLabel}/testResults/consolelogs/${plugin-name}.consolelog.txt" /> - - </target> - - <!-- This target holds code to cleanup the testing environment after --> - <!-- after all of the tests have been run. You can use this target to --> - <!-- delete temporary files that have been created. --> - <target name="cleanup"> - <!-- usually no need to delete workspace until next run, and leaving it allows inspection --> - <!-- <delete dir="${workspace}" quiet="true" /> --> - </target> - - <!-- This target runs the test suite. Any actions that need to happen --> - <!-- after all the tests have been run should go here. --> - <target - name="run" - depends="init,suite,cleanup"> - <ant - target="collect" - antfile="${library-file}" - dir="${eclipse-home}"> - <property - name="includes" - value="${plugin-name}.*xml" /> - <property - name="output-file" - value="${plugin-name}.xml" /> - </ant> - </target> - -</project>
\ No newline at end of file diff --git a/tests/org.eclipse.wst.css.ui.tests/testresources/folding/CSSFoldingTest1.css b/tests/org.eclipse.wst.css.ui.tests/testresources/folding/CSSFoldingTest1.css deleted file mode 100644 index a27062426..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/testresources/folding/CSSFoldingTest1.css +++ /dev/null @@ -1,32 +0,0 @@ -/* global (begin) */
-body {
- font-family: sans-serif;
- color: #000;
- background: #fff url("global/body-back.gif") repeat-x;
-}
-
-/* global (end) */
-
-/* header (begin) */
- #header {
- margin-bottom: 1em;
- padding-bottom: 2px;
- }
- #header form {
- font-size: 85%;
- display: inline;
- }
-
- #header .btn,
- #header .txt {
- font-size: 80%;
- }
-
- .message {
- border: 1px solid red;
- margin: 0.3em 0em;
- padding: 0.3em;
- color: green;
- }
-
-/* header (end) */
\ No newline at end of file diff --git a/tests/org.eclipse.wst.css.ui.tests/testresources/folding/CSSFoldingTest2.css b/tests/org.eclipse.wst.css.ui.tests/testresources/folding/CSSFoldingTest2.css deleted file mode 100644 index a27062426..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/testresources/folding/CSSFoldingTest2.css +++ /dev/null @@ -1,32 +0,0 @@ -/* global (begin) */
-body {
- font-family: sans-serif;
- color: #000;
- background: #fff url("global/body-back.gif") repeat-x;
-}
-
-/* global (end) */
-
-/* header (begin) */
- #header {
- margin-bottom: 1em;
- padding-bottom: 2px;
- }
- #header form {
- font-size: 85%;
- display: inline;
- }
-
- #header .btn,
- #header .txt {
- font-size: 80%;
- }
-
- .message {
- border: 1px solid red;
- margin: 0.3em 0em;
- padding: 0.3em;
- color: green;
- }
-
-/* header (end) */
\ No newline at end of file diff --git a/tests/org.eclipse.wst.css.ui.tests/testresources/mediaexample.css b/tests/org.eclipse.wst.css.ui.tests/testresources/mediaexample.css deleted file mode 100644 index 1ec4b8c74..000000000 --- a/tests/org.eclipse.wst.css.ui.tests/testresources/mediaexample.css +++ /dev/null @@ -1,5 +0,0 @@ -@MEDIA { - ACRONYM { - - } -}
\ No newline at end of file |