Index: dashboard-tests.scm ================================================================== --- dashboard-tests.scm +++ dashboard-tests.scm @@ -23,15 +23,11 @@ (list "Testname: " "Item path: " "Current state: " "Current status: " "Test comment: " - "Test id: " - "Value: " - "Expected value: " - "Tolerance: " - "Units: ")) + "Test id: ")) (list (iup:label "" #:expand "VERTICAL")))) (apply iup:vbox ; #:expand "YES" (list (store-label "testname" (iup:label (db:test-get-testname testdat) #:expand "HORIZONTAL") @@ -62,30 +58,10 @@ (store-label "testid" (iup:label "TestId " #:expand "HORIZONTAL") (lambda (testdat) (db:test-get-id testdat))) -;; (store-label "testvalue" -;; (iup:label "TestValue " -;; #:expand "HORIZONTAL") -;; (lambda (testdat) -;; (db:test-get-value testdat))) -;; (store-label "testexpectedvalue" -;; (iup:label "TestExpectedValue " -;; #:expand "HORIZONTAL") -;; (lambda (testdat) -;; (db:test-get-expected_value testdat))) -;; (store-label "testtol" -;; (iup:label "TestTol " -;; #:expand "HORIZONTAL") -;; (lambda (testdat) -;; (db:test-get-tol testdat))) -;; (store-label "testunits" -;; (iup:label "TestUnits " -;; #:expand "HORIZONTAL") -;; (lambda (testdat) -;; (db:test-get-units testdat))) ))))) ;;====================================================================== ;; Test meta panel ;;====================================================================== @@ -346,49 +322,87 @@ (iup:hbox (iup:button "View Log" #:action viewlog #:size "120x") (iup:button "Start Xterm" #:action xterm #:size "120x") (iup:button "Close" #:action (lambda (x)(exit)) #:size "120x"))) (set-fields-panel test-id testdat) - (iup:frame - #:title "Test Steps" - (let ((stepsdat ;;(iup:label "Test steps ........................................." - ;; #:expand "YES" - ;; #:size "200x150" - ;; #:alignment "ALEFT:ATOP"))) - (iup:textbox #:action (lambda (obj char val) - #f) - #:expand "YES" - #:multiline "YES" - #:font "Courier New, -10"))) - (hash-table-set! widgets "Test Steps" (lambda (testdat) - (let* ((currval (iup:attribute stepsdat "VALUE")) ;; "TITLE")) - (fmtstr "~25a~10a~10a~15a~15a") - (comprsteps (db:get-steps-table db test-id)) - (newval (string-intersperse - (append - (list - (format #f fmtstr "Stepname" "Start" "End" "Status" "Time") - (format #f fmtstr "========" "=====" "======" "======" "==========")) - (map (lambda (x) - ;; take advantage of the \n on time->string - (format #f fmtstr - (vector-ref x 0) - (let ((s (vector-ref x 1))) - (if (number? s)(seconds->time-string s) s)) - (let ((s (vector-ref x 2))) - (if (number? s)(seconds->time-string s) s)) - (vector-ref x 3) ;; status - (vector-ref x 4))) ;; time delta - (sort (hash-table-values comprsteps) - (lambda (a b) - (if (and (number? a)(number? b)) - (< (vector-ref a 1)(vector-ref b 1)) - #t))))) - "\n"))) - (if (not (equal? currval newval)) - (iup:attribute-set! stepsdat "VALUE" newval ))))) ;; "TITLE" newval))))) - stepsdat))))) + (iup:hbox + (iup:frame + #:title "Test Steps" + (let ((stepsdat ;;(iup:label "Test steps ........................................." + ;; #:expand "YES" + ;; #:size "200x150" + ;; #:alignment "ALEFT:ATOP"))) + (iup:textbox #:action (lambda (obj char val) + #f) + #:expand "YES" + #:multiline "YES" + #:font "Courier New, -10" + #:size "100x150"))) + (hash-table-set! widgets "Test Steps" + (lambda (testdat) + (let* ((currval (iup:attribute stepsdat "VALUE")) ;; "TITLE")) + (fmtstr "~20a~10a~10a~12a~15a") + (comprsteps (db:get-steps-table db test-id)) + (newval (string-intersperse + (append + (list + (format #f fmtstr "Stepname" "Start" "End" "Status" "Time") + (format #f fmtstr "========" "=====" "===" "======" "====")) + (map (lambda (x) + ;; take advantage of the \n on time->string + (format #f fmtstr + (vector-ref x 0) + (let ((s (vector-ref x 1))) + (if (number? s)(seconds->time-string s) s)) + (let ((s (vector-ref x 2))) + (if (number? s)(seconds->time-string s) s)) + (vector-ref x 3) ;; status + (vector-ref x 4))) ;; time delta + (sort (hash-table-values comprsteps) + (lambda (a b) + (if (and (number? a)(number? b)) + (< (vector-ref a 1)(vector-ref b 1)) + #t))))) + "\n"))) + (if (not (equal? currval newval)) + (iup:attribute-set! stepsdat "VALUE" newval ))))) ;; "TITLE" newval))))) + stepsdat)) + ;; populate the Test Data panel + (iup:frame + #:title "Test Data" + (let ((test-data + (iup:textbox #:action (lambda (obj char val) + #f) + #:expand "YES" + #:multiline "YES" + #:font "Courier New, -10" + #:size "100x150"))) + (hash-table-set! widgets "Test Data" + (lambda (testdat) ;; + (let* ((currval (iup:attribute test-data "VALUE")) ;; "TITLE")) + (fmtstr "~10a~10a~10a~10a~7a~7a~6a~a") ;; category,variable,value,expected,tol,units,comment + (newval (string-intersperse + (append + (list + (format #f fmtstr "Category" "Variable" "Value" "Expected" "Tol" "Status" "Units" "Comment") + (format #f fmtstr "========" "========" "=====" "========" "===" "======" "=====" "=======")) + (map (lambda (x) + (format #f fmtstr + (db:test-data-get-category x) + (db:test-data-get-variable x) + (db:test-data-get-value x) + (db:test-data-get-expected x) + (db:test-data-get-tol x) + (db:test-data-get-status x) + (db:test-data-get-units x) + (db:test-data-get-comment x))) + (db:read-test-data db test-id "%"))) + "\n"))) + (if (not (equal? currval newval)) + (iup:attribute-set! test-data "VALUE" newval ))))) ;; "TITLE" newval))))) + test-data))) + ))) (iup:show self) (iup:callback-set! *tim* "ACTION_CB" (lambda (x) ;; Now start keeping the gui updated from the db (refreshdat) ;; update from the db here Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -559,11 +559,11 @@ (let ((res '())) (sqlite3:for-each-row (lambda (id test_id category variable value expected tol units comment status) (set! res (cons res (vector id test_id category variable value expected tol units comment status)))) db - "SELECT id,test_id,category,variable,value,expected,tol,units,comment,status FROM test_data WHERE test_id=? AND category LIKE ?;" test-id categorypatt) + "SELECT id,test_id,category,variable,value,expected,tol,units,comment,status FROM test_data WHERE test_id=? AND category LIKE ? ORDER BY category,variable;" test-id categorypatt) (reverse res))) (define (db:load-test-data db run-id test-name itemdat) (let* ((item-path (item-list->path itemdat)) (testdat (db:get-test-info db run-id test-name item-path)) @@ -689,21 +689,22 @@ (debug:print 4 "record[1]=" (vector-ref record 1) ", startt=" startt ", endt=" endt ", get-status: " (db:step-get-status step)) (if (and (number? startt)(number? endt)) (seconds->hr-min-sec (- endt startt)) "-1")))) - (else (vector-set! record 1 (db:step-get-event_time step)))) - (vector-set! record 2 (db:step-get-state step)) - (vector-set! record 3 (db:step-get-status step)) - (vector-set! record 4 (db:step-get-event_time step)) + (else + (vector-set! record 2 (db:step-get-state step)) + (vector-set! record 3 (db:step-get-status step)) + (vector-set! record 4 (db:step-get-event_time step)))) (hash-table-set! res (db:step-get-stepname step) record) (debug:print 6 "record(after) = " record "\nid: " (db:step-get-id step) "\nstepname: " (db:step-get-stepname step) "\nstate: " (db:step-get-state step) "\nstatus: " (db:step-get-status step) "\ntime: " (db:step-get-event_time step)))) + ;; (else (vector-set! record 1 (db:step-get-event_time step))) (sort steps (lambda (a b)(< (db:step-get-event_time a)(db:step-get-event_time b))))) res))) ;; USE: (lset-difference string=? '("a" "b" "c") '("d" "c" "e" "a")) ;; Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -918,12 +918,12 @@ (db:test-get-id testdat)) ;; Now duplicate the test data (debug:print 4 "Copying records in test_data from test_id=" (db:test-get-id testdat) " to " (db:test-get-id new-testdat)) (sqlite3:execute db - (conc "INSERT OR REPLACE INTO test_data (test_id,category,variable,value,expected_value,tol,units,comment) " - "SELECT " (db:test-get-id new-testdat) ",category,variable,value,expected_value,tol,units,comment FROM test_data WHERE test_id=?;") + (conc "INSERT OR REPLACE INTO test_data (test_id,category,variable,value,expected,tol,units,comment) " + "SELECT " (db:test-get-id new-testdat) ",category,variable,value,expected,tol,units,comment FROM test_data WHERE test_id=?;") (db:test-get-id testdat)) )) prev-tests)))