]> git.eshelyaron.com Git - emacs.git/commitdiff
New test custom--test-theme-variables
authorMichael Albinus <michael.albinus@gmx.de>
Thu, 10 Jan 2019 12:27:34 +0000 (13:27 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Thu, 10 Jan 2019 12:27:34 +0000 (13:27 +0100)
* test/lisp/custom-tests.el (custom--test-user-option)
(custom--test-variable): New variables.
(custom--test-theme-variables): New test.

* test/lisp/custom-resources/custom--test-theme.el (custom--test):
New file.

test/lisp/custom-resources/custom--test-theme.el [new file with mode: 0644]
test/lisp/custom-tests.el

diff --git a/test/lisp/custom-resources/custom--test-theme.el b/test/lisp/custom-resources/custom--test-theme.el
new file mode 100644 (file)
index 0000000..da9121e
--- /dev/null
@@ -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)
index 16ad7db93cff156d7b12c62af4987bea381749c3..0c49db6c76d6bb2c97212c25b57c7d23acd4cb5b 100644 (file)
       (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