use of com.intellij.refactoring.actions.InlineAction in project android by JetBrains.
the class AndroidInlineLayoutTest method doTestCommonInlineAction.
private void doTestCommonInlineAction(boolean inlineThisOnly) {
final String testName = getTestName(true);
myFixture.copyFileToProject(BASE_PATH + testName + "_included.xml", "res/layout/included.xml");
final VirtualFile f = myFixture.copyFileToProject(BASE_PATH + testName + ".xml", "res/layout/test.xml");
myFixture.configureFromExistingVirtualFile(f);
AndroidInlineLayoutHandler.setTestConfig(new AndroidInlineTestConfig(inlineThisOnly));
try {
final Presentation p = myFixture.testAction(new InlineAction());
assertTrue(p.isEnabled());
assertTrue(p.isVisible());
} finally {
AndroidInlineLayoutHandler.setTestConfig(null);
}
myFixture.checkResultByFile(BASE_PATH + testName + "_after.xml", true);
}
use of com.intellij.refactoring.actions.InlineAction in project android by JetBrains.
the class AndroidInlineLayoutTest method test22.
public void test22() throws Exception {
myFixture.copyFileToProject(BASE_PATH + getTestName(true) + "_included.xml", "res/layout/included.xml");
final VirtualFile f = myFixture.copyFileToProject(BASE_PATH + getTestName(true) + ".xml", "res/layout/test.xml");
myFixture.configureFromExistingVirtualFile(f);
AndroidInlineLayoutHandler.setTestConfig(new AndroidInlineTestConfig(true));
try {
myFixture.testAction(new InlineAction());
fail();
} catch (IncorrectOperationException e) {
assertTrue(e.getMessage().length() > 0);
} finally {
AndroidInlineLayoutHandler.setTestConfig(null);
}
}
use of com.intellij.refactoring.actions.InlineAction in project android by JetBrains.
the class AndroidInlineLayoutTest method test9.
public void test9() throws Exception {
final String testName = getTestName(true);
myFixture.copyFileToProject(BASE_PATH + testName + ".xml", "res/layout/test.xml");
final VirtualFile f = myFixture.copyFileToProject(BASE_PATH + testName + "_included.xml", "res/layout/included.xml");
myFixture.configureFromExistingVirtualFile(f);
AndroidInlineLayoutHandler.setTestConfig(new AndroidInlineTestConfig(true));
try {
final Presentation p = myFixture.testAction(new InlineAction());
assertTrue(p.isEnabled());
assertTrue(p.isVisible());
} finally {
AndroidInlineLayoutHandler.setTestConfig(null);
}
myFixture.checkResultByFile("res/layout/test.xml", BASE_PATH + testName + "_after.xml", true);
assertNull(myFixture.getTempDirFixture().getFile("res/layout/included.xml"));
}
use of com.intellij.refactoring.actions.InlineAction in project android by JetBrains.
the class AndroidValueResourcesTest method testInlineResourceField.
public void testInlineResourceField() throws Exception {
copyFileToProject("value_resources.xml", "res/values/value_resources.xml");
VirtualFile virtualFile = copyFileToProject(getTestName(false) + ".java", "src/p1/p2/" + getTestName(false) + ".java");
myFixture.configureFromExistingVirtualFile(virtualFile);
try {
myFixture.testAction(new InlineAction());
fail();
} catch (CommonRefactoringUtil.RefactoringErrorHintException e) {
}
myFixture.checkResultByFile(myTestFolder + '/' + getTestName(false) + ".java", true);
}
use of com.intellij.refactoring.actions.InlineAction in project android by JetBrains.
the class AndroidInlineLayoutTest method doTestCommonInlineActionWithConflicts.
private void doTestCommonInlineActionWithConflicts(boolean inlineThisOnly, boolean configureFromIncludedFile) {
final String testName = getTestName(true);
final VirtualFile included = myFixture.copyFileToProject(BASE_PATH + testName + "_included.xml", "res/layout/included.xml");
final VirtualFile f = myFixture.copyFileToProject(BASE_PATH + testName + ".xml", "res/layout/test.xml");
myFixture.configureFromExistingVirtualFile(configureFromIncludedFile ? included : f);
final AndroidInlineTestConfig config = new AndroidInlineTestConfig(inlineThisOnly);
AndroidInlineLayoutHandler.setTestConfig(config);
myFixture.testAction(new InlineAction());
final MultiMap<PsiElement, String> conflicts = config.getConflicts();
assertEquals(1, conflicts.keySet().size());
assertEquals(1, conflicts.values().size());
}
Aggregations