use of com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture in project android by JetBrains.
the class ConvertToWebpActionTest method testConvertLossyWithPreviews.
@Test
public void testConvertLossyWithPreviews() throws IOException {
if (!WebpNativeLibHelper.loadNativeLibraryIfNeeded()) {
System.out.println("Skipping " + ConvertToWebpActionTest.class.getSimpleName() + " because the webp decoder is not available");
return;
}
guiTest.importProjectAndWaitForProjectSyncToFinish("ImportWebpProject");
IdeFrameFixture projectFrame = guiTest.ideFrame();
Project project = projectFrame.getProject();
VirtualFile res = project.getBaseDir().findFileByRelativePath("app/src/main/res");
VirtualFile pngIcon = project.getBaseDir().findFileByRelativePath("app/src/main/res/mipmap-xhdpi/ic_test.png");
assertThat(pngIcon.exists()).isTrue();
invokeConvertToWebpAction(project, res);
// Settings dialog
WebpConversionDialogFixture settingsDialog = WebpConversionDialogFixture.findDialog(guiTest.robot());
settingsDialog.selectLossy();
settingsDialog.clickOk();
WebpPreviewDialogFixture previewDialog = WebpPreviewDialogFixture.findDialog(guiTest.robot());
previewDialog.clickFinish();
VirtualFile webpIcon = project.getBaseDir().findFileByRelativePath("app/src/main/res/mipmap-xhdpi/ic_test.webp");
assertThat(webpIcon).isNotNull();
pngIcon = project.getBaseDir().findFileByRelativePath("app/src/main/res/mipmap-xhdpi/ic_test.png");
assertThat(pngIcon).isNull();
}
use of com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture in project android by JetBrains.
the class ConvertToWebpActionTest method testConvertLossless.
@Test
public void testConvertLossless() throws IOException {
if (!WebpNativeLibHelper.loadNativeLibraryIfNeeded()) {
System.out.println("Skipping " + ConvertToWebpActionTest.class.getSimpleName() + " because the webp decoder is not available");
return;
}
guiTest.importProjectAndWaitForProjectSyncToFinish("ImportWebpProject");
IdeFrameFixture projectFrame = guiTest.ideFrame();
Project project = projectFrame.getProject();
VirtualFile res = project.getBaseDir().findFileByRelativePath("app/src/main/res");
VirtualFile webpIcon = project.getBaseDir().findFileByRelativePath("app/src/main/res/mipmap-xhdpi/ic_test.webp");
assertThat(webpIcon).isNull();
VirtualFile pngIcon = project.getBaseDir().findFileByRelativePath("app/src/main/res/mipmap-xhdpi/ic_test.png");
assertThat(pngIcon.exists()).isTrue();
invokeConvertToWebpAction(project, res);
WebpConversionDialogFixture dialog = WebpConversionDialogFixture.findDialog(guiTest.robot());
dialog.selectLossless();
dialog.clickOk();
// Check that the webp icon now exists
webpIcon = project.getBaseDir().findFileByRelativePath("app/src/main/res/mipmap-xhdpi/ic_test.webp");
assertThat(webpIcon).isNotNull();
assertThat(pngIcon.exists()).isFalse();
// ..and that the .png icon doesn't
pngIcon = project.getBaseDir().findFileByRelativePath("app/src/main/res/mipmap-xhdpi/ic_test.png");
assertThat(pngIcon).isNull();
}
use of com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture 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.IdeFrameFixture in project android by JetBrains.
the class BuildTypesTest method addNewBuildType.
/**
* Verifies addition of new build types
* <p>This is run to qualify releases. Please involve the test team in substantial changes.
* <p>TR ID: C14581580
* <pre>
* Test Steps:
* 1. Open the project structure dialog
* 2. Select a module
* 3. Click the Build Types tab
* 4. Create new Build Type and name it newBuildType
* 5. Set properties debuggable and version Name Suffix to valid values
* Verification:
* 1. Open the build.gradle file for that module and verify
* entries for build types to contain new build type added.
* 2. Verify the properties in the file match the values
* set in the project structure flavor dialog
* </pre>
*/
@RunIn(TestGroup.QA)
@Test
public void addNewBuildType() throws Exception {
IdeFrameFixture ideFrame = guiTest.importSimpleApplication();
ProjectStructureDialogFixture projectStructureDialog = ideFrame.openFromMenu(ProjectStructureDialogFixture::find, "File", "Project Structure...");
BuildTypesTabFixture buildTypesTab = projectStructureDialog.selectConfigurable("app").selectBuildTypesTab();
buildTypesTab.setName("newBuildType").setDebuggable("true").setVersionNameSuffix("suffix");
projectStructureDialog.clickOk();
ideFrame.waitForGradleProjectSyncToFinish();
EditorFixture editor = ideFrame.getEditor().open("/app/build.gradle");
String gradleFileContents = editor.getCurrentFileContents();
assertThat(gradleFileContents).containsMatch("newBuildType \\{\\n[\\s]*debuggable true\\n[\\s]*versionNameSuffix 'suffix'\\n[\\s]*\\}");
}
use of com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture in project android by JetBrains.
the class NlEditorTest method testCopyAndPaste.
@Test
public void testCopyAndPaste() throws Exception {
guiTest.importSimpleApplication();
IdeFrameFixture ideFrame = guiTest.ideFrame();
EditorFixture editor = ideFrame.getEditor().open("app/src/main/res/layout/activity_my.xml", EditorFixture.Tab.DESIGN);
NlEditorFixture layout = editor.getLayoutEditor(true).dragComponentToSurface("Widgets", "Button").dragComponentToSurface("Widgets", "CheckBox").waitForRenderToFinish();
// Find and click the first text view
NlComponentFixture textView = layout.findView("CheckBox", 0);
textView.click();
// It should be selected now
layout.requireSelection(Collections.singletonList(textView));
// 4 = root layout + 3 widgets
assertEquals(4, layout.getAllComponents().size());
ideFrame.invokeMenuPath("Edit", "Cut");
layout.requireSelection(Collections.emptyList());
assertEquals(3, layout.getAllComponents().size());
layout.findView("Button", 0).click();
ideFrame.invokeMenuPath("Edit", "Paste");
layout.findView("CheckBox", 0).click();
ideFrame.invokeMenuPath("Edit", "Copy");
ideFrame.invokeMenuPath("Edit", "Paste");
assertEquals(5, layout.getAllComponents().size());
}
Aggregations