diff options
Diffstat (limited to 'test')
-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 @@ +(deftheme custom--test + "A test theme.") + +(custom-theme-set-variables + 'custom--test + '(custom--test-user-option 'bar) + '(custom--test-variable 'bar)) + +(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 @@ (when (file-directory-p tmpdir) (delete-directory tmpdir t))))) +(defcustom custom--test-user-option 'foo + "User option for test." + :group 'emacs + :type 'symbol) + +(defvar custom--test-variable 'foo + "Variable for test.") + +;; This is demonstrating bug#34027. +(ert-deftest custom--test-theme-variables () + "Test variables setting with enabling / disabling a custom theme." + :expected-result :failed + ;; We load custom-resources/custom--test-theme.el. + (let ((custom-theme-load-path + `(,(expand-file-name "custom-resources" (file-name-directory #$))))) + (load-theme 'custom--test 'no-confirm 'no-enable) + ;; The variables have still their initial values. + (should (equal custom--test-user-option 'foo)) + (should (equal custom--test-variable 'foo)) + + (custom-set-variables + '(custom--test-user-option 'baz) + '(custom--test-variable 'baz)) + ;; The initial values have been changed. + (should (equal custom--test-user-option 'baz)) + (should (equal custom--test-variable 'baz)) + + (enable-theme 'custom--test) + ;; The variables have the theme values. + (should (equal custom--test-user-option 'bar)) + (should (equal custom--test-variable 'bar)) + + (disable-theme 'custom--test) + ;; The variables should have the changed values, by reverting. + ;; This doesn't work as expected. Instead, they have their + ;; initial values `foo'. + (should (equal custom--test-user-option 'baz)) + (should (equal custom--test-variable 'baz)))) + ;;; custom-tests.el ends here |