Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 143927 Details for
Bug 217821
[content assist] Code assist BETWEEN 2 different Style rules does not work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
JUnit Patch
defect217821-junit.patch (text/plain), 4.82 KB, created by
Aidyl Kareh
on 2009-08-10 13:15:54 EDT
(
hide
)
Description:
JUnit Patch
Filename:
MIME Type:
Creator:
Aidyl Kareh
Created:
2009-08-10 13:15:54 EDT
Size:
4.82 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.css.ui.tests >Index: src/org/eclipse/wst/css/ui/tests/viewer/TestCSSContentAssist.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/tests/org.eclipse.wst.css.ui.tests/src/org/eclipse/wst/css/ui/tests/viewer/TestCSSContentAssist.java,v >retrieving revision 1.2 >diff -u -r1.2 TestCSSContentAssist.java >--- src/org/eclipse/wst/css/ui/tests/viewer/TestCSSContentAssist.java 3 Aug 2009 14:01:27 -0000 1.2 >+++ src/org/eclipse/wst/css/ui/tests/viewer/TestCSSContentAssist.java 10 Aug 2009 15:55:13 -0000 >@@ -10,7 +10,10 @@ > *******************************************************************************/ > package org.eclipse.wst.css.ui.tests.viewer; > >+import java.io.ByteArrayOutputStream; >+import java.io.FileNotFoundException; > import java.io.IOException; >+import java.io.InputStream; > > import junit.framework.Assert; > import junit.framework.TestCase; >@@ -41,6 +44,7 @@ > > public class TestCSSContentAssist extends TestCase { > >+ private static final String UTF_8 = "UTF-8"; > protected String projectName = null; > protected String fileName = null; > protected String resourcesFolder = null; >@@ -55,8 +59,11 @@ > protected void setUp() throws Exception { > > super.setUp(); >- projectName = "CSSContentAssistForMedia"; >- fileName = "mediaexample.css"; >+ projectName = "CSSContentAssist"; >+ >+ if (fileName == null) { >+ fileName = "mediaexample.css"; >+ } > resourcesFolder = "/testresources"; > > String filePath = setupProject(); >@@ -127,6 +134,24 @@ > super.tearDown(); > } > >+ /** >+ * must release model (from edit) after >+ * >+ * @param filename >+ * relative to this class (TestFormatProcessorCSS) >+ */ >+ private IStructuredModel getModelForEdit(final String file) throws IOException { >+ >+ IStructuredModel model = null; >+ IModelManager modelManager = StructuredModelManager.getModelManager(); >+ InputStream inStream = getClass().getResourceAsStream(file); >+ if (inStream == null) >+ throw new FileNotFoundException("Can't file resource stream " + file); >+ final String baseFile = getClass().getResource(file).toString(); >+ model = modelManager.getModelForEdit(baseFile, inStream, null); >+ return model; >+ } >+ > public void testContentAssistInsideMedia() throws Exception { > > try { >@@ -139,4 +164,41 @@ > model.releaseFromEdit(); > } > } >+ >+ public void testContentAssistCompletion() throws Exception { >+ IStructuredModel afterModel = null; >+ try { >+ fileName = "contentAssistCompletion.css"; >+ setUp(); >+ >+ CSSContentAssistProcessor processor = new CSSContentAssistProcessor(); >+ ICompletionProposal[] proposals = processor >+ .computeCompletionProposals(sourceViewer, 11); >+ assertTrue("No proposals at offset.", proposals.length > 2); >+ ICompletionProposal proposal = proposals[1]; >+ assertEquals("Wrong proposal returned for H2.", "h2", proposal.getDisplayString()); >+ proposal.apply(document); >+ >+ String resultfile = "results/contentAssistCompletion-result.css"; >+ afterModel = getModelForEdit(resultfile); >+ assertNotNull("could not retrieve structured model for : "+ resultfile, afterModel); >+ >+ ByteArrayOutputStream updatedBytes = new ByteArrayOutputStream(); >+ model.save(updatedBytes); >+ >+ ByteArrayOutputStream afterBytes = new ByteArrayOutputStream(); >+ afterModel.save(afterBytes); >+ >+ String updatedContents = new String(updatedBytes.toByteArray(),UTF_8); >+ String expectedContents = new String(afterBytes.toByteArray(), UTF_8); >+ assertTrue("Edited document differs from the expected", updatedContents.equalsIgnoreCase(expectedContents)); >+ >+ } finally { >+ if (model != null) >+ model.releaseFromEdit(); >+ if (afterModel != null) >+ afterModel.releaseFromEdit(); >+ } >+ } >+ > } >Index: testresources/contentAssistCompletion.css >=================================================================== >RCS file: testresources/contentAssistCompletion.css >diff -N testresources/contentAssistCompletion.css >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ testresources/contentAssistCompletion.css 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,9 @@ >+H1 { >+ >+} >+ >+H >+ >+H3 { >+ >+} >\ No newline at end of file >Index: src/org/eclipse/wst/css/ui/tests/viewer/results/contentAssistCompletion-result.css >=================================================================== >RCS file: src/org/eclipse/wst/css/ui/tests/viewer/results/contentAssistCompletion-result.css >diff -N src/org/eclipse/wst/css/ui/tests/viewer/results/contentAssistCompletion-result.css >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/css/ui/tests/viewer/results/contentAssistCompletion-result.css 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,11 @@ >+H1 { >+ >+} >+ >+h2 { >+ >+} >+ >+H3 { >+ >+} >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 217821
:
143926
|
143927
|
144048