@SuppressWarnings("ConstantConditions") public void testIsSupported() throws Exception { VirtualFile layoutFile = myFixture.copyFileToProject("xmlpull/layout.xml", "res/layout-land-v14/foo.xml"); VirtualFile menuFile = myFixture.copyFileToProject("menus/menu1.xml", "res/menu/menu1.xml"); VirtualFile drawableFile = myFixture.copyFileToProject("menus/menu1.xml", "res/menu/menu1.xml"); PsiManager psiManager = PsiManager.getInstance(getProject()); assertTrue(LayoutPullParserFactory.isSupported(psiManager.findFile(layoutFile))); assertTrue(LayoutPullParserFactory.isSupported(psiManager.findFile(menuFile))); assertTrue(LayoutPullParserFactory.isSupported(psiManager.findFile(drawableFile))); }
public void testRenderDrawable() throws Exception { VirtualFile file = myFixture.copyFileToProject( "drawables/progress_horizontal.xml", "res/drawable/progress_horizontal.xml"); assertNotNull(file); RenderService service = getRenderService(file); assertNotNull(service); ILayoutPullParser parser = LayoutPullParserFactory.create(service); assertTrue(parser instanceof DomPullParser); Element root = ((DomPullParser) parser).getRoot(); String layout = XmlPrettyPrinter.prettyPrint(root, true); assertEquals( "<ImageView\n" + "xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + "layout_width=\"fill_parent\"\n" + "layout_height=\"fill_parent\"\n" + "src=\"@drawable/progress_horizontal\" />\n", layout); checkRendering(service, "drawable/progress_horizontal.png"); }