Search in sources :

Example 1 with DependencyCellRenderer

use of com.android.tools.idea.gradle.structure.configurables.ui.dependencies.AbstractDeclaredDependenciesTableModel.DependencyCellRenderer in project android by JetBrains.

the class AbstractDeclaredDependenciesTableModelTest method testShowArtifactDependencySpec.

public void testShowArtifactDependencySpec() {
    PsArtifactDependencySpec spec = new PsArtifactDependencySpec("appcompat-v7", "com.android.support", "23.1.0");
    when(myLibraryDependency.getResolvedSpec()).thenReturn(spec);
    when(myLibraryDependency.getDeclaredSpec()).thenReturn(spec);
    when(myLibraryDependency.toText(PLAIN_TEXT)).thenReturn("com.android.support:appcompat-v7:23.1.0");
    ColumnInfo[] columnInfos = myTableModel.getColumnInfos();
    PsUISettings.getInstance().DECLARED_DEPENDENCIES_SHOW_GROUP_ID = true;
    //noinspection unchecked
    ColumnInfo<PsAndroidDependency, String> specColumnInfo = columnInfos[0];
    DependencyCellRenderer renderer = (DependencyCellRenderer) specColumnInfo.getRenderer(myLibraryDependency);
    assertNotNull(renderer);
    String text = renderer.getText();
    assertEquals("com.android.support:appcompat-v7:23.1.0", text);
    PsUISettings.getInstance().DECLARED_DEPENDENCIES_SHOW_GROUP_ID = false;
    text = renderer.getText();
    assertEquals("appcompat-v7:23.1.0", text);
}
Also used : DependencyCellRenderer(com.android.tools.idea.gradle.structure.configurables.ui.dependencies.AbstractDeclaredDependenciesTableModel.DependencyCellRenderer) PsAndroidDependency(com.android.tools.idea.gradle.structure.model.android.PsAndroidDependency) PsArtifactDependencySpec(com.android.tools.idea.gradle.structure.model.PsArtifactDependencySpec) ColumnInfo(com.intellij.util.ui.ColumnInfo)

Aggregations

DependencyCellRenderer (com.android.tools.idea.gradle.structure.configurables.ui.dependencies.AbstractDeclaredDependenciesTableModel.DependencyCellRenderer)1 PsArtifactDependencySpec (com.android.tools.idea.gradle.structure.model.PsArtifactDependencySpec)1 PsAndroidDependency (com.android.tools.idea.gradle.structure.model.android.PsAndroidDependency)1 ColumnInfo (com.intellij.util.ui.ColumnInfo)1