Search in sources :

Example 11 with JTreeFixture

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()));
}
Also used : JTreeFixture(org.fest.swing.fixture.JTreeFixture) MergedManifestFixture(com.android.tools.idea.tests.gui.framework.fixture.MergedManifestFixture) EditorFixture(com.android.tools.idea.tests.gui.framework.fixture.EditorFixture) IdeFrameFixture(com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture) Test(org.junit.Test)

Example 12 with JTreeFixture

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);
}
Also used : JTreeFixture(org.fest.swing.fixture.JTreeFixture) MergedManifestFixture(com.android.tools.idea.tests.gui.framework.fixture.MergedManifestFixture) EditorFixture(com.android.tools.idea.tests.gui.framework.fixture.EditorFixture) JPopupMenuFixture(org.fest.swing.fixture.JPopupMenuFixture) IdeFrameFixture(com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture) Test(org.junit.Test)

Example 13 with JTreeFixture

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\"");
}
Also used : JTreeFixture(org.fest.swing.fixture.JTreeFixture) MergedManifestFixture(com.android.tools.idea.tests.gui.framework.fixture.MergedManifestFixture) EditorFixture(com.android.tools.idea.tests.gui.framework.fixture.EditorFixture) IdeFrameFixture(com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture) Test(org.junit.Test)

Example 14 with JTreeFixture

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();
}
Also used : JTreeFixture(org.fest.swing.fixture.JTreeFixture) ImmutableList(com.google.common.collect.ImmutableList) NotNull(org.jetbrains.annotations.NotNull)

Example 15 with JTreeFixture

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();
}
Also used : JTreeFixture(org.fest.swing.fixture.JTreeFixture) ImmutableList(com.google.common.collect.ImmutableList) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

JTreeFixture (org.fest.swing.fixture.JTreeFixture)20 PublicAtsApi (com.axway.ats.common.PublicAtsApi)8 SwingElementState (com.axway.ats.uiengine.utilities.swing.SwingElementState)8 Test (org.junit.Test)5 JPopupMenuFixture (org.fest.swing.fixture.JPopupMenuFixture)4 NotNull (org.jetbrains.annotations.NotNull)4 EditorFixture (com.android.tools.idea.tests.gui.framework.fixture.EditorFixture)3 IdeFrameFixture (com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture)3 MergedManifestFixture (com.android.tools.idea.tests.gui.framework.fixture.MergedManifestFixture)3 ImmutableList (com.google.common.collect.ImmutableList)2 JComboBoxFixture (org.fest.swing.fixture.JComboBoxFixture)2 JListFixture (org.fest.swing.fixture.JListFixture)2 JMenuItemFixture (org.fest.swing.fixture.JMenuItemFixture)2 ThemeSelectionDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.ThemeSelectionDialogFixture)1 AndroidThemePreviewPanelFixture (com.android.tools.idea.tests.gui.framework.fixture.theme.AndroidThemePreviewPanelFixture)1 NewStyleDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.theme.NewStyleDialogFixture)1 ThemeEditorFixture (com.android.tools.idea.tests.gui.framework.fixture.theme.ThemeEditorFixture)1 ElementNotFoundException (com.axway.ats.uiengine.exceptions.ElementNotFoundException)1 SwingDriverInternal (com.axway.ats.uiengine.internal.driver.SwingDriverInternal)1 ProjectViewTree (com.intellij.ide.projectView.impl.ProjectViewTree)1