use of org.fest.swing.fixture.JTreeFixture 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 org.fest.swing.fixture.JTreeFixture 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 org.fest.swing.fixture.JTreeFixture 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\"");
}
use of org.fest.swing.fixture.JTreeFixture in project android by JetBrains.
the class ApkViewerFixture method getApkEntries.
@NotNull
public ImmutableList<String> getApkEntries() {
ImmutableList.Builder<String> builder = ImmutableList.builder();
JTree tree = robot.finder().findByType((Container) myTarget, JTree.class, true);
JTreeFixture treeFixture = new JTreeFixture(robot, tree);
treeFixture.replaceCellReader(TREE_NODE_CELL_READER);
for (int i = 0; i < tree.getRowCount(); i++) {
builder.add(treeFixture.valueAt(i));
}
return builder.build();
}
use of org.fest.swing.fixture.JTreeFixture in project android by JetBrains.
the class LayoutInspectorFixture method getLayoutElements.
@NotNull
public ImmutableList<String> getLayoutElements() {
ImmutableList.Builder<String> builder = new ImmutableList.Builder<>();
JTree tree = myRobot.finder().findByType(myTarget, RollOverTree.class, true);
JTreeFixture treeFixture = new JTreeFixture(myRobot, tree);
for (int i = 0; i < tree.getRowCount(); i++) {
String element = treeFixture.valueAt(i);
builder.add(element.substring(0, element.indexOf("@")).trim());
}
return builder.build();
}
Aggregations