use of com.android.tools.idea.uibuilder.property.inspector.IdInspectorProvider.IdInspectorComponent in project android by JetBrains.
the class IdInspectorProviderTest method testInspectorComponent.
public void testInspectorComponent() {
List<NlComponent> components = ImmutableList.of(myTextView);
Map<String, NlProperty> properties = getPropertyMap(components);
assertThat(myProvider.isApplicable(components, properties, myPropertiesManager)).isTrue();
IdInspectorComponent inspector = myProvider.createCustomInspector(components, properties, myPropertiesManager);
List<NlComponentEditor> editors = inspector.getEditors();
assertThat(editors.size()).isEqualTo(3);
assertThat(inspector.getMaxNumberOfRows()).isEqualTo(4);
InspectorPanel panel = mock(InspectorPanel.class);
when(panel.addComponent(anyString(), anyString(), any())).thenAnswer(invocation -> new JLabel());
inspector.attachToInspector(panel);
for (NlComponentEditor editor : editors) {
NlProperty property = editor.getProperty();
assertThat(property).isNotNull();
String propertyName = property.getName();
if (propertyName.equals(ATTR_ID)) {
propertyName = "ID";
}
verify(panel).addComponent(eq(propertyName), eq(null), eq(editor.getComponent()));
}
verify(panel, never()).addPanel(inspector.getConstraintPanel());
}
use of com.android.tools.idea.uibuilder.property.inspector.IdInspectorProvider.IdInspectorComponent in project android by JetBrains.
the class IdInspectorProviderTest method testUpdateProperties.
public void testUpdateProperties() {
List<NlComponent> components = ImmutableList.of(myTextView);
Map<String, NlProperty> properties = getPropertyMap(components);
assertThat(myProvider.isApplicable(components, properties, myPropertiesManager)).isTrue();
IdInspectorComponent inspector = myProvider.createCustomInspector(components, properties, myPropertiesManager);
inspector.updateProperties(ImmutableList.of(), properties, myPropertiesManager);
components = ImmutableList.of(myButtonInConstraintLayout);
properties = getPropertyMap(components);
inspector.updateProperties(components, properties, myPropertiesManager);
}
Aggregations