Index: openacs-4/packages/acs-automated-testing/tcl/coverage-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/tcl/coverage-procs.tcl,v
diff -u -r1.1.2.10 -r1.1.2.11
--- openacs-4/packages/acs-automated-testing/tcl/coverage-procs.tcl 28 Feb 2021 16:56:17 -0000 1.1.2.10
+++ openacs-4/packages/acs-automated-testing/tcl/coverage-procs.tcl 1 Mar 2021 16:30:44 -0000 1.1.2.11
@@ -134,8 +134,8 @@
ad_proc -private aa::percentage_to_color {
percentage
} {
- Calculates a color from the percentage. 0 gives red, 100 gives
- green.
+ Calculates background and foreground color from an percentage. 0
+ gives red, 100 gives green.
@author Gustaf neumann
@@ -145,11 +145,15 @@
set red 255
set green 255
if {$percentage >= 0 && $percentage <= 50} {
- set green [expr {510 * $percentage/100.0}]
+ set green [expr {int(510 * $percentage/100.0)}]
} elseif {$percentage > 50.0 && $percentage <= 100.0} {
- set red [expr {-510 * $percentage/100.0 + 510}]
+ set red [expr {int(-510 * $percentage/100.0 + 510)}]
}
- return [format %.2x [expr {int($red)}]][format %.2x [expr {int($green)}]]00
+ set luminance [expr {0.2126*$red + 0.7152*$green + 0.0722*0}]
+ return [list \
+ background #[format %.2x $red][format %.2x $green]00 \
+ foreground [expr {$luminance < 120 ? "#ffffff": "#000000"}] \
+ ]
}
ad_proc -public aa::coverage::proc_coverage_level {
Index: openacs-4/packages/acs-automated-testing/www/admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/admin/index.adp,v
diff -u -r1.21.2.12 -r1.21.2.13
--- openacs-4/packages/acs-automated-testing/www/admin/index.adp 28 Feb 2021 16:42:10 -0000 1.21.2.12
+++ openacs-4/packages/acs-automated-testing/www/admin/index.adp 1 Mar 2021 16:30:44 -0000 1.21.2.13
@@ -142,7 +142,8 @@
- |
- |
- |
-
+ |
@packageinfo.proc_coverage@% |
@packageinfo.total@ |
@@ -160,14 +161,15 @@
OK
-
+ |
@packageinfo.proc_coverage@% |
+ style="background: @global_test_coverage_color.background@; color: @global_test_coverage_color.foreground@;">
Global proc coverage: @global_test_coverage_percent@%
|
Index: openacs-4/packages/acs-automated-testing/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/admin/index.tcl,v
diff -u -r1.16.2.11 -r1.16.2.12
--- openacs-4/packages/acs-automated-testing/www/admin/index.tcl 28 Feb 2021 16:56:17 -0000 1.16.2.11
+++ openacs-4/packages/acs-automated-testing/www/admin/index.tcl 1 Mar 2021 16:30:44 -0000 1.16.2.12
@@ -18,6 +18,7 @@
by_category:onevalue
view_by:onevalue
quiet:onevalue
+ global_test_coverage_color
}
set doc(title) "System test cases"
set context ""
@@ -105,22 +106,24 @@
set global_test_coverage [aa::coverage::proc_coverage]
set global_test_coverage_percent [dict get $global_test_coverage coverage]
set global_test_coverage_level [aa::coverage::proc_coverage_level $global_test_coverage_percent]
- set global_test_coverage_color [aa::percentage_to_color $global_test_coverage_percent]
+ array set global_test_coverage_color [aa::percentage_to_color $global_test_coverage_percent]
#
# Prepare the template data for a view_by "package"
#
- template::multirow create packageinfo key total passes fails warnings proc_coverage proc_coverage_level color
+ template::multirow create packageinfo key total passes fails warnings proc_coverage \
+ proc_coverage_level background foreground
foreach package_key [lsort [array names packages]] {
lassign $packages($package_key) total passes fails warnings
set proc_coverage [dict get [aa::coverage::proc_coverage -package_key $package_key] coverage]
set proc_coverage_level [aa::coverage::proc_coverage_level $proc_coverage]
- set proc_coverage_color [aa::percentage_to_color $proc_coverage]
+ set color [aa::percentage_to_color $proc_coverage]
#ns_log notice "view_by $view_by package_key=$package_key $proc_coverage_level $proc_coverage_color"
template::multirow append packageinfo $package_key $total \
$passes $fails $warnings \
- $proc_coverage $proc_coverage_level $proc_coverage_color
+ $proc_coverage $proc_coverage_level \
+ [dict get $color background] [dict get $color foreground]
}
} else {
#