diff options
| author | Chong Yidong | 2012-08-18 15:23:30 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-08-18 15:23:30 +0800 |
| commit | a999ce26e90babdc212085a06fbd84c176200d84 (patch) | |
| tree | aa19406bc25112f4ff66cb419360672d7fac550f /test | |
| parent | 39eb03f1b023ae3d94e311f6f5d9f913f75c42c4 (diff) | |
| download | emacs-a999ce26e90babdc212085a06fbd84c176200d84.tar.gz emacs-a999ce26e90babdc212085a06fbd84c176200d84.zip | |
Make display strings obey buffer-invisibility-spec.
* src/xdisp.c (handle_invisible_prop): Obey TEXT_PROP_MEANS_INVISIBLE
for the string case.
* redisplay-testsuite.el (test-redisplay-4): New test.
Fixes: debbugs:3874
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 4 | ||||
| -rw-r--r-- | test/redisplay-testsuite.el | 95 |
2 files changed, 98 insertions, 1 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index f1bf458f812..cd7e9fd7ccc 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-08-18 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * redisplay-testsuite.el (test-redisplay-4): New test (Bug#3874). | ||
| 4 | |||
| 1 | 2012-08-14 Dmitry Gutov <dgutov@yandex.ru> | 5 | 2012-08-14 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 6 | ||
| 3 | * indent/ruby.rb: Rearrange examples, add new ones. | 7 | * indent/ruby.rb: Rearrange examples, add new ones. |
diff --git a/test/redisplay-testsuite.el b/test/redisplay-testsuite.el index f080b6db4f1..99924daa3d9 100644 --- a/test/redisplay-testsuite.el +++ b/test/redisplay-testsuite.el | |||
| @@ -113,7 +113,7 @@ | |||
| 113 | (insert "\n\n")) | 113 | (insert "\n\n")) |
| 114 | 114 | ||
| 115 | (defun test-redisplay-3 () | 115 | (defun test-redisplay-3 () |
| 116 | (insert "Test 3: Overlay with before/after strings and images:\n\n") | 116 | (insert "Test 3: Overlay with strings and images:\n\n") |
| 117 | (let ((img-data "#define x_width 8 | 117 | (let ((img-data "#define x_width 8 |
| 118 | #define x_height 8 | 118 | #define x_height 8 |
| 119 | static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff };")) | 119 | static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff };")) |
| @@ -165,6 +165,95 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff | |||
| 165 | (overlay-put ov2 'before-string "C") | 165 | (overlay-put ov2 'before-string "C") |
| 166 | (overlay-put ov3 'display `(image :data ,img-data :type xbm)))))) | 166 | (overlay-put ov3 'display `(image :data ,img-data :type xbm)))))) |
| 167 | 167 | ||
| 168 | (defun test-redisplay-4 () | ||
| 169 | (insert "Test 4: Overlay strings and invisibility:\n\n") | ||
| 170 | ;; Before and after strings with non-nil `invisibility'. | ||
| 171 | (insert " Expected: ABC\n") | ||
| 172 | (insert " Result: ") | ||
| 173 | (let ((opoint (point))) | ||
| 174 | (insert "ABC\n") | ||
| 175 | (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) | ||
| 176 | (overlay-put ov 'before-string | ||
| 177 | (propertize "XX" 'invisible | ||
| 178 | 'test-redisplay--simple-invis)) | ||
| 179 | (overlay-put ov 'after-string | ||
| 180 | (propertize "XX" 'invisible | ||
| 181 | 'test-redisplay--simple-invis)))) | ||
| 182 | |||
| 183 | ;; Before and after strings bogus `invisibility' property (value is | ||
| 184 | ;; not listed in `buffer-invisibility-spec'). | ||
| 185 | (insert "\n Expected: ABC") | ||
| 186 | (insert "\n Result: ") | ||
| 187 | (let ((opoint (point))) | ||
| 188 | (insert "B\n") | ||
| 189 | (let ((ov (make-overlay opoint (1+ opoint)))) | ||
| 190 | (overlay-put ov 'before-string | ||
| 191 | (propertize "A" 'invisible 'bogus-invis-spec)) | ||
| 192 | (overlay-put ov 'after-string | ||
| 193 | (propertize "C" 'invisible 'bogus-invis-spec)))) | ||
| 194 | |||
| 195 | ;; Before/after string with ellipsis `invisibility' property. | ||
| 196 | (insert "\n Expected: ...B...") | ||
| 197 | (insert "\n Result: ") | ||
| 198 | (let ((opoint (point))) | ||
| 199 | (insert "B\n") | ||
| 200 | (let ((ov (make-overlay opoint (1+ opoint)))) | ||
| 201 | (overlay-put ov 'before-string | ||
| 202 | (propertize "A" 'invisible 'test-redisplay--ellipsis-invis)) | ||
| 203 | (overlay-put ov 'after-string | ||
| 204 | (propertize "C" 'invisible 'test-redisplay--ellipsis-invis)))) | ||
| 205 | |||
| 206 | ;; Before/after string with partial ellipsis `invisibility' property. | ||
| 207 | (insert "\n Expected: A...ABC...C") | ||
| 208 | (insert "\n Result: ") | ||
| 209 | (let ((opoint (point))) | ||
| 210 | (insert "B\n") | ||
| 211 | (let ((ov (make-overlay opoint (1+ opoint))) | ||
| 212 | (a "AAA") | ||
| 213 | (c "CCC")) | ||
| 214 | (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis a) | ||
| 215 | (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis c) | ||
| 216 | (overlay-put ov 'before-string a) | ||
| 217 | (overlay-put ov 'after-string c))) | ||
| 218 | |||
| 219 | ;; Display string with `invisibility' property. | ||
| 220 | (insert "\n Expected: ABC") | ||
| 221 | (insert "\n Result: ") | ||
| 222 | (let ((opoint (point))) | ||
| 223 | (insert "AYBC\n") | ||
| 224 | (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) | ||
| 225 | (overlay-put ov 'display | ||
| 226 | (propertize "XX" 'invisible | ||
| 227 | 'test-redisplay--simple-invis)))) | ||
| 228 | ;; Display string with bogus `invisibility' property. | ||
| 229 | (insert "\n Expected: ABC") | ||
| 230 | (insert "\n Result: ") | ||
| 231 | (let ((opoint (point))) | ||
| 232 | (insert "AXC\n") | ||
| 233 | (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) | ||
| 234 | (overlay-put ov 'display | ||
| 235 | (propertize "B" 'invisible 'bogus-invis-spec)))) | ||
| 236 | ;; Display string with ellipsis `invisibility' property. | ||
| 237 | (insert "\n Expected: A...C") | ||
| 238 | (insert "\n Result: ") | ||
| 239 | (let ((opoint (point))) | ||
| 240 | (insert "AXC\n") | ||
| 241 | (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) | ||
| 242 | (overlay-put ov 'display | ||
| 243 | (propertize "B" 'invisible | ||
| 244 | 'test-redisplay--ellipsis-invis)))) | ||
| 245 | ;; Display string with partial `invisibility' property. | ||
| 246 | (insert "\n Expected: A...C") | ||
| 247 | (insert "\n Result: ") | ||
| 248 | (let ((opoint (point))) | ||
| 249 | (insert "X\n") | ||
| 250 | (let ((ov (make-overlay opoint (1+ opoint))) | ||
| 251 | (str "ABC")) | ||
| 252 | (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis str) | ||
| 253 | (overlay-put ov 'display str))) | ||
| 254 | |||
| 255 | (insert "\n")) | ||
| 256 | |||
| 168 | 257 | ||
| 169 | (defun test-redisplay () | 258 | (defun test-redisplay () |
| 170 | (interactive) | 259 | (interactive) |
| @@ -173,8 +262,12 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff | |||
| 173 | (kill-buffer buf)) | 262 | (kill-buffer buf)) |
| 174 | (pop-to-buffer (get-buffer-create "*Redisplay Test*")) | 263 | (pop-to-buffer (get-buffer-create "*Redisplay Test*")) |
| 175 | (erase-buffer) | 264 | (erase-buffer) |
| 265 | (setq buffer-invisibility-spec | ||
| 266 | '(test-redisplay--simple-invis | ||
| 267 | (test-redisplay--ellipsis-invis . t))) | ||
| 176 | (test-redisplay-1) | 268 | (test-redisplay-1) |
| 177 | (test-redisplay-2) | 269 | (test-redisplay-2) |
| 178 | (test-redisplay-3) | 270 | (test-redisplay-3) |
| 271 | (test-redisplay-4) | ||
| 179 | (goto-char (point-min)))) | 272 | (goto-char (point-min)))) |
| 180 | 273 | ||