Skip to content

Commit

Permalink
Add linked Html function outline (#515)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukas Atkinson <opensource@LukasAtkinson.de>
  • Loading branch information
Spacetown and latk committed Dec 29, 2021
1 parent 493095b commit dd0dc02
Show file tree
Hide file tree
Showing 539 changed files with 15,753 additions and 693 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Expand Up @@ -15,6 +15,7 @@ Improvements and new features:
- Don't use a temporary directory for running gcov (:issue:`525`)
- Fix junctions on windows for Python 3.8 (:issue:`535`)
- Can create reproducible reports with the :option:`--timestamp` option (:issue:`546`)
- Add "Goto function" in html details. (:issue:`515`)

Documentation:

Expand Down
25 changes: 25 additions & 0 deletions doc/examples/example_html.details.css
Expand Up @@ -372,6 +372,31 @@ pre
margin-bottom: 0;
}

.listOfFunctions td, .listOfFunctions th {
padding: 0 10px;
}
.listOfFunctions th
{
text-align: center;
color: white;
background-color: SteelBlue;
}
.listOfFunctions tr > td {
background: aliceblue;
}
.listOfFunctions tr:nth-child(even) > td {
background: LightSteelBlue
}
.listOfFunctions tr:hover > td
{
background-color: #ddd;
}
.listOfFunctions tr > td > a
{
text-decoration: none;
color: inherit;
}

.source-line
{
height : 15px;
Expand Down
Expand Up @@ -62,6 +62,39 @@ <h1>GCC Code Coverage Report</h1>

<hr/>

<details>
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Call count</th>
</tr>
<tr>
<td>
<a href="#l3">foo(int)</a>
</td>
<td>
<a href="#l3">3</a>
</td>
<td>
<a href="#l3"> called 1 time</a>
</td>
</tr>
<tr>
<td>
<a href="#l15">main</a>
</td>
<td>
<a href="#l15">15</a>
</td>
<td>
<a href="#l15"> called 1 time</a>
</td>
</tr>
</table>
</details>
<hr/>
<div class="file-source">
<table>
<tr>
Expand Down
25 changes: 25 additions & 0 deletions doc/examples/example_html.html
Expand Up @@ -380,6 +380,31 @@
margin-bottom: 0;
}

.listOfFunctions td, .listOfFunctions th {
padding: 0 10px;
}
.listOfFunctions th
{
text-align: center;
color: white;
background-color: SteelBlue;
}
.listOfFunctions tr > td {
background: aliceblue;
}
.listOfFunctions tr:nth-child(even) > td {
background: LightSteelBlue
}
.listOfFunctions tr:hover > td
{
background-color: #ddd;
}
.listOfFunctions tr > td > a
{
text-decoration: none;
color: inherit;
}

.source-line
{
height : 15px;
Expand Down
Binary file modified doc/images/screenshot-html-details.example.cpp.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 31 additions & 1 deletion gcovr/templates/source_page.html
Expand Up @@ -36,7 +36,7 @@
<th scope="row">Functions:</th>
<td>{{functions.exec}}</td>
<td>{{functions.total}}</td>
<td class="{{info.functions.class}}">{{functions.coverage}}%</td>
<td class="{{functions.class}}">{{functions.coverage}}%</td>
</tr>
<tr>
<th scope="row">Branches:</th>
Expand All @@ -49,6 +49,36 @@
{% endblock %}

{% block content %}
{% if function_list %}
<details>
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Call count</th>
</tr>
{% for entry in function_list %}
<tr>
<td>
<a href="#l{{ entry['line'] }}">{{ entry["name"] }}</a>
</td>
<td>
<a href="#l{{ entry['line'] }}">{{ entry["line"] }}</a>
</td>
<td>
<a href="#l{{ entry['line'] }}">
{%- if entry["count"] == 0 %} not called
{%- else %} called {{ entry["count"] }} time{% if entry["count"] > 1 %}s{% endif %}
{%- endif -%}
</a>
</td>
</tr>
{% endfor %}
</table>
</details>
<hr/>
{% endif -%}
<div class="file-source">
<table>
<tr>
Expand Down
25 changes: 25 additions & 0 deletions gcovr/templates/style.details.css
Expand Up @@ -82,6 +82,31 @@ pre
margin-bottom: 0;
}

