diff options
| -rw-r--r-- | test/lisp/custom-resources/custom--test-theme.el | 9 | ||||
| -rw-r--r-- | test/lisp/custom-tests.el | 39 |
2 files changed, 48 insertions, 0 deletions
diff --git a/test/lisp/custom-resources/custom--test-theme.el b/test/lisp/custom-resources/custom--test-theme.el new file mode 100644 index 00000000000..da9121e0a0a --- /dev/null +++ b/test/lisp/custom-resources/custom--test-theme.el | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | (deftheme custom--test | ||
| 2 | "A test theme.") | ||
| 3 | |||
| 4 | (custom-theme-set-variables | ||
| 5 | 'custom--test | ||
| 6 | '(custom--test-user-option 'bar) | ||
| 7 | '(custom--test-variable 'bar)) | ||
| 8 | |||
| 9 | (provide-theme 'custom--test) | ||
diff --git a/test/lisp/custom-tests.el b/test/lisp/custom-tests.el index 16ad7db93cf..0c49db6c76d 100644 --- a/test/lisp/custom-tests.el +++ b/test/lisp/custom-tests.el | |||
| @@ -84,4 +84,43 @@ | |||
| 84 | (when (file-directory-p tmpdir) | 84 | (when (file-directory-p tmpdir) |
| 85 | (delete-directory tmpdir t))))) | 85 | (delete-directory tmpdir t))))) |
| 86 | 86 | ||
| 87 | (defcustom custom--test-user-option 'foo | ||
| 88 | "User option for test." | ||
| 89 | :group 'emacs | ||
| 90 | :type 'symbol) | ||
| 91 | |||
| 92 | (defvar custom--test-variable 'foo | ||
| 93 | "Variable for test.") | ||
| 94 | |||
| 95 | ;; This is demonstrating bug#34027. | ||
| 96 | (ert-deftest custom--test-theme-variables () | ||
| 97 | "Test variables setting with enabling / disabling a custom theme." | ||
| 98 | :expected-result :failed | ||
| 99 | ;; We load custom-resources/custom--test-theme.el. | ||
| 100 | (let ((custom-theme-load-path | ||
| 101 | `(,(expand-file-name "custom-resources" (file-name-directory #$))))) | ||
| 102 | (load-theme 'custom--test 'no-confirm 'no-enable) | ||
| 103 | ;; The variables have still their initial values. | ||
| 104 | (should (equal custom--test-user-option 'foo)) | ||
| 105 | (should (equal custom--test-variable 'foo)) | ||
| 106 | |||
| 107 | (custom-set-variables | ||
| 108 | '(custom--test-user-option 'baz) | ||
| 109 | '(custom--test-variable 'baz)) | ||
| 110 | ;; The initial values have been changed. | ||
| 111 | (should (equal custom--test-user-option 'baz)) | ||
| 112 | (should (equal custom--test-variable 'baz)) | ||
| 113 | |||
| 114 | (enable-theme 'custom--test) | ||
| 115 | ;; The variables have the theme values. | ||
| 116 | (should (equal custom--test-user-option 'bar)) | ||
| 117 | (should (equal custom--test-variable 'bar)) | ||
| 118 | |||
| 119 | (disable-theme 'custom--test) | ||
| 120 | ;; The variables should have the changed values, by reverting. | ||
| 121 | ;; This doesn't work as expected. Instead, they have their | ||
| 122 | ;; initial values `foo'. | ||
| 123 | (should (equal custom--test-user-option 'baz)) | ||
| 124 | (should (equal custom--test-variable 'baz)))) | ||
| 125 | |||
| 87 | ;;; custom-tests.el ends here | 126 | ;;; custom-tests.el ends here |