fix PyDeprecationTest: allow to turn off the new behavior of looking for an injected fragment under the caret in CodeInsightTestFixture

This commit is contained in:
Dmitry Jemerov
2013-08-12 16:50:46 +02:00
parent bc909bf6a1
commit f28ee879df
2 changed files with 17 additions and 1 deletions
@@ -493,4 +493,12 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture {
* @param consumer the callback in which the actual testing of the structure view is performed.
*/
void testStructureView(Consumer<StructureViewComponent> consumer);
/**
* By default, if the caret in the text passed to {@link #configureByFile(String)} or {@link #configureByText} has an injected fragment
* at the caret, the test fixture puts the caret into the injected editor. This method allows to turn off this behavior.
*
* @param caresAboutInjection true if the fixture should look for an injection at caret, false otherwise.
*/
void setCaresAboutInjection(boolean caresAboutInjection);
}
@@ -153,6 +153,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
@NonNls private static final String XXX = "XXX";
private final FileTreeAccessFilter myJavaFilesFilter = new FileTreeAccessFilter();
private boolean myAllowDirt;
private boolean myCaresAboutInjection = true;
@SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
public CodeInsightTestFixtureImpl(IdeaProjectTestFixture projectFixture, TempDirTestFixture tempDirTestFixture) {
@@ -1363,7 +1364,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
module.getMessageBus().syncPublisher(FacetManager.FACETS_TOPIC).facetConfigurationChanged(facet);
}
}
setupEditorForInjectedLanguage();
if (myCaresAboutInjection) {
setupEditorForInjectedLanguage();
}
}
}.execute().throwException();
@@ -1928,6 +1931,11 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
}
}
@Override
public void setCaresAboutInjection(boolean caresAboutInjection) {
myCaresAboutInjection = caresAboutInjection;
}
@Override
public LookupImpl getLookup() {
return (LookupImpl)LookupManager.getActiveLookup(myEditor);