use of org.jetbrains.android.sdk.AndroidPlatform in project android by JetBrains.
the class AndroidSdksTest method testCreateSdkWithoutAddingRoots.
public void testCreateSdkWithoutAddingRoots() {
IAndroidTarget target = findAndroidTarget();
String name = "testSdk";
Sdk sdk = myAndroidSdks.create(target, mySdkPath, name, myJdk, false);
assertNotNull(sdk);
assertEquals(name, sdk.getName());
verifyCorrectPath(sdk);
AndroidSdkAdditionalData androidData = getAndroidSdkAdditionalData(sdk);
assertSame(myJdk, androidData.getJavaSdk());
AndroidPlatform androidPlatform = androidData.getAndroidPlatform();
assertNotNull(androidPlatform);
assertSame(target, androidPlatform.getTarget());
VirtualFile[] sdkRoots = sdk.getSdkModificator().getRoots(CLASSES);
assertThat(sdkRoots).isEmpty();
}
use of org.jetbrains.android.sdk.AndroidPlatform in project android by JetBrains.
the class GraphicsLayoutRendererTest method testInflateAndRender.
public void testInflateAndRender() throws InitializationException, ParserConfigurationException, IOException, SAXException {
VirtualFile layout = myFixture.copyFileToProject("themeEditor/theme_preview_layout.xml", "res/layout/theme_preview_layout.xml");
Configuration configuration = myFacet.getConfigurationManager().getConfiguration(layout);
DomPullParser parser = new DomPullParser(DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(layout.getInputStream()).getDocumentElement());
AndroidFacet facet = AndroidFacet.getInstance(configuration.getModule());
assertNotNull(facet);
AndroidPlatform platform = AndroidPlatform.getInstance(myModule);
assertNotNull(platform);
//noinspection UndesirableClassUsage
BufferedImage image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
GraphicsLayoutRenderer renderer = GraphicsLayoutRenderer.create(facet, platform, myModule.getProject(), configuration, parser, Color.BLACK, SessionParams.RenderingMode.V_SCROLL, false);
// The first render triggers a render (to a NOP Graphics object) so we expect sizes to have been initialized.
Dimension initialSize = renderer.getPreferredSize();
assertNotEquals("Expected layout dimensions after create", EMPTY_DIMENSION, initialSize);
assertTrue(renderer.render((Graphics2D) image.getGraphics()));
// We haven't changed the layout so, after the render, we expect the same dimensions.
assertEquals(initialSize, renderer.getPreferredSize());
renderer.setSize(new Dimension(50, 50));
assertTrue(renderer.render((Graphics2D) image.getGraphics()));
}
use of org.jetbrains.android.sdk.AndroidPlatform in project android by JetBrains.
the class AndroidLintTest method testApiOverride.
public void testApiOverride() throws Exception {
createManifest();
createProjectProperties();
// We need a build target >= 1 but also *smaller* than 17. Ensure this is the case
AndroidPlatform platform = AndroidPlatform.getInstance(myFacet.getModule());
if (platform != null && platform.getApiLevel() < 17) {
myFixture.copyFileToProject(getGlobalTestDir() + "/MyActivity.java", "src/p1/p2/MyActivity.java");
doGlobalInspectionTest(new AndroidLintOverrideInspection());
} else {
// TODO: else try to find and set a target on the project such that the above returns true
}
}
Aggregations