{% extends "html/index.html" %}
{% block script %}
function openFunctionalDetailModal() {
document.getElementById('functional-detail-modal-overlay').style.display = 'block';
document.getElementById('functional-detail-modal').style.display = 'block';
dragElement(document.getElementById('functional-detail-modal'));
}
// 关闭模态框
function closeFunctionalDetailModal() {
document.getElementById('functional-detail-modal-overlay').style.display = 'none';
document.getElementById('functional-detail-modal').style.display = 'none';
}
function dragElement(elmnt) {
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
elmnt.onmousedown = dragMouseDown;
function dragMouseDown(e) {
e = e || window.event;
e.preventDefault();
// get the mouse cursor position at startup:
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
// call a function whenever the cursor moves:
document.onmousemove = elementDrag;
}
function elementDrag(e) {
e = e || window.event;
e.preventDefault();
// calculate the new cursor position:
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
// set the element's new position:
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
}
function closeDragElement() {
// stop moving when mouse button is released:
document.onmouseup = null;
document.onmousemove = null;
}
}
document.addEventListener("DOMContentLoaded", function() {
const urlParams = new URLSearchParams(window.location.search);
const K = urlParams.getAll('K');
var filterString = "";
for (let i = 0; i < K.length; i++) {
const params = K[i].split(",");
if(params.length != 6){
console.log("Formart of: K["+i+"] is empty: " + K[i]);
continue;
}
console.log("K["+i+"]: " + params.join(","));
const firstTag = params[0].toUpperCase(); // Item need remain
const firstClass = params[1];
const secondTag = params[2].toUpperCase(); // Condition 1
const secondClass = params[3];
const thirdTag = params[4].toUpperCase(); // Condition 2
const targetStr = params[5];
filterString += "Item(" + firstTag + ", " + firstClass + ") with C1(" + secondTag + ", "
+ secondClass + ") and C2(" + thirdTag + ", " + targetStr + ") && ";
// search
const elements = document.getElementsByTagName(firstTag);
for (let j = elements.length - 1; j >= 0; j--) {
if (elements[j].classList.contains(firstClass)) {
var needRemove = false;
if(secondTag.length > 0){
needRemove = true;
const secondElements = elements[j].getElementsByTagName(secondTag);
for (let k = secondElements.length - 1; k >= 0; k--) {
if (secondElements[k].classList.contains(secondClass)) {
needRemove = false;
break;
}
}
}
if(thirdTag.length > 0 && !needRemove){
needRemove = true;
const thirdElements = elements[j].getElementsByTagName(thirdTag);
for (let k = thirdElements.length - 1; k >= 0; k--) {
if (thirdElements[k].outerHTML.includes(targetStr)) {
needRemove = false;
break;
}
}
}
if(needRemove){
elements[j].parentNode.removeChild(elements[j]);
}
}
}
}
if(filterString.length > 0){
filterString = filterString.substring(0, filterString.length - 4);
document.getElementById('tr_filter_string').style.display = '';
document.getElementById('td_filter_string').innerHTML = filterString;
document.getElementById('td_filter_string').style.color = '#ff00ff';
}
var openFuc = urlParams.getAll('ShowFunCov');
if(openFuc.length > 0){
if(openFuc[0] == "1" || openFuc[0] == "true"){
openFunctionalDetailModal();
}
}
});
{% endblock %}
{% block coverage %}
Functional Coverage
{% if coverages.functional %}
{% set total_g = coverages.functional.group_num_total %}
{% set total_p = coverages.functional.point_num_total %}
{% set total_b = coverages.functional.bin_num_total %}
{% set hints_g = coverages.functional.group_num_hints %}
{% set hints_p = coverages.functional.point_num_hints %}
{% set hints_b = coverages.functional.bin_num_hints %}
{% if total_g != 0 %}
{% set rate_g = hints_g / total_g * 100 %}
{% else %}
{% set rate_g = 0 %}
{% endif %}
{% if total_p != 0 %}
{% set rate_p = hints_p / total_p * 100 %}
{% else %}
{% set rate_p = 0 %}
{% endif %}
{% if total_b != 0 %}
{% set rate_b = hints_b / total_b * 100 %}
{% else %}
{% set rate_b = 0 %}
{% endif %}
{% set fc_grate = coverages.functional.grate %}
{% set show_once = coverages.functional.has_once %}
Groups: {{hints_g}}/{{total_g}} ({{rate_g|round(2)}}%)
Points: {{hints_p}}/{{total_p}} ({{rate_p|round(2)}}%)
Bins: {{hints_b}}/{{total_b}} ({{rate_b|round(2)}}%)
{% for group in coverages.functional.groups %}
- Group: {{group.name}} {% if group.hinted %}Passed{% else %}
Failed {% endif %}
{% for point in group.points %}
-
{% if point.once %}
*
{% endif %}
Point: {{point.name}} {% if point.hinted %}
Passed{% else %}
Failed {% endif %}
{% for bin in point.bins %}
- Bin: {{bin.name}} {% if total_b != 0 %}
{% if bin.hints != 0 %}
{{bin.hints}}
{% else %}
{{bin.hints}}
{% endif %}
{% else %}
0
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endif %}
{% if show_once %}
*: It means that once this coverage point is set as hinted, its bins will no longer be counted.
{% endif %}
Line Coverage
Coverage Rate |
Hint Lines |
Total Lines |
Detail |
{% if coverages.line is none %}
N/A |
N/A |
N/A |
N/A |
{% else %}
{% set line_rate = 0 %}
{% if coverages.line.total != 0 %}
{% set line_rate = (coverages.line.hints / coverages.line.total * 100) %}
{% endif %}
{{ line_rate|round(2) }}%
|
{{ coverages.line.hints }} |
{{ coverages.line.total }} |
View Details |
{% endif %}
|
Functional Coverage
Coverage Rate |
Hint Points |
Total Points |
Detail |
{% if coverages.functional is none %}
N/A |
N/A |
N/A |
N/A |
{% else %}
{% set point_rate = 0 %}
{% if coverages.functional.point_num_total != 0 %}
{% set point_rate = (coverages.functional.point_num_hints / coverages.functional.point_num_total * 100) %}
{% endif %}
{{ point_rate|round(2) }}%
|
{{ coverages.functional.point_num_hints }} |
{{ coverages.functional.point_num_total }} |
View Details |
{% endif %}
|
{% endblock %}
{% block footer %}
Toffee Report, Do Not Edit.
{% endblock %}