|
29 | 29 | (ert-deftest tl-test:setting-favorite-themes () |
30 | 30 | (unwind-protect |
31 | 31 | (progn |
32 | | - ;Should contain all themes as favorite by default |
33 | | - (should (equal theme-looper--favorite-themes |
| 32 | + ;;Should contain all themes as favorite by default |
| 33 | + (should (equal theme-looper--favorite-themes |
34 | 34 | (custom-available-themes))) |
35 | | - ;Should set the themes provided as favorite |
36 | | - (theme-looper-set-theme-set (list 'wombat |
37 | | - 'tango-dark |
38 | | - 'wheatgrass)) |
39 | | - (should (equal theme-looper--favorite-themes |
| 35 | + ;;Should set the themes provided as favorite |
| 36 | + (theme-looper-set-favorite-themes (list 'wombat |
| 37 | + 'tango-dark |
| 38 | + 'wheatgrass)) |
| 39 | + (should (equal theme-looper--favorite-themes |
40 | 40 | (list 'wombat |
41 | 41 | 'tango-dark |
42 | 42 | 'wheatgrass)))) |
43 | | - (setq theme-looper--favorite-themes |
| 43 | + (setq theme-looper--favorite-themes |
44 | 44 | (custom-available-themes)))) |
45 | 45 |
|
46 | 46 | (ert-deftest tl-test:disabling-enabled-themes () |
47 | 47 | (let ((current-theme (car custom-enabled-themes))) |
48 | 48 | (unwind-protect |
49 | 49 | (progn |
50 | | - ;Should be able to disable all enabled themes |
| 50 | + ;;Should be able to disable all enabled themes |
51 | 51 | (theme-looper--disable-all-themes) |
52 | 52 | (should (equal custom-enabled-themes |
53 | 53 | '()))) |
|
58 | 58 | (let ((current-theme (car custom-enabled-themes))) |
59 | 59 | (unwind-protect |
60 | 60 | (progn |
61 | | - (theme-looper-set-theme-set (list 'wombat |
62 | | - 'tango-dark |
63 | | - 'wheatgrass)) |
64 | | - ;Should identify the enabled theme |
| 61 | + (theme-looper-set-favorite-themes (list 'wombat |
| 62 | + 'tango-dark |
| 63 | + 'wheatgrass)) |
| 64 | + ;;Should identify the enabled theme |
65 | 65 | (load-theme 'wombat |
66 | 66 | t) |
67 | | - (should (equal (theme-looper--get-current-theme) |
| 67 | + (should (equal (theme-looper--get-current-theme) |
68 | 68 | 'wombat)) |
69 | | - ;Should identify the next theme position in the list |
| 69 | + ;;Should identify the next theme position in the list |
70 | 70 | (should (equal (theme-looper--get-next-theme-index) |
71 | 71 | 1)) |
72 | | - ;Should identify the next theme |
| 72 | + ;;Should identify the next theme |
73 | 73 | (should (equal (theme-looper--get-next-theme) |
74 | 74 | 'tango-dark)) |
75 | | - ;Should default to first theme as next theme when |
76 | | - ;current theme is not in the list |
| 75 | + ;;Should default to first theme as next theme when |
| 76 | + ;;current theme is not in the list |
77 | 77 | (load-theme 'manoj-dark |
78 | 78 | t) |
79 | 79 | (should (equal (theme-looper--get-next-theme) |
80 | 80 | 'wombat)) |
81 | | - ;Should loop back to the first theme when |
82 | | - ;current theme is the last in the list |
| 81 | + ;;Should loop back to the first theme when |
| 82 | + ;;current theme is the last in the list |
83 | 83 | (load-theme 'wheatgrass |
84 | 84 | t) |
85 | 85 | (should (equal (theme-looper--get-next-theme) |
86 | 86 | 'wombat))) |
87 | | - (setq theme-looper--favorite-themes |
| 87 | + (setq theme-looper--favorite-themes |
88 | 88 | (custom-available-themes)) |
89 | 89 | (load-theme current-theme |
90 | 90 | t)))) |
|
93 | 93 | (let ((current-theme (car custom-enabled-themes))) |
94 | 94 | (unwind-protect |
95 | 95 | (progn |
96 | | - (theme-looper-set-theme-set (list 'wombat |
97 | | - 'tango-dark |
98 | | - 'wheatgrass)) |
99 | | - ;Should select first theme when the selected theme in not in the list |
| 96 | + (theme-looper-set-favorite-themes (list 'wombat |
| 97 | + 'tango-dark |
| 98 | + 'wheatgrass)) |
| 99 | + ;;Should select first theme when the selected theme in not in the list |
100 | 100 | (load-theme 'tango |
101 | 101 | t) |
102 | 102 | (theme-looper-enable-next-theme) |
103 | 103 | (should (equal custom-enabled-themes |
104 | 104 | '(wombat))) |
105 | | - ;Should proceed to the next theme |
| 105 | + ;;Should proceed to the next theme |
106 | 106 | (theme-looper-enable-next-theme) |
107 | 107 | (should (equal custom-enabled-themes |
108 | 108 | '(tango-dark))) |
109 | | - ;Should loop back to the first theme when the cycle completes |
| 109 | + ;;Should loop back to the first theme when the cycle completes |
110 | 110 | (theme-looper-enable-next-theme) |
111 | 111 | (theme-looper-enable-next-theme) |
112 | 112 | (should (equal custom-enabled-themes |
113 | 113 | '(wombat)))) |
114 | | - (setq theme-looper--favorite-themes |
| 114 | + (setq theme-looper--favorite-themes |
115 | 115 | (custom-available-themes)) |
116 | 116 | (load-theme current-theme |
117 | 117 | t)))) |
118 | 118 |
|
119 | 119 | (ert-deftest tl-test:adding-customization () |
120 | 120 | (let ((current-theme (car custom-enabled-themes)) |
121 | | - (current-face-height (face-attribute 'default |
| 121 | + (current-face-height (face-attribute 'default |
122 | 122 | :height))) |
123 | 123 | (unwind-protect |
124 | 124 | (progn |
125 | | - (message (concatenate 'string |
126 | | - "current-face-height: " |
127 | | - (number-to-string current-face-height))) |
128 | | - (theme-looper-set-theme-set (list 'wombat |
129 | | - 'tango-dark |
130 | | - 'wheatgrass)) |
131 | | - ;Should apply customizations when specified |
| 125 | + (message (concatenate 'string |
| 126 | + "current-face-height: " |
| 127 | + (number-to-string current-face-height))) |
| 128 | + (theme-looper-set-favorite-themes (list 'wombat |
| 129 | + 'tango-dark |
| 130 | + 'wheatgrass)) |
| 131 | + ;;Should apply customizations when specified |
132 | 132 | (load-theme 'tango |
133 | 133 | t) |
134 | | - (theme-looper-set-customizations (lambda () |
135 | | - (set-face-attribute 'default nil |
136 | | - :height 120))) |
| 134 | + (theme-looper-set-post-switch-script (lambda () |
| 135 | + (set-face-attribute 'default nil |
| 136 | + :height 120))) |
137 | 137 | (theme-looper-enable-next-theme) |
138 | | - (message (concatenate 'string |
139 | | - "found face-height: " |
140 | | - (number-to-string (face-attribute 'default :height)))) |
| 138 | + (message (concatenate 'string |
| 139 | + "found face-height: " |
| 140 | + (number-to-string (face-attribute 'default :height)))) |
141 | 141 | (should (< (abs (- (face-attribute 'default :height) |
142 | 142 | 120)) |
143 | 143 | 2))) |
144 | | - (setq theme-looper--favorite-themes |
| 144 | + (setq theme-looper--favorite-themes |
145 | 145 | (custom-available-themes)) |
146 | 146 | (load-theme current-theme |
147 | 147 | t) |
148 | | - (set-face-attribute 'default nil |
| 148 | + (set-face-attribute 'default nil |
149 | 149 | :height current-face-height)))) |
150 | 150 |
|
151 | 151 | ;;; theme-looper-tests.el ends here |
0 commit comments