use of com.android.tools.idea.tests.gui.framework.fixture.MergedManifestFixture in project android by JetBrains.
the class ManifestEditorTest method testNonPrimaryManifest.
@Test
public void testNonPrimaryManifest() throws IOException {
guiTest.importProjectAndWaitForProjectSyncToFinish("Flavoredapp");
IdeFrameFixture projectFrame = guiTest.ideFrame();
EditorFixture editor = projectFrame.getEditor();
editor.open("src/main/AndroidManifest.xml");
editor.selectEditorTab(EditorFixture.Tab.MERGED_MANIFEST);
MergedManifestFixture mergedManifestFixture = editor.getMergedManifestEditor();
Color defaultBackgroundColor = mergedManifestFixture.getDefaultBackgroundColor();
mergedManifestFixture.getTree().clickRow(1);
assertThat(mergedManifestFixture.getSelectedNodeColor()).isNotEqualTo(defaultBackgroundColor);
mergedManifestFixture.getTree().clickRow(3);
assertThat(mergedManifestFixture.getSelectedNodeColor()).isEqualTo(defaultBackgroundColor);
mergedManifestFixture.getTree().clickRow(2);
mergedManifestFixture.requireText("Manifest Sources \n" + "\n" + "Flavoredapp main manifest (this file)\n" + "\n" + "myaarlibrary manifest\n" + "\n" + "build.gradle injection\n" + " Other Manifest Files (Included in merge, but did not contribute any elements)\n" + "locallib manifest, Flavoredapp debug manifest, Flavoredapp flavor1 manifest,\n" + "support-compat:25.0.0 manifest, support-core-ui:25.0.0 manifest,\n" + "support-core-utils:25.0.0 manifest, support-fragment:25.0.0 manifest,\n" + "support-media-compat:25.0.0 manifest, support-v4:25.0.0 manifest Merging Log\n" + "Value provided by Gradle Added from the Flavoredapp main manifest (this file),\n" + "line 1 Value provided by Gradle\n", true);
editor.open("src/debug/AndroidManifest.xml");
editor.selectEditorTab(EditorFixture.Tab.MERGED_MANIFEST);
mergedManifestFixture = editor.getMergedManifestEditor();
mergedManifestFixture.getTree().clickRow(3);
assertNotEquals(defaultBackgroundColor, mergedManifestFixture.getSelectedNodeColor());
editor.open("src/flavor1/AndroidManifest.xml");
editor.selectEditorTab(EditorFixture.Tab.MERGED_MANIFEST);
mergedManifestFixture = editor.getMergedManifestEditor();
mergedManifestFixture.getTree().clickRow(3);
assertNotEquals(defaultBackgroundColor, mergedManifestFixture.getSelectedNodeColor());
}
use of com.android.tools.idea.tests.gui.framework.fixture.MergedManifestFixture in project android by JetBrains.
the class ManifestEditorTest method testEditManifest.
@Test
public void testEditManifest() throws IOException {
guiTest.importMultiModule();
IdeFrameFixture projectFrame = guiTest.ideFrame();
EditorFixture editor = projectFrame.getEditor();
editor.open("app/src/main/AndroidManifest.xml");
editor.selectEditorTab(EditorFixture.Tab.MERGED_MANIFEST);
MergedManifestFixture mergedManifestFixture = editor.getMergedManifestEditor();
JTreeFixture tree = mergedManifestFixture.getTree();
mergedManifestFixture.checkAllRowsColored();
mergedManifestFixture.requireText("Manifest Sources \n" + "\n" + "app main manifest (this file)\n" + "\n" + "library manifest\n" + "\n" + "build.gradle injection", false);
editor.selectEditorTab(EditorFixture.Tab.EDITOR);
editor.moveBetween("<application", "");
editor.enterText(" android:isGame=\"true\"");
editor.selectEditorTab(EditorFixture.Tab.MERGED_MANIFEST);
tree.clickPath("manifest/application/android:isGame = true");
assertEquals("android:isGame = true", tree.valueAt(tree.target().getLeadSelectionRow()));
}
use of com.android.tools.idea.tests.gui.framework.fixture.MergedManifestFixture in project android by JetBrains.
the class ManifestEditorTest method testRemoveFromManifest.
@Test
public void testRemoveFromManifest() throws IOException {
guiTest.importMultiModule();
IdeFrameFixture projectFrame = guiTest.ideFrame();
EditorFixture editor = projectFrame.getEditor();
editor.open("app/src/main/AndroidManifest.xml");
String addedText = " <activity\n" + " android:name=\"com.android.mylibrary.MainActivity\"\n" + " tools:remove=\"android:label\" />\n";
assertThat(editor.getCurrentFileContents()).doesNotContain(addedText);
editor.selectEditorTab(EditorFixture.Tab.MERGED_MANIFEST);
MergedManifestFixture mergedManifestFixture = editor.getMergedManifestEditor();
JTreeFixture tree = mergedManifestFixture.getTree();
// row 28 = "manifest/application/activity/android:name = com.android.mylibrary.MainActivity"
JPopupMenuFixture popup = tree.showPopupMenuAt(22);
popup.menuItemWithPath("Remove").click();
editor.selectEditorTab(EditorFixture.Tab.EDITOR);
assertThat(editor.getCurrentFileContents()).contains(addedText);
}
use of com.android.tools.idea.tests.gui.framework.fixture.MergedManifestFixture in project android by JetBrains.
the class ManifestEditorTest method testManifestGoToSource.
@Test
public void testManifestGoToSource() throws IOException {
guiTest.importSimpleApplication();
IdeFrameFixture projectFrame = guiTest.ideFrame();
EditorFixture editor = projectFrame.getEditor();
editor.open("app/src/main/AndroidManifest.xml");
editor.selectEditorTab(EditorFixture.Tab.MERGED_MANIFEST);
MergedManifestFixture mergedManifestFixture = editor.getMergedManifestEditor();
JTreeFixture tree = mergedManifestFixture.getTree();
tree.clickPath("manifest/application/android:allowBackup = true");
mergedManifestFixture.checkAllRowsColored();
Color defaultBackgroundColor = mergedManifestFixture.getDefaultBackgroundColor();
assertEquals(defaultBackgroundColor, mergedManifestFixture.getSelectedNodeColor());
mergedManifestFixture.clickLinkText("app main manifest (this file), line 5");
assertThat(editor.getCurrentLine().trim()).isEqualTo("android:allowBackup=\"true\"");
}
Aggregations