.listOfFunctions td, .listOfFunctions th {
padding: 0 10px;
}
.listOfFunctions th
{
text-align: center;
color: white;
background-color: SteelBlue;
}
.listOfFunctions tr > td {
background: aliceblue;
}
.listOfFunctions tr:nth-child(even) > td {
background: LightSteelBlue
}
.listOfFunctions tr:hover > td
{
background-color: #ddd;
}
.listOfFunctions tr > td > a
{
text-decoration: none;
color: inherit;
}

.source-line
{
height : 15px;
Expand Down
Expand Up @@ -26,7 +26,7 @@ <h1>GCC Code Coverage Report</h1>
</tr>
<tr>
<th scope="row">Date:</th>
<td>2021-09-06 13:58:23</td>
<td>2021-09-21 19:21:54</td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -62,6 +62,28 @@ <h1>GCC Code Coverage Report</h1>

<hr/>

<details>
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Call count</th>
</tr>
<tr>
<td>
<a href="#l1">_Z3barv</a>
</td>
<td>
<a href="#l1">1</a>
</td>
<td>
<a href="#l1"> called 1 time</a>
</td>
</tr>
</table>
</details>
<hr/>
<div class="file-source">
<table>
<tr>
Expand Down
Expand Up @@ -26,7 +26,7 @@ <h1>GCC Code Coverage Report</h1>
</tr>
<tr>
<th scope="row">Date:</th>
<td>2021-09-06 13:58:23</td>
<td>2021-09-21 19:21:54</td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -62,6 +62,28 @@ <h1>GCC Code Coverage Report</h1>

<hr/>

<details>
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Call count</th>
</tr>
<tr>
<td>
<a href="#l1">_Z3foov</a>
</td>
<td>
<a href="#l1">1</a>
</td>
<td>
<a href="#l1"> called 1 time</a>
</td>
</tr>
</table>
</details>
<hr/>
<div class="file-source">
<table>
<tr>
Expand Down
Expand Up @@ -26,7 +26,7 @@ <h1>GCC Code Coverage Report</h1>
</tr>
<tr>
<th scope="row">Date:</th>
<td>2021-09-06 13:58:23</td>
<td>2021-09-21 19:21:54</td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -62,6 +62,28 @@ <h1>GCC Code Coverage Report</h1>

<hr/>

<details>
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Call count</th>
</tr>
<tr>
<td>
<a href="#l10">main</a>
</td>
<td>
<a href="#l10">10</a>
</td>
<td>
<a href="#l10"> called 2 times</a>
</td>
</tr>
</table>
</details>
<hr/>
<div class="file-source">
<table>
<tr>
Expand Down
Expand Up @@ -26,7 +26,7 @@ <h1>GCC Code Coverage Report</h1>
</tr>
<tr>
<th scope="row">Date:</th>
<td>2021-07-19 19:32:09</td>
<td>2021-09-21 19:04:30</td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -62,6 +62,28 @@ <h1>GCC Code Coverage Report</h1>

<hr/>

<details>
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Call count</th>
</tr>
<tr>
<td>
<a href="#l1">bar()</a>
</td>
<td>
<a href="#l1">1</a>
</td>
<td>
<a href="#l1"> called 1 time</a>
</td>
</tr>
</table>
</details>
<hr/>
<div class="file-source">
<table>
<tr>
Expand Down
Expand Up @@ -26,7 +26,7 @@ <h1>GCC Code Coverage Report</h1>
</tr>
<tr>
<th scope="row">Date:</th>
<td>2021-07-19 19:32:09</td>
<td>2021-09-21 19:04:30</td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -62,6 +62,28 @@ <h1>GCC Code Coverage Report</h1>

<hr/>

<details>
<summary>List of functions</summary>
<table class="listOfFunctions">
<tr>
<th>Function</th>
<th>Line</th>
<th>Call count</th>
</tr>
<tr>
<td>
<a href="#l1">foo()</a>
</td>
<td>
<a href="#l1">1</a>
</td>
<td>
<a href="#l1"> called 1 time</a>
</td>
</tr>
</table>
</details>
<hr/>
<div class="file-source">
<table>
<tr>
Expand Down

0 comments on commit dd0dc02

Please sign in to comment.