use of com.android.tools.idea.tests.gui.framework.fixture.theme.ThemePreviewFixture in project android by JetBrains.
the class EditorFixture method getThemePreview.
/**
* Returns a fixture around the theme preview window, <b>if</b> the currently edited file
* is a styles file and if the XML editor tab of the layout is currently showing.
*
* @param switchToTabIfNecessary if true, switch to the editor tab if it is not already showing
* @return the theme preview fixture
*/
@Nullable
public ThemePreviewFixture getThemePreview(boolean switchToTabIfNecessary) {
VirtualFile currentFile = getCurrentFile();
if (ResourceHelper.getFolderType(currentFile) != ResourceFolderType.VALUES) {
return null;
}
if (switchToTabIfNecessary) {
selectEditorTab(Tab.EDITOR);
}
boolean visible = GuiQuery.getNonNull(() -> ToolWindowManager.getInstance(myFrame.getProject()).getToolWindow("Theme Preview").isActive());
if (!visible) {
myFrame.invokeMenuPath("View", "Tool Windows", "Theme Preview");
}
Wait.seconds(1).expecting("Theme Preview window to be visible").until(() -> GuiQuery.getNonNull(() -> {
ToolWindow window = ToolWindowManager.getInstance(myFrame.getProject()).getToolWindow("Theme Preview");
return window != null && window.isVisible();
}));
// Wait for it to be fully opened
robot.waitForIdle();
return new ThemePreviewFixture(robot, myFrame.getProject());
}
Aggregations