Преглед изворни кода

org-timer: Fix timer setting from effort property

Testcase included.
Marco Wahl пре 7 година
родитељ
комит
2b5ce91b35
2 измењених фајлова са 17 додато и 1 уклоњено
  1. 1 1
      lisp/org-timer.el
  2. 16 0
      testing/lisp/test-org-timer.el

+ 1 - 1
lisp/org-timer.el

@@ -436,7 +436,7 @@ using three `C-u' prefix arguments."
 	   (if (numberp org-timer-default-timer)
 	       (number-to-string org-timer-default-timer)
 	     org-timer-default-timer))
-	 (effort-minutes (ignore-errors (org-get-at-eol 'effort-minutes 1)))
+	 (effort-minutes (ignore-errors (floor (org-get-at-eol 'effort-minutes 1))))
 	 (minutes (or (and (numberp opt) (number-to-string opt))
 		      (and (not (equal opt '(64)))
 			   effort-minutes

+ 16 - 0
testing/lisp/test-org-timer.el

@@ -279,5 +279,21 @@ Also, mute output from `message'."
      (org-timer-start))
    :type (list 'error 'user-error)))
 
+(ert-deftest test-org-timer/set-timer-from-effort-prop ()
+  "Test timer setting from effort property."
+  (should
+   (< (* 60 9) 				; 9m
+      (test-org-timer/with-temp-text
+       "* foo
+:PROPERTIES:
+:Effort:   10
+:END:"
+       (org-mode)
+       (org-timer-set-timer)
+       (org-timer-hms-to-secs (org-timer nil t)))
+      (1+ (* 60 10))			; 10m 1s
+      )))
+
+
 (provide 'test-org-timer)
 ;;; test-org-timer.el end here