use of com.android.tools.idea.uibuilder.model.NlComponent in project android by JetBrains.
the class PreferenceScreenTestFactory method newPreferenceCategory.
@NotNull
static NlComponent newPreferenceCategory(int x, int y, int width, int height) {
NlComponent category = HandlerTestFactory.newNlComponent(PREFERENCE_CATEGORY);
category.setBounds(x, y, width, height);
return category;
}
use of com.android.tools.idea.uibuilder.model.NlComponent in project android by JetBrains.
the class PreferenceScreenTestFactory method newCheckBoxPreference.
@NotNull
static NlComponent newCheckBoxPreference(int x, int y, int width, int height) {
NlComponent preference = HandlerTestFactory.newNlComponent(CHECK_BOX_PREFERENCE);
preference.setBounds(x, y, width, height);
return preference;
}
use of com.android.tools.idea.uibuilder.model.NlComponent in project android by JetBrains.
the class GroupDragHandlerTest method updateUsingOverflowGroup.
@Test
public void updateUsingOverflowGroup() {
NlComponent menu = newMenu(366, 162, 392, 288);
menu.addChild(newOverflowItem(366, 162, 392, 96));
menu.addChild(newOverflowItem(366, 258, 392, 96));
menu.addChild(newOverflowItem(366, 354, 392, 96));
GroupDragHandler handler = newGroupDragHandler(menu);
int y = 90;
y += 48;
handler.update(0, y, 0);
assertEquals(0, handler.getInsertIndex());
y += 48;
handler.update(0, y, 0);
assertEquals(0, handler.getInsertIndex());
y += 48;
handler.update(0, y, 0);
assertEquals(1, handler.getInsertIndex());
y += 48;
handler.update(0, y, 0);
assertEquals(1, handler.getInsertIndex());
y += 48;
handler.update(0, y, 0);
assertEquals(2, handler.getInsertIndex());
y += 48;
handler.update(0, y, 0);
assertEquals(2, handler.getInsertIndex());
y += 48;
handler.update(0, y, 0);
assertEquals(-1, handler.getInsertIndex());
y += 48;
handler.update(0, y, 0);
assertEquals(-1, handler.getInsertIndex());
}
use of com.android.tools.idea.uibuilder.model.NlComponent in project android by JetBrains.
the class ActionBarTest method addToItemsOrOverflowItemsItemViewTypeIsActionBarMenu.
@Test
public void addToItemsOrOverflowItemsItemViewTypeIsActionBarMenu() {
NlComponent item = HandlerTestFactory.newNlComponent("item");
item.viewInfo = MenuTestFactory.mockViewInfo(ViewType.ACTION_BAR_MENU);
NlComponent menu = HandlerTestFactory.newNlComponent("menu");
menu.addChild(item);
ActionBar actionBar = new ActionBar(menu);
assertEquals(Collections.singletonList(item), actionBar.getItems());
assertEquals(Collections.emptyList(), actionBar.getOverflowItems());
}
use of com.android.tools.idea.uibuilder.model.NlComponent in project android by JetBrains.
the class GridDragHandlerTest method testCommit.
public void testCommit() {
handler.start(630, 210, 0);
handler.update(470, 210, 0);
WriteCommandAction.runWriteCommandAction(getProject(), () -> {
handler.commit(470, 210, 0, InsertType.MOVE_INTO);
});
NlComponent[][] children = handler.getInfo().getChildren();
NlComponent child = children[handler.getStartRow()][handler.getStartColumn()];
assertEquals("0", child.getAttribute(SdkConstants.ANDROID_URI, SdkConstants.ATTR_LAYOUT_ROW));
assertEquals("1", child.getAttribute(SdkConstants.ANDROID_URI, SdkConstants.ATTR_LAYOUT_COLUMN));
}
Aggregations