Search in sources :

Example 1 with PTableGroupItem

use of com.android.tools.idea.uibuilder.property.ptable.PTableGroupItem in project android by JetBrains.

the class NlPropertiesPanelTest method testFilterParentIsNotAMatch.

public void testFilterParentIsNotAMatch() {
    PTableItem item = mock(PTableItem.class);
    PTableGroupItem group = mock(PTableGroupItem.class);
    when(item.getName()).thenReturn("top");
    when(item.getParent()).thenReturn(group);
    when(group.getName()).thenReturn("padding");
    when(myEntry.getValue(0)).thenReturn(item);
    NlPropertiesPanel.MyFilter filter = new NlPropertiesPanel.MyFilter();
    filter.setPattern("constra");
    assertFalse(filter.include(myEntry));
}
Also used : PTableItem(com.android.tools.idea.uibuilder.property.ptable.PTableItem) PTableGroupItem(com.android.tools.idea.uibuilder.property.ptable.PTableGroupItem)

Example 2 with PTableGroupItem

use of com.android.tools.idea.uibuilder.property.ptable.PTableGroupItem in project android by JetBrains.

the class NlPropertyItemTest method testCreateDesignPropertyInPropertyTable.

public void testCreateDesignPropertyInPropertyTable() {
    NlPropertyItem item = createFrom(myTextView, ATTR_TEXT);
    PTableGroupItem group = new SimpleGroupItem();
    group.addChild(item);
    NlPropertyItem design = item.getDesignTimeProperty();
    assertThat(design).isNotInstanceOf(NlFlagPropertyItem.class);
    assertThat(design).isNotInstanceOf(NlIdPropertyItem.class);
    assertThat(design.getName()).isEqualTo(ATTR_TEXT);
    assertThat(design.getNamespace()).isEqualTo(TOOLS_URI);
    assertThat(design.getParent()).isEqualTo(group);
    assertThat(group.getChildren()).containsAllOf(item, design);
    // Deleting it removes it from the group
    design.delete();
    assertThat(group.getChildren()).doesNotContain(design);
}
Also used : PTableGroupItem(com.android.tools.idea.uibuilder.property.ptable.PTableGroupItem)

Example 3 with PTableGroupItem

use of com.android.tools.idea.uibuilder.property.ptable.PTableGroupItem in project android by JetBrains.

the class NlPropertiesPanelTest method testFilterChildIsNotAMatch.

public void testFilterChildIsNotAMatch() {
    PTableItem item = mock(PTableItem.class);
    PTableGroupItem group = mock(PTableGroupItem.class);
    when(item.getName()).thenReturn("top");
    when(item.getParent()).thenReturn(item);
    when(group.getName()).thenReturn("padding");
    when(group.getChildren()).thenReturn(ImmutableList.of(item));
    when(myEntry.getValue(0)).thenReturn(group);
    NlPropertiesPanel.MyFilter filter = new NlPropertiesPanel.MyFilter();
    filter.setPattern("bott");
    assertFalse(filter.include(myEntry));
}
Also used : PTableItem(com.android.tools.idea.uibuilder.property.ptable.PTableItem) PTableGroupItem(com.android.tools.idea.uibuilder.property.ptable.PTableGroupItem)

Example 4 with PTableGroupItem

use of com.android.tools.idea.uibuilder.property.ptable.PTableGroupItem in project android by JetBrains.

the class NlPropertiesPanelTest method testFilterChildIsAMatch.

public void testFilterChildIsAMatch() {
    PTableItem item = mock(PTableItem.class);
    PTableGroupItem group = mock(PTableGroupItem.class);
    when(item.getName()).thenReturn("bottom");
    when(item.getParent()).thenReturn(group);
    when(group.getName()).thenReturn("padding");
    when(group.getChildren()).thenReturn(ImmutableList.of(item));
    when(myEntry.getValue(0)).thenReturn(group);
    NlPropertiesPanel.MyFilter filter = new NlPropertiesPanel.MyFilter();
    filter.setPattern("bott");
    assertTrue(filter.include(myEntry));
}
Also used : PTableItem(com.android.tools.idea.uibuilder.property.ptable.PTableItem) PTableGroupItem(com.android.tools.idea.uibuilder.property.ptable.PTableGroupItem)

Example 5 with PTableGroupItem

use of com.android.tools.idea.uibuilder.property.ptable.PTableGroupItem in project android by JetBrains.

the class NlPropertiesPanelTest method testFilterParentIsAMatch.

public void testFilterParentIsAMatch() {
    PTableItem item = mock(PTableItem.class);
    PTableGroupItem group = mock(PTableGroupItem.class);
    when(item.getName()).thenReturn("top");
    when(item.getParent()).thenReturn(group);
    when(group.getName()).thenReturn("padding");
    when(myEntry.getValue(0)).thenReturn(item);
    NlPropertiesPanel.MyFilter filter = new NlPropertiesPanel.MyFilter();
    filter.setPattern("padd");
    assertTrue(filter.include(myEntry));
}
Also used : PTableItem(com.android.tools.idea.uibuilder.property.ptable.PTableItem) PTableGroupItem(com.android.tools.idea.uibuilder.property.ptable.PTableGroupItem)

Aggregations

PTableGroupItem (com.android.tools.idea.uibuilder.property.ptable.PTableGroupItem)5 PTableItem (com.android.tools.idea.uibuilder.property.ptable.PTableItem)4