Search in sources :

Example 6 with RenderErrorModel

use of com.android.tools.idea.rendering.errors.ui.RenderErrorModel in project intellij by bazelbuild.

the class BlazeRenderErrorContributorTest method testReportGeneratedResources.

@Test
public void testReportGeneratedResources() {
    createTargetMapWithGeneratedResources();
    RenderErrorModel errorModel = createRenderErrorModelWithBrokenClasses();
    RenderErrorModel.Issue generatedResourcesIssue = Iterables.getOnlyElement(errorModel.getIssues().stream().filter(issue -> issue.getSummary().equals(GENERATED_RESOURCES_ERROR)).collect(Collectors.toList()));
    assertThat(generatedResourcesIssue.getHtmlContent()).isEqualTo("Generated resources will not be discovered by the IDE:" + "<DL>" + "<DD>-&NBSP;" + "com/google/example/dependency/generated/res " + "from <A HREF=\"file:///src/com/google/example/dependency/BUILD\">" + "//com/google/example:generated</A>" + "<DD>-&NBSP;" + "com/google/example/main/generated/res " + "from <A HREF=\"file:///src/com/google/example/main/BUILD\">" + "//com/google/example:main</A>" + "<DD>-&NBSP;" + "com/google/example/transitive/generated/one/res " + "from <A HREF=\"file:///src/com/google/example/transitive/BUILD\">" + "//com/google/example/transitive:generated</A>" + "<DD>-&NBSP;" + "com/google/example/transitive/generated/two/res " + "from <A HREF=\"file:///src/com/google/example/transitive/BUILD\">" + "//com/google/example/transitive:generated</A>" + "</DL>" + "Please avoid using generated resources, then " + "<A HREF=\"action:sync\">sync the project</A> and " + "<A HREF=\"refreshRender\">refresh the layout</A>.");
}
Also used : RenderErrorModel(com.android.tools.idea.rendering.errors.ui.RenderErrorModel) Test(org.junit.Test)

Example 7 with RenderErrorModel

use of com.android.tools.idea.rendering.errors.ui.RenderErrorModel in project intellij by bazelbuild.

the class BlazeRenderErrorContributorTest method testNoReportMissingClassDependenciesIfClassInDependency.

@Test
public void testNoReportMissingClassDependenciesIfClassInDependency() {
    createTargetMapWithMissingClassDependency();
    RenderErrorModel errorModel = createRenderErrorModelWithMissingClasses("com.google.example.dependent.LibraryView");
    errorModel.getIssues().forEach(issue -> assertThat(issue.getSummary()).isNotEqualTo(MISSING_CLASS_DEPENDENCIES_ERROR));
}
Also used : RenderErrorModel(com.android.tools.idea.rendering.errors.ui.RenderErrorModel) Test(org.junit.Test)

Example 8 with RenderErrorModel

use of com.android.tools.idea.rendering.errors.ui.RenderErrorModel in project intellij by bazelbuild.

the class BlazeRenderErrorContributorTest method testNoReportNonStandardAndroidManifestNameInDependency.

@Test
public void testNoReportNonStandardAndroidManifestNameInDependency() {
    createTargetMapWithNonStandardAndroidManifestNameInDependency();
    RenderErrorModel errorModel = createRenderErrorModelWithBrokenClasses();
    errorModel.getIssues().forEach(issue -> assertThat(issue.getSummary()).isNotEqualTo(NON_STANDARD_MANIFEST_NAME_ERROR));
}
Also used : RenderErrorModel(com.android.tools.idea.rendering.errors.ui.RenderErrorModel) Test(org.junit.Test)

Example 9 with RenderErrorModel

use of com.android.tools.idea.rendering.errors.ui.RenderErrorModel in project intellij by bazelbuild.

the class BlazeRenderErrorContributorTest method testNoBlazeIssuesIfNoRelatedErrors.

@Test
public void testNoBlazeIssuesIfNoRelatedErrors() {
    RenderErrorModel errorModel = createRenderErrorModelWithBrokenClasses();
    errorModel.getIssues().forEach(issue -> assertThat(issue.getSummary()).isNoneOf(GENERATED_RESOURCES_ERROR, NON_STANDARD_MANIFEST_NAME_ERROR, MISSING_CLASS_DEPENDENCIES_ERROR));
}
Also used : RenderErrorModel(com.android.tools.idea.rendering.errors.ui.RenderErrorModel) Test(org.junit.Test)

Example 10 with RenderErrorModel

use of com.android.tools.idea.rendering.errors.ui.RenderErrorModel in project intellij by bazelbuild.

the class BlazeRenderErrorContributorTest method testNoReportMissingClassDependenciesIfClassInSameTarget.

@Test
public void testNoReportMissingClassDependenciesIfClassInSameTarget() {
    createTargetMapWithMissingClassDependency();
    RenderErrorModel errorModel = createRenderErrorModelWithMissingClasses("com.google.example.ResourceView");
    errorModel.getIssues().forEach(issue -> assertThat(issue.getSummary()).isNotEqualTo(MISSING_CLASS_DEPENDENCIES_ERROR));
}
Also used : RenderErrorModel(com.android.tools.idea.rendering.errors.ui.RenderErrorModel) Test(org.junit.Test)

Aggregations

RenderErrorModel (com.android.tools.idea.rendering.errors.ui.RenderErrorModel)10 Test (org.junit.Test)8 RenderResult (com.android.tools.idea.rendering.RenderResult)3 VisibleForTesting (com.android.annotations.VisibleForTesting)1 State (com.android.sdklib.devices.State)1 UsageTracker (com.android.tools.analytics.UsageTracker)1 Configuration (com.android.tools.idea.configurations.Configuration)1 RenderErrorModelFactory (com.android.tools.idea.rendering.RenderErrorModelFactory)1 NlModel (com.android.tools.idea.uibuilder.model.NlModel)1 DesignSurface (com.android.tools.idea.uibuilder.surface.DesignSurface)1 Cache (com.google.common.cache.Cache)1 CacheBuilder (com.google.common.cache.CacheBuilder)1 com.google.wireless.android.sdk.stats (com.google.wireless.android.sdk.stats)1 HighlightSeverity (com.intellij.lang.annotation.HighlightSeverity)1 MockPsiFile (com.intellij.mock.MockPsiFile)1 MockPsiManager (com.intellij.mock.MockPsiManager)1 SystemInfo (com.intellij.openapi.util.SystemInfo)1 PsiFile (com.intellij.psi.PsiFile)1 UIUtil (com.intellij.util.ui.UIUtil)1 Update (com.intellij.util.ui.update.Update)1