branch: externals/org
commit 096818b001769f273d9b7d0ec0f14f4e53f59eff
Author: Slawomir Grochowski <[email protected]>
Commit: Slawomir Grochowski <[email protected]>

    ; org-colview: Test hierarchical custom summaries
    
    * testing/lisp/test-org-colview.el
      (test-org-colview/columns-custom-summary-hierarchical): Add a
      regression test for custom summaries on hierarchical headings.
    
    No behavior change.
---
 testing/lisp/test-org-colview.el | 44 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el
index 01152a19f4..ff357eb360 100644
--- a/testing/lisp/test-org-colview.el
+++ b/testing/lisp/test-org-colview.el
@@ -1063,6 +1063,50 @@ 
https://list.orgmode.org/[email protected]/T/#u.";
       (list (get-char-property (point) 'org-columns-value-modified)
            (get-char-property (1+ (point)) 'org-columns-value-modified))))))
 
+(ert-deftest test-org-colview/columns-custom-summary-hierarchical ()
+  "Test custom summary types on hierarchical headings."
+  (should
+   (equal
+    '(("Root" . "1|2|3|4")
+      ("Group 1" . "1|2")
+      ("Leaf 1" . "1")
+      ("Leaf 2" . "2")
+      ("Group 2" . "3|4")
+      ("Leaf 3" . "3")
+      ("Leaf 4" . "4"))
+    (org-test-with-temp-text
+       "* Root
+** Group 1
+*** Leaf 1
+:PROPERTIES:
+:A: 1
+:END:
+*** Leaf 2
+:PROPERTIES:
+:A: 2
+:END:
+** Group 2
+*** Leaf 3
+:PROPERTIES:
+:A: 3
+:END:
+*** Leaf 4
+:PROPERTIES:
+:A: 4
+:END:"
+      (let ((org-columns-summary-types
+            '(("join" . (lambda (values _)
+                            (mapconcat #'identity values "|")))))
+           (org-columns-default-format "%A{join}"))
+       (org-columns))
+      (let (results)
+       (org-map-entries
+        (lambda ()
+          (push (cons (org-get-heading t t t t)
+                      (get-char-property (point) 'org-columns-value-modified))
+                results)))
+       (nreverse results))))))
+
 (ert-deftest test-org-colview/columns-new ()
   "Test `org-columns-new' specifications."
   ;; Insert new column at the left of the current one.

Reply via email to