Search in sources :

Example 6 with Resources

use of org.jacoco.report.internal.html.resources.Resources in project jacoco by jacoco.

the class TableTest method setup.

@Before
public void setup() throws IOException {
    output = new MemoryMultiReportOutput();
    root = new ReportOutputFolder(output);
    resources = new Resources(root);
    doc = new HTMLDocument(root.createFile("Test.html"), "UTF-8");
    doc.head().title();
    body = doc.body();
    table = new Table();
}
Also used : ReportOutputFolder(org.jacoco.report.internal.ReportOutputFolder) MemoryMultiReportOutput(org.jacoco.report.MemoryMultiReportOutput) HTMLDocument(org.jacoco.report.internal.html.HTMLDocument) Resources(org.jacoco.report.internal.html.resources.Resources) Before(org.junit.Before)

Example 7 with Resources

use of org.jacoco.report.internal.html.resources.Resources in project jacoco by jacoco.

the class HTMLFormatter method createVisitor.

/**
 * Creates a new visitor to write a report to the given output.
 *
 * @param output
 *            output to write the report to
 * @return visitor to emit the report data to
 * @throws IOException
 *             in case of problems with the output stream
 */
public IReportVisitor createVisitor(final IMultiReportOutput output) throws IOException {
    final ReportOutputFolder root = new ReportOutputFolder(output);
    resources = new Resources(root);
    resources.copyResources();
    index = new ElementIndex(root);
    return new IReportVisitor() {

        private List<SessionInfo> sessionInfos;

        private Collection<ExecutionData> executionData;

        private HTMLGroupVisitor groupHandler;

        public void visitInfo(final List<SessionInfo> sessionInfos, final Collection<ExecutionData> executionData) throws IOException {
            this.sessionInfos = sessionInfos;
            this.executionData = executionData;
        }

        public void visitBundle(final IBundleCoverage bundle, final ISourceFileLocator locator) throws IOException {
            final BundlePage page = new BundlePage(bundle, null, locator, root, HTMLFormatter.this);
            createSessionsPage(page);
            page.render();
        }

        public IReportGroupVisitor visitGroup(final String name) throws IOException {
            groupHandler = new HTMLGroupVisitor(null, root, HTMLFormatter.this, name);
            createSessionsPage(groupHandler.getPage());
            return groupHandler;
        }

        private void createSessionsPage(final ReportPage rootpage) {
            sessionsPage = new SessionsPage(sessionInfos, executionData, index, rootpage, root, HTMLFormatter.this);
        }

        public void visitEnd() throws IOException {
            if (groupHandler != null) {
                groupHandler.visitEnd();
            }
            sessionsPage.render();
            output.close();
        }
    };
}
Also used : ReportOutputFolder(org.jacoco.report.internal.ReportOutputFolder) SessionsPage(org.jacoco.report.internal.html.page.SessionsPage) ISourceFileLocator(org.jacoco.report.ISourceFileLocator) ReportPage(org.jacoco.report.internal.html.page.ReportPage) IReportVisitor(org.jacoco.report.IReportVisitor) HTMLGroupVisitor(org.jacoco.report.internal.html.HTMLGroupVisitor) BundlePage(org.jacoco.report.internal.html.page.BundlePage) Collection(java.util.Collection) IBundleCoverage(org.jacoco.core.analysis.IBundleCoverage) List(java.util.List) Resources(org.jacoco.report.internal.html.resources.Resources) ElementIndex(org.jacoco.report.internal.html.index.ElementIndex)

Aggregations

ReportOutputFolder (org.jacoco.report.internal.ReportOutputFolder)7 Resources (org.jacoco.report.internal.html.resources.Resources)7 MemoryMultiReportOutput (org.jacoco.report.MemoryMultiReportOutput)6 HTMLDocument (org.jacoco.report.internal.html.HTMLDocument)5 HTMLSupport (org.jacoco.report.internal.html.HTMLSupport)5 Before (org.junit.Before)5 Collection (java.util.Collection)1 List (java.util.List)1 Locale (java.util.Locale)1 IBundleCoverage (org.jacoco.core.analysis.IBundleCoverage)1 ILanguageNames (org.jacoco.report.ILanguageNames)1 IReportVisitor (org.jacoco.report.IReportVisitor)1 ISourceFileLocator (org.jacoco.report.ISourceFileLocator)1 JavaNames (org.jacoco.report.JavaNames)1 HTMLGroupVisitor (org.jacoco.report.internal.html.HTMLGroupVisitor)1 IHTMLReportContext (org.jacoco.report.internal.html.IHTMLReportContext)1 ILinkable (org.jacoco.report.internal.html.ILinkable)1 LinkableStub (org.jacoco.report.internal.html.LinkableStub)1 ElementIndex (org.jacoco.report.internal.html.index.ElementIndex)1 IIndexUpdate (org.jacoco.report.internal.html.index.IIndexUpdate)1