mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
report/net-barchart: fix unit test to work with gnc-monetary
The unit test for net-barchart did not initialize html stylesheets. Without any stylesheets available, the renderer defaults to a trivial renderer. This works fine if the table in the net-barchart report is populated by doubles. However, now it is populated by gnc-monetary and they need a stylesheet to be properly formatted. Using doubles and the trivial renderer, a table cell looks like: <td class="number-cell"><number> 6.0</td> Using gnc-monetary and the trivial renderer, a table cell looks like: <td class="number-cell"><gnc-monetary> #[unknown]</td> Initializing the html stylesheets, the table cell looks like: <td class="number-cell">$6.00</td> This commit makes sure to initialize the html stylesheet code in the unit test and adapts the parsing code to the new formatting.
This commit is contained in:
parent
2fcd1efd6d
commit
9c7ba52315
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
(use-modules (gnucash gnc-module))
|
(use-modules (gnucash gnc-module))
|
||||||
(gnc:module-load "gnucash/report/report-system" 0)
|
(gnc:module-load "gnucash/report/report-system" 0)
|
||||||
|
(use-modules (gnucash report stylesheets))
|
||||||
|
|
||||||
(use-modules (gnucash engine test test-extras))
|
(use-modules (gnucash engine test test-extras))
|
||||||
(use-modules (gnucash report report-system test test-extras))
|
(use-modules (gnucash report report-system test test-extras))
|
||||||
@ -99,11 +100,11 @@
|
|||||||
(let* ((result (gnc:html-document-render doc #f))
|
(let* ((result (gnc:html-document-render doc #f))
|
||||||
(tbl (stream->list
|
(tbl (stream->list
|
||||||
(pattern-streamer "<tr>"
|
(pattern-streamer "<tr>"
|
||||||
(list (list "<string> ([0-9][0-9])/([0-9][0-9])/([0-9][0-9])</td>"
|
(list (list "<td>([0-9][0-9])/([0-9][0-9])/([0-9][0-9])</td>"
|
||||||
1 2 3)
|
1 2 3)
|
||||||
(list "<number> ([^<]*)</td>" 1)
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
|
||||||
(list "<number> ([^<]*)</td>" 1)
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
|
||||||
(list "<number> ([^<]*)</td>" 1))
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1))
|
||||||
result))))
|
result))))
|
||||||
(and (= 1 (tbl-ref->number tbl 0 1))
|
(and (= 1 (tbl-ref->number tbl 0 1))
|
||||||
(= 0 (tbl-ref->number tbl 0 2))
|
(= 0 (tbl-ref->number tbl 0 2))
|
||||||
@ -153,11 +154,11 @@
|
|||||||
(let* ((result (gnc:html-document-render doc #f))
|
(let* ((result (gnc:html-document-render doc #f))
|
||||||
(tbl (stream->list
|
(tbl (stream->list
|
||||||
(pattern-streamer "<tr>"
|
(pattern-streamer "<tr>"
|
||||||
(list (list "<string> ([0-9][0-9])/([0-9][0-9])/([0-9][0-9])</td>"
|
(list (list "<td>([0-9][0-9])/([0-9][0-9])/([0-9][0-9])</td>"
|
||||||
1 2 3)
|
1 2 3)
|
||||||
(list "<number> ([^<]*)</td>" 1)
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
|
||||||
(list "<number> ([^<]*)</td>" 1)
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
|
||||||
(list "<number> ([^<]*)</td>" 1))
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1))
|
||||||
result))))
|
result))))
|
||||||
(and (every (lambda (row)
|
(and (every (lambda (row)
|
||||||
(and (equal? (second row) (fourth row))
|
(and (equal? (second row) (fourth row))
|
||||||
@ -207,11 +208,11 @@
|
|||||||
(let* ((result (gnc:html-document-render doc #f))
|
(let* ((result (gnc:html-document-render doc #f))
|
||||||
(tbl (stream->list
|
(tbl (stream->list
|
||||||
(pattern-streamer "<tr>"
|
(pattern-streamer "<tr>"
|
||||||
(list (list "<string> ([0-9][0-9])/([0-9][0-9])/([0-9][0-9])</td>"
|
(list (list "<td>([0-9][0-9])/([0-9][0-9])/([0-9][0-9])</td>"
|
||||||
1 2 3)
|
1 2 3)
|
||||||
(list "<number> ([^<]*)</td>" 1)
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
|
||||||
(list "<number> ([^<]*)</td>" 1)
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
|
||||||
(list "<number> ([^<]*)</td>" 1))
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1))
|
||||||
result))))
|
result))))
|
||||||
(and (every (lambda (row)
|
(and (every (lambda (row)
|
||||||
(and (= (string->number (car (fourth row)))
|
(and (= (string->number (car (fourth row)))
|
||||||
@ -263,11 +264,11 @@
|
|||||||
(let* ((result (gnc:html-document-render doc #f))
|
(let* ((result (gnc:html-document-render doc #f))
|
||||||
(tbl (stream->list
|
(tbl (stream->list
|
||||||
(pattern-streamer "<tr>"
|
(pattern-streamer "<tr>"
|
||||||
(list (list "<string> ([0-9][0-9])/([0-9][0-9])/([0-9][0-9])</td>"
|
(list (list "<td>([0-9][0-9])/([0-9][0-9])/([0-9][0-9])</td>"
|
||||||
1 2 3)
|
1 2 3)
|
||||||
(list "<number> ([^<]*)</td>" 1)
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
|
||||||
(list "<number> ([^<]*)</td>" 1)
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
|
||||||
(list "<number> ([^<]*)</td>" 1))
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1))
|
||||||
result))))
|
result))))
|
||||||
(and (every (lambda (row)
|
(and (every (lambda (row)
|
||||||
(and (= (string->number (car (fourth row)))
|
(and (= (string->number (car (fourth row)))
|
||||||
@ -328,11 +329,11 @@
|
|||||||
(let* ((result (gnc:html-document-render doc #f))
|
(let* ((result (gnc:html-document-render doc #f))
|
||||||
(tbl (stream->list
|
(tbl (stream->list
|
||||||
(pattern-streamer "<tr>"
|
(pattern-streamer "<tr>"
|
||||||
(list (list "<string> ([0-9][0-9])/([0-9][0-9])/([0-9][0-9])</td>"
|
(list (list "<td>([0-9][0-9])/([0-9][0-9])/([0-9][0-9])</td>"
|
||||||
1 2 3)
|
1 2 3)
|
||||||
(list "<number> ([^<]*)</td>" 1)
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
|
||||||
(list "<number> ([^<]*)</td>" 1)
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
|
||||||
(list "<number> ([^<]*)</td>" 1))
|
(list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1))
|
||||||
result))))
|
result))))
|
||||||
(and (every (lambda (row)
|
(and (every (lambda (row)
|
||||||
(and (= (string->number (car (fourth row)))
|
(and (= (string->number (car (fourth row)))
|
||||||
|
Loading…
Reference in New Issue
Block a user