branch: externals/org
commit d1f6a4b9ec63a9ace2cec75685c80a9bf5aa9481
Author: Morgan Smith <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    Testing: Test org-columns with CLOCKSUM and CLOCKSUM_T properties
    
    * testing/lisp/test-org-colview.el
    (test-org-colview/column-property/clocksum)
    (test-org-colview/column-property/clocksum_t): New tests.
---
 testing/lisp/test-org-colview.el | 41 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el
index 623ee62838..681f4fe481 100644
--- a/testing/lisp/test-org-colview.el
+++ b/testing/lisp/test-org-colview.el
@@ -1399,6 +1399,47 @@
                (list (get-char-property (- (point) 1) 'org-columns-value)
                      (get-char-property (point) 'org-columns-value))))))))
 
+(ert-deftest test-org-colview/column-property/clocksum ()
+  "Test `org-columns' display of the CLOCKSUM property."
+  (org-test-with-temp-text
+      "* H
+CLOCK: [2022-11-03 06:00]--[2022-11-03 06:03] =>  0:03
+** S1
+CLOCK: [2022-11-03 06:03]--[2022-11-03 06:05] =>  0:02
+** S2
+empty
+** S3
+CLOCK: [2022-11-03 06:05]--[2022-11-03 06:06] =>  0:01"
+    (let ((org-columns-default-format "%CLOCKSUM"))
+      (org-columns))
+    (should
+     (equal
+      '("0:06" "0:02" "" "0:01")
+      (org-map-entries
+       (lambda ()
+         (get-char-property (point) 'org-columns-value-modified)))))))
+
+(ert-deftest test-org-colview/column-property/clocksum_t ()
+  "Test `org-columns' display of the CLOCKSUM_T property."
+  (org-test-at-time "<2022-11-03>"
+    (org-test-with-temp-text
+        "* H
+CLOCK: [2022-11-02 12:00]--[2022-11-03 02:00] =>  14:00
+** S1
+CLOCK: [2022-11-03 23:50]--[2022-11-04 01:50] =>  2:00
+** S2
+empty
+** S3
+CLOCK: [2022-11-03 06:05]--[2022-11-03 06:06] =>  0:01
+"
+      (let ((org-columns-default-format "%CLOCKSUM_T"))
+        (org-columns))
+      (should
+       (equal
+        '("2:11" "0:10" "" "0:01")
+        (org-map-entries
+         (lambda ()
+           (get-char-property (point) 'org-columns-value-modified))))))))
 
 
 ;;; Dynamic block

Reply via email to