gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Thu Jun 7 15:01:40 EDT 2018
Updated via https://github.com/Gnucash/gnucash/commit/690ef626 (commit)
via https://github.com/Gnucash/gnucash/commit/848e3da1 (commit)
via https://github.com/Gnucash/gnucash/commit/324cfeb3 (commit)
from https://github.com/Gnucash/gnucash/commit/8cfa078b (commit)
commit 690ef626a8b60cc172d7e4645fae3b5ecca449f7
Merge: 8cfa078 848e3da
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Jun 7 11:55:52 2018 -0700
Merge Carsten Rinke's branch 'Bug787401-TestReport-Definition' into maint.
commit 848e3da105b93b0402a51bbfcdcba8d1b9f8503d
Author: Carsten Rinke <carsten.rinke at gmx.de>
Date: Tue Jun 5 22:01:18 2018 +0200
Bug787401 - Test Report System - Report Definition
include change proposals from responses to PR#360
diff --git a/gnucash/report/report-system/test/test-report-system.scm b/gnucash/report/report-system/test/test-report-system.scm
index 6ad049a..289ce6d 100644
--- a/gnucash/report/report-system/test/test-report-system.scm
+++ b/gnucash/report/report-system/test/test-report-system.scm
@@ -16,8 +16,8 @@
(test-assert "Missing GUID detection" (test-check2))
(test-assert "Detect double GUID" (test-check3))
(test-assert "Report with Full Argument Set" (test-check4))
- (test-end "Testing/Temporary/test-report-system")
(set! test-report-system-flag #f)
+ (test-end "Testing/Temporary/test-report-system")
)
;; -----------------------------------------------------------------------
@@ -29,10 +29,7 @@
;; -----------------------------------------------------------------------
(define (test-check2)
- (if (not (gnc:define-report 'version "1" 'name "Test Report Template"))
- #t
- #f
- )
+ (not (gnc:define-report 'version "1" 'name "Test Report Template"))
)
;; -----------------------------------------------------------------------
@@ -48,7 +45,21 @@
(define (test-check4)
(and
- (gnc:define-report 'version "1" 'name "Test Report Template" 'report-guid "54c2fc051af64a08ba2334c2e9179e24" 'parent-type "Parent Type" 'options-generator "Options Generator" 'renderer "Renderer" 'options-cleanup-cb "Options Clean-Up" 'options-changed-cb "Options Changed" 'in-menu? #f 'menu-path "Menu Path" 'menu-name "Menu Name" 'menu-tip "Menu Tip" 'export-types "Export Types" 'export-thunk "Export Thunk")
+ (gnc:define-report 'version "1"
+ 'name "Test Report Template"
+ 'report-guid "54c2fc051af64a08ba2334c2e9179e24"
+ 'parent-type "Parent Type"
+ 'options-generator "Options Generator"
+ 'renderer "Renderer"
+ 'options-cleanup-cb "Options Clean-Up"
+ 'options-changed-cb "Options Changed"
+ 'in-menu? #f
+ 'menu-path "Menu Path"
+ 'menu-name "Menu Name"
+ 'menu-tip "Menu Tip"
+ 'export-types "Export Types"
+ 'export-thunk "Export Thunk"
+ )
(string=? (gnc:report-template-version (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "1")
(string=? (gnc:report-template-name (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Test Report Template")
(string=? (gnc:report-template-report-guid
@@ -56,13 +67,13 @@
;; parent type is not exported -> it is used in gnc:make-report
(string=? (gnc:report-template-options-generator (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Options Generator")
(string=? (gnc:report-template-renderer (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Renderer")
- (string=? (gnc:report-template-options-cleanup-cb (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Options Clean-Up")
- (string=? (gnc:report-template-options-changed-cb (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Options Changed")
+ (string=? (gnc:report-template-options-cleanup-cb (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Options Clean-Up")
+ (string=? (gnc:report-template-options-changed-cb (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Options Changed")
(not (gnc:report-template-in-menu? (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")))
- (string=? (gnc:report-template-menu-path (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Menu Path")
- (string=? (gnc:report-template-menu-name (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Menu Name")
- (string=? (gnc:report-template-menu-tip (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Menu Tip")
- (string=? (gnc:report-template-export-types (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Export Types")
- (string=? (gnc:report-template-export-thunk (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Export Thunk")
+ (string=? (gnc:report-template-menu-path (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Menu Path")
+ (string=? (gnc:report-template-menu-name (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Menu Name")
+ (string=? (gnc:report-template-menu-tip (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Menu Tip")
+ (string=? (gnc:report-template-export-types (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Export Types")
+ (string=? (gnc:report-template-export-thunk (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Export Thunk")
)
)
commit 324cfeb3a4323711529f441e2278476c03a8dcec
Author: Carsten Rinke <carsten.rinke at gmx.de>
Date: Mon Jun 4 23:28:37 2018 +0200
Bug787401 - Test Report System - Report Definition
diff --git a/gnucash/report/report-system/report.scm b/gnucash/report/report-system/report.scm
index 00b5a4c..39ea6ca 100644
--- a/gnucash/report/report-system/report.scm
+++ b/gnucash/report/report-system/report.scm
@@ -72,6 +72,9 @@
(define gnc:optname-stylesheet (N_ "Stylesheet"))
(define gnc:menuname-business-reports (N_ "_Business"))
(define gnc:optname-invoice-number (N_ "Invoice Number"))
+(define test-report-system-flag #f)
+
+(export test-report-system-flag)
;; We want to warn users if they've got an old-style, non-guid custom
;; report-template, but only once
@@ -118,7 +121,7 @@
in-report-rec
(blank-report))))
(if (null? args)
- in-report-rec
+ report-rec
(let ((id (car args))
(value (cadr args))
(remainder (cddr args)))
@@ -139,9 +142,11 @@
;; FIXME: We should pass the top-level window
;; instead of the '() to gnc-error-dialog, but I
;; have no idea where to get it from.
- (gnc-error-dialog '() (string-append
+ (if (not test-report-system-flag)
+ (gnc-error-dialog '() (string-append
(_ "One of your reports has a report-guid that is a duplicate. Please check the report system, especially your saved reports, for a report with this report-guid: ")
report-guid))
+ #f)
)))
(begin
(if (gnc:report-template-name report-rec)
@@ -157,27 +162,39 @@
(gnc:report-template-renderer report-rec))
(not (gnc:report-template-parent-type rec)))
(begin
- (gnc:debug "gnc:define-report: setting parent-type of " (gnc:report-template-name report-rec) " to " (gnc:report-template-report-guid rec))
+ (gnc:warn "gnc:define-report: setting parent-type of " (gnc:report-template-name report-rec) " to " (gnc:report-template-report-guid rec))
(gnc:report-template-set-parent-type! report-rec (gnc:report-template-report-guid rec))
(gnc:debug "done setting, is now " (gnc:report-template-parent-type report-rec)))))
*gnc:_report-templates_*)
+ (if (gnc:report-template-parent-type report-rec)
+ (begin
+ ;; re-save this old-style report in the new format
+ (gnc:report-template-save-to-savefile report-rec)
+ (gnc:debug "complete saving " (gnc:report-template-name report-rec) " in new format")
+ (if (not gnc:old-style-report-warned)
+ (begin
+ (set! gnc:old-style-report-warned #t)
+ (if (not test-report-system-flag) ;; do not call this during "make test"
+ (gnc-error-dialog '() (string-append (_ "The GnuCash report system has been upgraded. Your old saved reports have been transferred into a new format. If you experience trouble with saved reports, please contact the GnuCash development team."))))
+ (hash-set! *gnc:_report-templates_* (gnc:report-template-report-guid report-rec) report-rec)
+ )
+ )
+ )
+ ;;there is no parent -> this is an inital faulty report definition
+ (if (not test-report-system-flag) ;; do not call this during "make test"
+ (gnc-error-dialog '() (string-append (_ "Wrong report definition: ")
+ (gnc:report-template-name report-rec)
+ (_ " Report is missing a GUID.")))
+ )
+ )
+ )
+ )
+ #f ;; report definition is faulty: does not include name
- ;; re-save this old-style report in the new format
- (gnc:report-template-save-to-savefile report-rec)
- (gnc:debug "complete saving " (gnc:report-template-name report-rec) " in new format")
- ))
-
+ ;;(gnc:warn "gnc:define-report: old-style report. setting guid for " (gnc:report-template-name report-rec) " to " (gnc:report-template-report-guid report-rec)) ;; obsolete
-
- (if (not gnc:old-style-report-warned)
- (begin
- (set! gnc:old-style-report-warned #t)
- (gnc-error-dialog '() (string-append (_ "The GnuCash report system has been upgraded. Your old saved reports have been transferred into a new format. If you experience trouble with saved reports, please contact the GnuCash development team.")))))
- (hash-set! *gnc:_report-templates_*
- (gnc:report-template-report-guid report-rec) report-rec)
- (gnc:warn "gnc:define-report: old-style report. setting guid for " (gnc:report-template-name report-rec) " to " (gnc:report-template-report-guid report-rec)))
- )))
+ ))))
(define gnc:report-template-version
(record-accessor <report-template> 'version))
diff --git a/gnucash/report/report-system/test/CMakeLists.txt b/gnucash/report/report-system/test/CMakeLists.txt
index 52ab315..7ecd67a 100644
--- a/gnucash/report/report-system/test/CMakeLists.txt
+++ b/gnucash/report/report-system/test/CMakeLists.txt
@@ -18,6 +18,7 @@ set(scm_test_report_system_SOURCES
set (scm_test_report_system_with_srfi64_SOURCES
test-html-utilities-srfi64.scm
+ test-report-system.scm
)
set(GUILE_DEPENDS
diff --git a/gnucash/report/report-system/test/test-report-system.scm b/gnucash/report/report-system/test/test-report-system.scm
new file mode 100644
index 0000000..6ad049a
--- /dev/null
+++ b/gnucash/report/report-system/test/test-report-system.scm
@@ -0,0 +1,68 @@
+(use-modules (gnucash gnc-module))
+
+(gnc:module-begin-syntax (gnc:module-load "gnucash/app-utils" 0))
+
+(use-modules (gnucash engine test test-extras))
+(use-modules (gnucash report report-system))
+(use-modules (srfi srfi-64))
+(use-modules (gnucash engine test srfi64-extras))
+
+(define (run-test)
+ (set! test-report-system-flag #t)
+ (test-runner-factory gnc:test-runner)
+ (test-begin "Testing/Temporary/test-report-system") ;; if (test-runner-factory gnc:test-runner) is commented out, this
+ ;; will create Testing/Temporary/test-asset-performance.log
+ (test-assert "Minimum Report Definition" (test-check1))
+ (test-assert "Missing GUID detection" (test-check2))
+ (test-assert "Detect double GUID" (test-check3))
+ (test-assert "Report with Full Argument Set" (test-check4))
+ (test-end "Testing/Temporary/test-report-system")
+ (set! test-report-system-flag #f)
+)
+
+;; -----------------------------------------------------------------------
+
+(define (test-check1)
+ (gnc:define-report 'version "1" 'name "Test Report Template" 'report-guid "54c2fc051af64a08ba2334c2e9179e23")
+)
+
+;; -----------------------------------------------------------------------
+
+(define (test-check2)
+ (if (not (gnc:define-report 'version "1" 'name "Test Report Template"))
+ #t
+ #f
+ )
+)
+
+;; -----------------------------------------------------------------------
+
+(define (test-check3)
+ (if (not (gnc:define-report 'version "1" 'name "Test Report Template" 'report-guid "54c2fc051af64a08ba2334c2e9179e23" 'parent-type "Parent Type" 'options-generator "Options Generator" 'renderer "Renderer" 'options-cleanup-cb "Options Clean-Up" 'options-changed-cb "Options Changed" 'in-menu? #f 'menu-path "Menu Path" 'menu-name "Menu Name" 'menu-tip "Menu Tip" 'export-types "Export Types" 'export-thunk "Export Thunk"))
+ #t
+ #f
+ )
+)
+
+;; -----------------------------------------------------------------------
+
+(define (test-check4)
+ (and
+ (gnc:define-report 'version "1" 'name "Test Report Template" 'report-guid "54c2fc051af64a08ba2334c2e9179e24" 'parent-type "Parent Type" 'options-generator "Options Generator" 'renderer "Renderer" 'options-cleanup-cb "Options Clean-Up" 'options-changed-cb "Options Changed" 'in-menu? #f 'menu-path "Menu Path" 'menu-name "Menu Name" 'menu-tip "Menu Tip" 'export-types "Export Types" 'export-thunk "Export Thunk")
+ (string=? (gnc:report-template-version (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "1")
+ (string=? (gnc:report-template-name (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Test Report Template")
+ (string=? (gnc:report-template-report-guid
+ (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "54c2fc051af64a08ba2334c2e9179e24")
+ ;; parent type is not exported -> it is used in gnc:make-report
+ (string=? (gnc:report-template-options-generator (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Options Generator")
+ (string=? (gnc:report-template-renderer (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")) "Renderer")
+ (string=? (gnc:report-template-options-cleanup-cb (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Options Clean-Up")
+ (string=? (gnc:report-template-options-changed-cb (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Options Changed")
+ (not (gnc:report-template-in-menu? (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24")))
+ (string=? (gnc:report-template-menu-path (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Menu Path")
+ (string=? (gnc:report-template-menu-name (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Menu Name")
+ (string=? (gnc:report-template-menu-tip (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Menu Tip")
+ (string=? (gnc:report-template-export-types (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Export Types")
+ (string=? (gnc:report-template-export-thunk (gnc:find-report-template "54c2fc051af64a08ba2334c2e9179e24"))"Export Thunk")
+ )
+)
Summary of changes:
gnucash/report/report-system/report.scm | 51 +++++++++-----
gnucash/report/report-system/test/CMakeLists.txt | 1 +
.../report-system/test/test-report-system.scm | 79 ++++++++++++++++++++++
3 files changed, 114 insertions(+), 17 deletions(-)
create mode 100644 gnucash/report/report-system/test/test-report-system.scm
More information about the gnucash-changes
mailing list