use of org.jetbrains.android.dom.layout.LayoutViewElement in project android by JetBrains.
the class StructureViewTest method testLayoutStructure.
public void testLayoutStructure() throws Exception {
VirtualFile file = copyFileToProject("layout/structure_view_test.xml", "/res/layout/layout.xml");
PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
assertInstanceOf(psiFile, XmlFile.class);
DomFileElement<LayoutViewElement> element = DomManager.getDomManager(getProject()).getFileElement(((XmlFile) psiFile), LayoutViewElement.class);
assertNotNull(element);
final StructureViewModel model = new LayoutStructureViewBuilder(element).createStructureViewModel(null);
String expected = "LinearLayout\n" + " TextView\n" + " TextView (@+id/login)\n" + " TextView (@+id/password)\n" + " LinearLayout\n" + " Include @layout/some_other_layout\n" + " TextView\n";
assertEquals(expected, model.getRoot().toString());
}
use of org.jetbrains.android.dom.layout.LayoutViewElement in project android by JetBrains.
the class StructureViewTest method testLayoutStructureOrder1.
public void testLayoutStructureOrder1() throws Exception {
VirtualFile file = copyFileToProject("layout/structure_view_test_order_1.xml", "/res/layout/layout.xml");
PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
assertInstanceOf(psiFile, XmlFile.class);
DomFileElement<LayoutViewElement> element = DomManager.getDomManager(getProject()).getFileElement(((XmlFile) psiFile), LayoutViewElement.class);
assertNotNull(element);
final StructureViewModel model = new LayoutStructureViewBuilder(element).createStructureViewModel(null);
String expected = "LinearLayout\n" + " Fragment\n" + " Include\n";
assertEquals(expected, model.getRoot().toString());
}
Aggregations