From c231f393d334a3fbdb54908d01485acf74f19e0c Mon Sep 17 00:00:00 2001 From: abv Date: Fri, 18 Aug 2017 11:00:24 +0300 Subject: [PATCH] 0029015: Testdiff - possibility to visualize image differences by toggling Command testdiff is improved to make HTML elements in the report showing diff images interactive: when user clicks on a diff image by mouse, it triggers between the A and B images. The diff image is shown back when the mouse cursor leaves the image. --- src/DrawResources/TestCommands.tcl | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/DrawResources/TestCommands.tcl b/src/DrawResources/TestCommands.tcl index f0d13c8717..c985269e13 100644 --- a/src/DrawResources/TestCommands.tcl +++ b/src/DrawResources/TestCommands.tcl @@ -2157,8 +2157,19 @@ proc _log_html_diff {file log dir1 dir2 highlight_percent} { puts $fd "

Version A - $dir1

" puts $fd "

Version B - $dir2

" - # print log body, trying to add HTML links to script files on lines like - # "Executing ..." + # add script for switching between images on click + puts $fd "" + puts $fd "" + puts $fd "" + + # print log body puts $fd "
"
     set logpath [file split [file normalize $file]]
     foreach line $log {
@@ -2177,17 +2188,20 @@ proc _log_html_diff {file log dir1 dir2 highlight_percent} {
                 set gridpath ""
             }
             set aCaseName [lindex $case end]
-            set img1 ""
-            set img2 ""
+            set img1url [_make_url $file [file join $dir1 $gridpath $img]]
+            set img2url [_make_url $file [file join $dir2 $gridpath $img]]
+            set img1 ""
+            set img2 ""
 
             set difffile [_diff_img_name $dir1 $dir2 $gridpath $img]
+            set imgdurl [_make_url $file $difffile]
             if { [file exists $difffile] } {
-                set imgd ""
+                set imgd ""
             } else {
                 set imgd "N/A"
             }
 
-            puts $fd ""
+            puts $fd "
Version AVersion BDifferent pixels
" puts $fd "
Version AVersion BDiff (click to toggle)
$img1$img2$imgd
" } }