Search in sources :

Example 41 with CountListener

use of com.android.tools.idea.ui.properties.CountListener in project android by JetBrains.

the class TextPropertyTest method textPropertyCanWrapLabelWithEditLink.

@Test
public void textPropertyCanWrapLabelWithEditLink() {
    LabelWithEditLink editLabel = new LabelWithEditLink();
    TextProperty textProperty = new TextProperty(editLabel);
    CountListener listener = new CountListener();
    textProperty.addListener(listener);
    assertThat(textProperty.get()).isEqualTo("");
    assertThat(listener.getCount()).isEqualTo(0);
    editLabel.setText("Edit label set directly");
    assertThat(textProperty.get()).isEqualTo("Edit label set directly");
    assertThat(listener.getCount()).isEqualTo(1);
    textProperty.set("Edit label updated via property");
    assertThat(editLabel.getText()).isEqualTo("Edit label updated via property");
    assertThat(listener.getCount()).isEqualTo(2);
}
Also used : LabelWithEditLink(com.android.tools.adtui.LabelWithEditLink) CountListener(com.android.tools.idea.ui.properties.CountListener) Test(org.junit.Test)

Aggregations

CountListener (com.android.tools.idea.ui.properties.CountListener)41 Test (org.junit.Test)41 LabelWithEditLink (com.android.tools.adtui.LabelWithEditLink)1 ColorPanel (com.intellij.ui.ColorPanel)1