From cbb0c36ad4f47f40ca45c8fe0ede6de60f4a4e9e Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sat, 14 Dec 2019 12:24:32 +0800 Subject: [PATCH] [test-owner-report] properly test link amounts Previous test wasn't comprehensive; due to variable row lengths, the (td 11) wouldn't consistently select the link amount. using (td -1) will select the last element in the row. Moreover also test the class-name to target the link amounts otherwise other elements (eg the aging-list) will also be returned. --- .../business-reports/test/test-owner-report.scm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gnucash/report/business-reports/test/test-owner-report.scm b/gnucash/report/business-reports/test/test-owner-report.scm index d040fc6961..8e4ae507a9 100644 --- a/gnucash/report/business-reports/test/test-owner-report.scm +++ b/gnucash/report/business-reports/test/test-owner-report.scm @@ -327,6 +327,7 @@ sxml))) (test-end "customer-report") + (display "new-owner-report tests:\n") (test-begin "new-customer-report") (let* ((options (default-testing-options 'customer-new owner-1 (get-acct "AR-USD"))) @@ -351,9 +352,18 @@ "$228.00" "$28.00" "$34.75" "$31.75") ((sxpath `(// (table 3) // tr (td 8) // *text*)) sxml)) - (test-equal "link-amounts" - '("$1.50" "$11.50" "$11.50" "$200.00" "$200.00") - ((sxpath `(// (table 3) // tr (td 11) // *text*)) + (test-equal "positive-link-amounts" + '("$1.50" "$2.00" "$8.00" "$7.50" "$8.50" "$11.50" "$11.50" + "$4.00" "$200.00" "$200.00" "$6.75") + ((sxpath `(// (table 3) // tr + (td -1 (@ (equal? (class "number-cell")))) // + *text*)) + sxml)) + (test-equal "negative-link-amounts" + '("-$3.00") + ((sxpath `(// (table 3) // tr + (td -1 (@ (equal? (class "number-cell neg")))) // + *text*)) sxml)) ;; from the report, find the 3rd table, last row, find embedded ;; table, retrieve tr contents