Search in sources :

Example 1 with NlBaseComponentEditor

use of com.android.tools.idea.uibuilder.property.editors.NlBaseComponentEditor in project android by JetBrains.

the class ProgressBarInspectorProviderTest method testChangingIndeterminateChangesVisibilityOfEditors.

public void testChangingIndeterminateChangesVisibilityOfEditors() {
    List<NlComponent> components = ImmutableList.of(myProgressBar);
    Map<String, NlProperty> properties = getPropertyMap(components);
    assertThat(myProvider.isApplicable(components, properties, myPropertiesManager)).isTrue();
    InspectorComponent inspector = myProvider.createCustomInspector(components, properties, myPropertiesManager);
    inspector.refresh();
    assertThat(isEditorVisible(inspector, ATTR_STYLE, "")).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_PROGRESS_DRAWABLE)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_INDETERMINATE_DRAWABLE)).isFalse();
    assertThat(isEditorVisible(inspector, ATTR_PROGRESS_TINT)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_INDETERMINATE_TINT)).isFalse();
    assertThat(isEditorVisible(inspector, ATTR_MAXIMUM)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_PROGRESS)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_VISIBILITY)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_VISIBILITY, TOOLS_URI)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_INDETERMINATE)).isTrue();
    NlBaseComponentEditor indeterminateEditor = (NlBaseComponentEditor) getEditor(inspector, ATTR_INDETERMINATE, ANDROID_URI);
    indeterminateEditor.stopEditing("true");
    assertThat(isEditorVisible(inspector, ATTR_STYLE, "")).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_PROGRESS_DRAWABLE)).isFalse();
    assertThat(isEditorVisible(inspector, ATTR_INDETERMINATE_DRAWABLE)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_PROGRESS_TINT)).isFalse();
    assertThat(isEditorVisible(inspector, ATTR_INDETERMINATE_TINT)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_MAXIMUM)).isFalse();
    assertThat(isEditorVisible(inspector, ATTR_PROGRESS)).isFalse();
    assertThat(isEditorVisible(inspector, ATTR_VISIBILITY)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_VISIBILITY, TOOLS_URI)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_INDETERMINATE)).isTrue();
    indeterminateEditor.stopEditing("false");
    assertThat(isEditorVisible(inspector, ATTR_STYLE, "")).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_PROGRESS_DRAWABLE)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_INDETERMINATE_DRAWABLE)).isFalse();
    assertThat(isEditorVisible(inspector, ATTR_PROGRESS_TINT)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_INDETERMINATE_TINT)).isFalse();
    assertThat(isEditorVisible(inspector, ATTR_MAXIMUM)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_PROGRESS)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_VISIBILITY)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_VISIBILITY, TOOLS_URI)).isTrue();
    assertThat(isEditorVisible(inspector, ATTR_INDETERMINATE)).isTrue();
}
Also used : NlComponent(com.android.tools.idea.uibuilder.model.NlComponent) NlProperty(com.android.tools.idea.uibuilder.property.NlProperty) Matchers.anyString(org.mockito.Matchers.anyString) NlBaseComponentEditor(com.android.tools.idea.uibuilder.property.editors.NlBaseComponentEditor)

Aggregations

NlComponent (com.android.tools.idea.uibuilder.model.NlComponent)1 NlProperty (com.android.tools.idea.uibuilder.property.NlProperty)1 NlBaseComponentEditor (com.android.tools.idea.uibuilder.property.editors.NlBaseComponentEditor)1 Matchers.anyString (org.mockito.Matchers.anyString)1