|
@@ -1847,6 +1847,74 @@ is t, then new columns should be added as needed"
|
|
|
(buffer-string)))))
|
|
|
|
|
|
|
|
|
+(ert-deftest test-org-table/orgtbl-ascii-draw ()
|
|
|
+ "Test `orgtbl-ascii-draw'."
|
|
|
+ ;; First value: Make sure that an integer input value is converted to a
|
|
|
+ ;; float before division. Further values: Show some float input value
|
|
|
+ ;; ranges corresponding to the same bar width.
|
|
|
+ ;; TODO Fix ranges in `orgtbl-ascii-draw'.
|
|
|
+ (should
|
|
|
+ (equal
|
|
|
+ (org-test-with-temp-text
|
|
|
+ "
|
|
|
+| Value | <l> |
|
|
|
+|----------+---------|
|
|
|
+| 19 | replace |
|
|
|
+|----------+---------|
|
|
|
+| -0.00001 | replace |
|
|
|
+| 0.00000 | replace |
|
|
|
+| 0.99999 | replace |
|
|
|
+| 1.00000 | replace |
|
|
|
+| 1.99999 | replace |
|
|
|
+| 23.00000 | replace |
|
|
|
+| 23.99999 | replace |
|
|
|
+| 24.00000 | replace |
|
|
|
+| 24.00000 | replace |
|
|
|
+| 24.00001 | replace |
|
|
|
+<point>#+TBLFM: $2 = '(orgtbl-ascii-draw $1 0 24 3 \" 12345678\")"
|
|
|
+ (org-table-calc-current-TBLFM)
|
|
|
+ (buffer-string))
|
|
|
+ "
|
|
|
+| Value | <l> |
|
|
|
+|----------+-----------|
|
|
|
+| 19 | 883 |
|
|
|
+|----------+-----------|
|
|
|
+| -0.00001 | too small |
|
|
|
+| 0.00000 | |
|
|
|
+| 0.99999 | |
|
|
|
+| 1.00000 | 1 |
|
|
|
+| 1.99999 | 1 |
|
|
|
+| 23.00000 | 887 |
|
|
|
+| 23.99999 | 887 |
|
|
|
+| 24.00000 | 888 |
|
|
|
+| 24.00000 | 888 |
|
|
|
+| 24.00001 | too large |
|
|
|
+#+TBLFM: $2 = '(orgtbl-ascii-draw $1 0 24 3 \" 12345678\")"))
|
|
|
+ ;; Draw bars with a bullet. The bullet does not count in the parameter
|
|
|
+ ;; WIDTH of `orgtbl-ascii-draw'.
|
|
|
+ (should
|
|
|
+ (equal
|
|
|
+ (org-test-with-temp-text
|
|
|
+ "
|
|
|
+| -1 | replace |
|
|
|
+| 0 | replace |
|
|
|
+| 1 | replace |
|
|
|
+| 2 | replace |
|
|
|
+| 3 | replace |
|
|
|
+| 4 | replace |
|
|
|
+<point>#+TBLFM: $2 = '(orgtbl-ascii-draw $1 0 3 3 \"$-\")"
|
|
|
+ (org-table-calc-current-TBLFM)
|
|
|
+ (buffer-string))
|
|
|
+ "
|
|
|
+| -1 | too small |
|
|
|
+| 0 | $ |
|
|
|
+| 1 | -$ |
|
|
|
+| 2 | --$ |
|
|
|
+| 3 | ---$ |
|
|
|
+| 4 | too large |
|
|
|
+#+TBLFM: $2 = '(orgtbl-ascii-draw $1 0 3 3 \"$-\")")))
|
|
|
+
|
|
|
+
|
|
|
(provide 'test-org-table)
|
|
|
|
|
|
;;; test-org-table.el ends here
|